Saturday, May 29, 2010

Arduino Robots – A First Attempt!

Hey Arduinoists everywhere! I am proud to proclaim that I am now one of you!!

The Arduino hardware/software platform is awesome in so many ways and has made my job of entry level robot designer much easier! Let me add that I didn't have any prior experience with building robots. This project has helped me quite a bit to jump start the process. While I still have a lot to learn, I can say that I have very quickly acquired a pretty good base to continue building on. It’s exciting and fun! And so, this is the main reason I am posting this blog entry. Read on …

Making Robots
As I mentioned above, this is the first time I have ever attempted an electronics project of this complexity. I had built a simple timer circuit when I was younger, but not much beyond that. Having a casual interest in robotics for a while, I never felt like I had access to the right tools and tech to approach the subject until I heard about the Arduino microcontroller. I read a bit about what people were doing with them online, watched about a hundred Youtube “Hey I Made a Segway Arduino Robot” videos, and then ordered a few boards, sensors and other starter kit stuff. Once the orders arrived at my doorstep, I commenced to begin the basic exploration via the numerous examples available all over the web. Progressing through, blinking LED’s, onto LCD panel output, and then to the PING)) and Compass sensors.

Although I had a general idea in mind for the mechanical bits, I didn’t really know the best way to go with the microcontroller. My robot (i call it bot[Zero]) grew organically. I worked on particular example problems first and then started connecting parts later. Those boards and pieces of example sketches (Arduino programs) later became my current hardware/software prototype.botZero_drawing

Before I go into the details of this design and it’s construction, I want to make reference here of useful resources for beginning Arduino users: ... the master site of the Arduino platform.

Retail websites I used for parts: MakerSHED , Hacktronics
NKC Electronics All Electronics Adafruit Pololu Robot Shop

Design and Construction
About how I first approached the design of this robot ... I didn’t really have a good plan in my head until after I finished a prototype board assembly with the PING and Compass sensors. Once I saw those numbers appear on the LCD panel I rigged, I immediately imagined using that data to steer a three-wheeled robot. Three wheels? Why three? Because, the steering assembly construction appeared to me to be much less complex for a single steering wheel. Plus, I wanted to build it by hand, instead of ordering some chassis kit and assembling that. Don’t get me wrong, those assembly kits seem like great ways to quickly get your project up and running mechanically. But for myself, I was just as interested in the mechanics as in the electronics and control software, so I decided on the tricycle platform for ease of construction.

Now onto the electronics! I will cover the most fundamental points first. At the heart of this design is a pair of Arduino Duemilanove microcontrollers, linked together by a simple serial connection. My robot could have been constructed with a single Arduino board, however, I wanted to make sure I had plenty of room for growth (servos, motors, and various sensors and other micro-peripherals) in the future. Also, I liked the idea of separating the platform into sensor data acquisition and motion control for a more componentized organization. The only problem here is, you can’t just *snap* two of these boards together to make a larger one. They both operate on separate clocks – therefore, I had to create a simple handshaking algorithm for data exchange between the two boards. This was not hard, as like most other things Arduino, there was a good example already on the Arduino site. I will cover the details of the serial communications and handshaking code in a later post, for now let me just say, cross the TX/RX lines and MAKE THAT COMMON GROUND!!

Boards, Sensors, Motors
Now looking at the two Arduinos used in this design, you can see the top most board on the robot is the sensor board. It is connected electrically to a PING))) ultrasonic sensor(ultrasonic echo location chip) and a Hitachi compass module(magnetometer chip). It takes samples from these chips for distance and direction. After each read from these sensors, the data is sent over the serial connection to the second Arduino, the motor control board.

The motor control board also has an Adafruit motor shield attached, which handles all motor and servo control. This motor shield came as a kit in a static bag with some 25+ parts (chips, resistors, capacitors, PCB, etc). I was happy to have successfully soldered the whole together, being that this was my first major small electronics soldering project. The motor shield is supplied an external 9.6 vdc Ni-MH supply that is used for motors control only, servos are still driven off the main onboard 9 vdc supply.The motor control board is also the main Arduino holding all the control logic which drives user switch input, sensor servo, speed and steering decision control.

The Almost Finished Robot!

botZero-imageAHere is bot[Zero], as it is right now … more mechanics refactoring is left for the near future, as I plan to install a front wheel encoder. I want to use this to measure distance traveled and experiment with dynamically constructing a presence map for navigational control. By that I mean, collect historical obstacle distance and heading samples and adjust those values over time based on position changes calculated from wheel encoder data.

Parts assembled on this robot:

2x Arduino Duemilanove
1x Adafruit Motorshield Kit
1x PING))) Ultrasonic Sensor
1x Hitachi HM55B Compass Module
1x Green LED
1x Mini single pole toggle switch (3-5A)
2x Small hobby servos (salvaged from my crap helicoptor)
1x Tamiya Double Gearbox Kit (70168)
2x Tamiya Narrow Tire Set 70145 (4 tires total)
1x Custom build steering fork assembly (found junk furniture caster and scrap aluminum)
1x 4" x 8" Thin sheet aluminum
1x PCB board (radio shack)
2x 9-volt battery holders
1x 9.6 volt NiMH rechargeable battery pack (purchased at local hobby shop)
1x Plastic Box (TB-3)

Complete source available here.

No comments: