Robotic Sensors & Signal Processing
This repo is for testing servo with raspberry pi 3b+ and uses python code for controlling the servo.
Things to do in this project are:
- Calibration Servo using Limit Switch
- Rotating 90° after Homing.
- Controlling the servo using potentiometer.
- Detecting objects using a Ultrasonic sensor.
- If the object is too close (Less than 15 cm) LED, should turn ON.
- If the object is too close, (Less than 15 cm) servo should be disabled while operating the potentiometer.
- When the potentiometer is "0" the servo should move to 0° and also should activate the LED indicating the servo reached 0°.
- When the potentiometer is "1023" the servo should move to 90° and also should activate LED indicating the servo reached 90°.
To keep things neat. I made a case to place my components.
Check out this like to print for case for yourself
In this project, I have used the Raspberry Pi 3b+ model.
Note : In Raspberry pi, you cannot drive 5V OUTPUT/INPUT sensor (or) actuator.
Hardware :
- Raspberry Pi 3b+
- MCP3008 - ADC (Analog to Digital Convertor)
- Limit Switch
- Servo - SG90
- 10k Potentiometer
- Ultrasonic Sensor (HC-SR04)
- Red LED
- Green LED
- Some Resistors (220E , 1K , 470E, 750E)
3.3V - |1 2| - 5V
|3 4| - 5v
|5 6| - GND
|7 8| - Limit Switch (INPUT)
|9 10| - LED (Human Detection - OUTPUT)
|11 12| - Servo (PWM - OUTPUT)
|13 14|
|15 16|
|17 18|
MOSI (SPI0) - |19 20|
MISO (SPI0) - |21 22|
Serial CLK (SPI0) - |23 24| - CS (Chip Select - SPI0)
|25 26|
|27 28|
|29 30|
|31 32|
|33 34|
|35 36| - LED ( 0° Position - OUTPUT)
Echo (Ultrasonic Sensor) - |37 38| - LED ( 90° Position - OUTPUT)
|39 40| - Trig (Ultrasonic Sensor)
These are the BMC pins of raspberry p, which means physical pins.
(Potentiometer) Channel 0 - |1 2| - 3.3V
Channel 1 - |3 4| - 3.3v
Channel 2 - |5 6| - GND
Channel 3 - |7 8| - Serial CLK
Channel 4 - |9 10| - MISO
Channel 5 - |11 12| - MOSI
Channel 6 - |13 14| - CS (Chip Select)
Channel 7 - |15 16| - GND
Here the step by step video for installing and setting RPi.
Here is the video performing the requirements.