Introduction: Distance to Angle Arduino Project

this is a very simple project for beginers, the carton box equiped with 3
servo motors, ultrasonic sensor, and arduino nano microcontroller. the microcontroller convert the distance to the servo angle.

you can see it working here

Step 1: Part List

3 servo motors : 7$
1 arduino nano clone microcontroller or any other one : 3$

1 ultrasonic sensor : 2$

1 carton box

6v power battery : 2$

total pa

Step 2: Connecting All the Parts and Writing Some Code

connect the servo motors to 3 pwm pins, in this case we using the arduino nano and the servo motors connected to the pins 3, 5 and 8. the arduino nano has 6 pwm pins so you can connect up to 6 servo motors.

connect the ultrasonic sensor pins in this order:

the GND pin of the sensor needs to be connected to the microcontroller GND.

the trigger Pin of the sensor needs to be connected to the microcontroller pin 11

the echo Pin of the sensor needs to be connected to the microcontroller pin 10

the vcc Pin of the sensor needs to be connected to the microcontroller 5v pin

place the motors in the box as you see in the picture.

time for coding!

i wrote a simple code to controll it and it can be much better.

the code is very easy to understand and you can just copy and paste it to your board.


please subscribe to my youtube channel for more tutorials :

https://www.youtube.com/channel/UC9CqbqZjjuGsSXhD3di2_zA