Building Andy Continued
The SainSmart Uno S is very similar to the Arduino R3 and actually includes both female and male breakout connectors. This is handy when you only have female-male jumper wires. Moving back to the left-hand side, you can see that I routed the second set of motor wires through the adjacent hole I routed the first wires through.
I found that the pins connected to the motor wires prohibit a 90-degree connection from the motor shield because they no longer reach inside the screw terminals when they are bent. If you are not worried much about aesthetics, you can skip this step and just screw them into the terminal blocks as normal. I clipped off these ends and stripped back bare wire.
To ensure a good connection, I quickly tinned the bare wire with my soldering iron and screwed them down tight into the terminal. This ensured that my connection held fast to the screw terminal and would not break away during transport or handling. I did this with both sets of motor wires.
Now it's time to include a power source to drive the motors. The simplest and cheapest way to do this is through a common 9V battery. Take your 9V battery clip and strip and tin the ends if they are not already tinned for you. Then, using a screw driver, insert the wires into the terminal blocks in the Vin (Red) and GND (Black) slots. You will notice later that I routed the 9V wires through a hole in the chassis.
Here is a nice shot of everything connected. You also get to see the Arduino Motor Shield R3 here for the first time. Note how I have everything connected as you may need to reverse one set of the motor wires later on.
Now that we have the Arduino, Motor Shield, and Motors partially wired up, it's time to move onto the ultra-sonic sensor and get it installed onto the servo. As you can see, I used my 3D printer to print a custom mounting bracket for the HC-SR04 sensor. I have uploaded the .STL file for this bracket to my Thingiverse account so you can download it for free. Here is where the male-female jumper wires come in handy. I did not have any, so I had to improvise and use male header pins to make male-female jumpers. Mounting the sensor to the bracket is as easy as sliding the round transceivers through the holes. You may need to file these holes some depending on how well calibrated your 3D printer is.
I used a little dab of hot glue on each corner to secure the sensor to the mount. Once this is completed, you can place the mount on top of the servo. Once you are sure that the mount is centered with the servo's sweep, you can screw it down. I used a dab of hot glue on the screw and mount as my servo's splines were a bit worn down. Be careful not to tighten the screw too much as it will bind the servo.
Here you can see that I again used hot glue to secure the makeshift connector to the sensor's pins. Since this is a moving piece, I highly recommend doing this. I have also hot glued the cable where it passes through the chassis leaving about two inches of slack to compensate for the movement of the ultra-sonic sensor. This helps prevent abrasion of the cable and keeps everything nice and secure.
In these two shots, you can see how much slack I left between the sensor and where I glued it down to the chassis. Moving to the back of the chassis, you see how I routed the sensor wires close to the servo wires and used the header pin method to connect the cable to the breadboard.
Now it's time to give Andy some headlights. While this is not a necessary step, I included this as a way to add in another coding lesson to the robot. Using female-male jumpers, affix 2 LEDs to the wires and route them back through the chassis.
Before gluing on the LEDs, let's affix some goofy "googly eyes" for comical effect. Just a thin dab of hot glue is needed as anymore will melt the eyes.
Once you have the eyes glued on, glue the LEDs in place as seen in the image above. I glued all the way past the connector making sure the glue encapsulated the LED leads as well as the connector. This prevents the LEDs from falling out of the connector. Remember to color code the jumper wires with the leads; make the anode the lighter color wire and the cathode the black wire.
What would a robot named Andy be without a big, toothy smile? Here I printed a mouth with teeth out on my 3D Printer. I used mounting tape that I trimmed to fit and then pressed the mouth into place.
Here is Andy with his big smile! Notice that the mouth has been placed behind the front chassis mounting screw.
Now it's time to tackle the most tedious part of the entire process. Wiring up the Arduino to the servo, ultra-sonic sensor, and LED headlights is a simple task and quite quick if you use generic jumper wires. For the purpose of this article, I chose to use hookup wire that was cut and bent to size to make everything easier to follow and as neat as possible. The first thing we need to do is drop a ground to the breadboard; as you can tell, I did just that. I extended the ground to each LED. In the image above, I did mess up and have the right resistor out of place a little. Move the ground wire over by one hole to the left and all will be fine.
In these two images, you can see that I cleverly ran the wires for the LEDs under the motor shield in an effort to keep the project neat and clean. Don't worry too much about following the wiring in the images as I will have a wiring schematic you can follow instead at the bottom of this article.
Here you can see that I have extended the ground to another row of connectors and dropped 5V down to the board.
In these two images, I have connected the servo and ultra-sonic sensor pins to the Arduino using more tight-fit custom-bent jumpers to keep things clean.
Finally, you can see where I brought the servo and sensor data lines to the other side of the Arduino using the same method I used when running the LED power lines. Below, I have included a wiring diagram to help you wire your robot exactly as I did mine. In the next installment, we will cover programming Andy using the Arduino IDE. Thanks for reading and remember to Hack The World and Make Awesome!
PRICING: You can find products similar to this one for sale below.
United States: Find other tech and computer products like this over at Amazon.com
United Kingdom: Find other tech and computer products like this over at Amazon.co.uk
Australia: Find other tech and computer products like this over at Amazon.com.au
Canada: Find other tech and computer products like this over at Amazon.ca
Deutschland: Finde andere Technik- und Computerprodukte wie dieses auf Amazon.de