#ym4-arduino-uno img { margin:5px; padding:5px; display:block; }
Another weekend night of hacking fun hooking up a Arduino Uno with YM4 robotic car from EmbeDream. The YM4 is a well designed FIRA compliant robot car with built in power supply. The left and right wheels are controlled independently and the built in feedback from wheels.
The break out board for the YM4 is easy to work with. The H-bridge control are CT1, CT2, and CT3. CT1 control the speed with PWM and CT2/CT3 decide the direction of the wheel. This is the same configuration for both wheels. The following is a quick sketch to get YM4 going forward.
#define RIGHT_CTRL_1 5
#define RIGHT_CTRL_2 6
#define RIGHT_CTRL_3 7
#define LEFT_CTRL_1 11
#define LEFT_CTRL_2 12
#define LEFT_CTRL_3 13
void setup()
{
pinMode(RIGHT_CTRL_2, OUTPUT);
pinMode(RIGHT_CTRL_3, OUTPUT);
pinMode(LEFT_CTRL_2, OUTPUT);
pinMode(LEFT_CTRL_3, OUTPUT);
}
void loop()
{
digitalWrite(RIGHT_CTRL_2, 0);
digitalWrite(RIGHT_CTRL_3, 1);
analogWrite(RIGHT_CTRL_1, 128);
digitalWrite(LEFT_CTRL_2, 0);
digitalWrite(LEFT_CTRL_3, 1);
analogWrite(LEFT_CTRL_1, 128);
}
Now, the TODO list
- Find a more secure way to protect the Uno board and protect it from bumping into objects when robot start to run
- Figure out how and where to attach sensors: ultrasonic distance and infra red for distance and obstacle sensing
发表评论