Hint: upload the code and open the "Serial Monitor" to make sure that the ultrasonic is correctly mounted and also check the sensor reading. The servo motor should start moving if the distance is less then 20 cm ...



  • Arduino Nano R3 (any arduino board)
  • Mini breadboard (for nano)
  • jumper wires
  • S3003 Standard servo (or micro servo)
  • Ultrasonic HC-SR04
  • 18650 batteries (x2) = 7.4 volts
  • Robot chassis 2WD (2 motors + castor + chassis)
  • L298N Module
  • Power switch (optional)