The parts list needed for the (start) of this experiment are:
After starting to put things together, I wanted to make sure I was doing everything correctly. There are several pages I found that were helpful in putting things together:
- http://www.scottmetoyer.com/archives/dfrobot-4wd-arduino-mobile-platform
- http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile
- http://www.dfrobot.com/wiki/index.php?title=Wheel_Encoders_for_DFRobot_3PA_and_4WD_Rovers_(SKU:SEN0038)
- http://www.dfrobot.com/wiki/index.php?title=4WD_Mobile_Platform_(SKU:ROB0003)
While not all those links go with the same model I was using (SKU:ROB0025), they were helpful nonetheless. Here are some pictures after assembly.
One of the tricky part was how to setup the power switch. When I first wired things up, I did not connect the switch. I simply wired the battery pack to the motor shield and the motors started up right away. This caused problems when I was testing out making the motors spin as there was no easy way to turn things off. Since there were no instructions, I had to wing it on connecting the switch. Not too complicated as there are three connections on the switch. A little testing with the multimeter showed which connections should be used for off and on. Here is a picture of the switch connection. I think I will also investigate getting a rechargeable batter at some point as the batteries are somewhat hard to get to in this configuration.
Next it was onto the code. I wanted to do something simple at first to just test that the four wheels were all wired properly and moving in the right direction. Again, the code is posted at the github site:
There is a class called Manual that will eventually be used to remote control the robot to move around the room. My current plan is to finish up getting the sensors setup to record measurements. Then manually drive the robot in circles to collect sensor measurement data and make some plots of the various sensor readings (encoders, accelerometer, magnetometer, gyroscope). I only have a few more sensors to hook up and then write code to dump all the data to a serial port. I also need to write the manual controller and play around with steering. However, I have realized that I do not have enough pins on the Arduino to hook everything up. I ordered a mega board so that I can be sure to collect enough measurements. Next up, will be writing code for the ultrasonic range sensor. That should allow some crude obstacle avoidance and maybe some initial estimates for SLAM.
Here is a quick movie of the wheels spinning with the simple test program.
upload a code to run the robot in straight path
ReplyDelete