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
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Part List
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 :