Reference

This article serves as a reference guide on using the Metro Library for sensor timing and motor control with PWM in robotics projects, covering ultrasonic sensing, motor direction control, and servo positioning, and suggesting ways to expand functionality with Bluetooth, webcams, and additional sensors.

Library

  • Metro Library: Required for timing the sensor measurements and servo sweep. Download from https://www.dfrobot.com.cn/images/upload/File/20141031110246wu4065.rar. Extract to the Arduino libraries folder (e.g., Documents/Arduino/libraries).

Principle

  • Motor Control: The L298P motor driver uses PWM (Pulse-Width Modulation) to control motor speed (via pins D5/D6) and digital signals (via D4/D7) to control direction.
  • Ultrasonic Sensing: The URM sensor emits ultrasonic pulses and measures the time for the echo to return (via D3) to calculate distance (distance = time / 50, since 50 µs = 1 cm).
  • Servo Control: The servo uses PWM signals (via D9) to set its angular position (0° to 180°).

Other Supplementary Information

  • Cherokey Instruction Manual: https://github.com/Arduinolibrary/DFRobot_Cherokey/blob/master/ROB0117%20Instruction%20Manual%20-%20pressed.pdf
  • DFRobot Forum: https://www.dfrobot.com/forum/ (for sharing projects/asking questions)
  • Next Steps: Add Bluetooth control, a webcam for FPV, or additional sensors (e.g., IR, GPS) to expand the robot's functionality.

Was this article helpful?

TOP