Friday, July 6, 2012

The Arduino Mothbot

The Arduino Mothbot
  • IMG_2693.JPG
  • IMG_2695.JPG
The Arduino Mothbot
The purpose of this project is to design and build a simple light-following robot using an Arduino Duemilanove microcontroller board. I really wanted to share a robot project that was cheap, simple to build, and had a complete set of instructions for all of the different steps. I hope I've succeeded and I'd love to get comments about making this instructable even better.

The design of this robot focused around using the book "Getting Started with Arduino" by Massimo Banzi and published with [ Make]. I also employed code for running the servos from a project titled: How to Make an Arduino Controlled Servo Robot (SERB).

The Arduino Mothbot is in total a pretty quick robot to build. Assuming you start with all of the parts and don't have to improvise, the project in total should take maybe an hour to build. That is if you follow the instructions and copy the code. However, if you build only one feature at a time and test along the way then this project could take significantly longer. The advantage of the longer track is that you'll probably learn a lot more and have some fun along the way.

Step 1Gather your Parts and Tools

Building this robot is going to cost you roughly $80 in parts if you've never done anything like this before. The cost for me was significantly less since I've got a lot of electronics lying around to work from. However, I know how frustrating it can be to try and follow an instructable without knowing which parts to get, where to order from, and how much everything will cost up front so I've done all that work for you. Once you've got the parts all squared away it should be a snap to do this project. Follow the following link to my project wiki to get a complete parts list.

Arduino Mothbot Parts List

Now you may want to get some tools. Since this project employs a solderless breadboard you can do without a lot of fancy electronics equipment. Hopefully you can find the rest of the things you need in a garage:

1. Needle nose pliers
2. Wire Cutters
3. Flat head screw driver
4. Small Phillips (4-sided) screw driver
5. Adjustable wrench or 11/32" hex wrench
6. Drill
7. 1/16", 5/32" and 7/32" drill bits
8. Saw (optional)
9. Safety Goggles

Please use safe practices when using any power tools.

Step 2The Planning Stage

iThe Planning Stage
  • IMG_2696.JPG
  • IMG_2694.JPG
Before I started this project I looked around Instructables at a lot of other projects. I also spent some time reading the book "Getting Started with Arduino" by Massimo Banzi. Nearly everything in this project is done from an example on this website or in the book. I designed the project this way in an attempt to make it accessible to the novice roboticist.

In my planning phase I did not only looked at hardware and coding but did my electronics homework as well. I wanted to draw up a simple electronics schematic for this project so I could follow what was going on as I built it. You can see in the picture the different components, power lines, and the Arduino pins. Hopefully it's a clear diagram and also illustrates how simple the electronics for this project is.

Step 3Connecting the Servos to the Arduino

iConnecting the Servos to the Arduino
  • IMG_2750.JPG
  • IMG_2755.JPG
  • IMG_2754.JPG
  • IMG_2753.JPG
  • IMG_2752.JPG
  • IMG_2751.JPG
If you're going to build a robot the first thing you probably want to work out is how to get it moving around. Most likely you want to be able to send it forward, backward, right, left and make it stop. If you can't figure out how to command it to move properly you're not likely to be able to make it do anything when you connect all the sensors. Below are the steps to connect the motor to the Arduino.

1. The first thing to do when setting up the solderless breadboard is to set up the ground (GND) and power (+6V) for the servos. I chose to use the two long strips on the board that would be closest to the Arduino.

2. Once the ground and power lines are identified connect the ground of the Arduino board to the ground strip on the solderless breadboard. Do not connect the power to the solderless breadboard yet.

3. Each servo has three wires that come out of them. Mine have a black, red, and white wire for each. The black is for ground, the red is for power, and the white is the control wire. Cut three jumper wires for each servo of the same size (so 6 in total).

4. Attach the jumper wires to the end of the servo wires and then each servo to the solderless breadboard.

5. Now use jumpers to connect the ground and power from each servo to the ground and power of the solderless breadboard.

6. Now connect the control wires from each servo to the Arduino. Connect the left servo to digital output (PWM) 3 and the right servo to digital output (PWM) 11.

7. Finally, connect the ground and power from the 4AA batteries to the solderless breadboard ground and power. Don't be alarmed if the servos start moving when your Arduino has no power or is not yet programed.

8. Using the code you should now be able to run the motors in the forward, backward, left or right directions using the included functions.

Step 4Testing out the Motors

I think it's important to include some of the test code I used when putting together the Arduino Mothbot. If you're interested and willing to put in the time to tinker around I think you'll find these code snippets educational and useful in other projects.

Before I post any code below I want to make it known that the following is based on another great project called How to Make an Arduino Controlled Servo Robot (SERB). I learned a lot from following the work on that instructable and want to give credit where it is due.

Step 5Integrating the On/Off Button

iIntegrating the On/Off Button
  • IMG_2743.JPG
  • IMG_2749.JPG
  • IMG_2748.JPG
  • IMG_2747.JPG
  • IMG_2746.JPG
  • IMG_2745.JPG
  • IMG_2744.JPG
Now you may be wanting to turn your robot on and off with the push of a button. The Arduino itself will run code in an endless loop until you unplug it, which can be quite frustrating when you plug in your robot on the table and it starts running away from you! Integrating the button is a great step in this process because you'll also learn how to use buttons for other things, like creating a bumper to detect when the robot hits a wall.

As a note, you'll notice I removed the servos from the solderless breadboard for most of my pictures. This just helps make the image more clear when I'm showing different steps.

1. To begin, disconnect power from the servo motors before doing any more work. Remember to do this every time you add something to this project.

2. Now you may want to be able to turn your robot on and off as opposed to having the robot immediately start moving when you connect the power.

3. Identify a strip on the opposite side of the solderless breadboard to be power for on/off button (and later the sensors).

4. Using a long jumper wire connect the power (+5V) from the Arduino to the strip you just identified.

5. Connect two jumper wires to the momentary switch and plug one end into the (+5V) power

6. Plug the other end of the momentary switch into a smaller strip in the middle of the solderless breadboard.

7. From that same strip connect a 10K ohm resistor to the strip and the other end into ground

8. Finally, connect a wire from the strip with the switch and the resistor on one end and place the other end in digital input 7 on the Arduino.

9. Now, with the code you should be able to use the button to turn on and off the robot. If you use the code with the LED (digital output 13) you will see the on-board LED turn on and off with the robot. This is a great way to test the Arduino code if you have the power to the motors disconnected.

Step 6Testing the On/Off Button

This new code includes the information for using the On/Off button and making the onboard LED blink.

Step 7Integrating the Light Sensors

iIntegrating the Light Sensors
  • IMG_2738.JPG
  • IMG_2742.JPG
  • IMG_2741.JPG
  • IMG_2740.JPG
  • IMG_2739.JPG
What would an Arduino Mothbot be if it didn't have light sensors? The point of this simple project is to make a robot that is attracted to the brightest light. For this we'll need to integrate some light sensors, also known as photo-resistors.

1. Again, disconnect the power from the servo motors before doing this step

2. The setup for the light sensors will be done twice. It is almost the exact same setup as the momentary switch. Actually, it is the same setup, but this time you will use the light sensor (photo-resistor) instead of a momentary switch.

3. Because this robot will use the two light sensors to pick a direction to drive it is recommended that you set up each light sensor on opposite sides of the solderless breadboard or as far apart as possible.

4. Connect one end of a light sensor to the (+5V) power line and the other end into a small strip in the center of the board.

5. Connect a 10k ohm resistor to that same strip and the other end to ground

6. Now connect a jumper wire from the small strip (where the photo resistor and regular resistor are connected) and plug the other end into an analog input.

7. Connect the left sensor to analog input 0 on the Arduino and the right sensor to analog input 1.

8. You should now be able to use the light sensors to move the servos.

Step 8The Final Code

iThe Final Code
  • IMG_2685.JPG
  • IMG_2686.JPG
Here is the final code used to run the Arduino Mothbot. In the code I've included print statements to the Arduino serial port. If you have the Arduino connected through the USB port of your computer you should be able to see the print statements that tell you which way the robot is planning to go. You may want to adjust the light sensor threshold value to fine tune the behavior of the robot. The threshold depends mainly on your sensors and the ambient light of the location you are in.

Step 9Build the Mothbot Body

iBuild the Mothbot Body
  • IMG_2687.JPG
  • IMG_2688.JPG
  • IMG_2689.JPG
The robot you're building is really no good unless it can hold itself together. For this reason it needs a body. I tried my best to make this as simple a construction project as possible. You are, however, going to have to do a little work on your own to figure out the right measurements. I suggest the age old "measure twice, cut once" method.

1. The body of the robot is made out of a small sheet of poplar wood I bought at the hardware store precut to 6" x 24". I cut mine down to 6" x 8" using the saw provided in the hardware store.

2. Next I drilled holes towards the front of the board to attach the servo brackets for each servo. For this I used an 5/32" size drill bit.

3. I also drilled in a hole at the rear of the board for the caster wheel that balances the robot. For this I used an 7/32" size drill bit. I chose to use a slightly smaller drill bit so I could get a tight friction fit with my caster wheel since I wasn't using a nut and bolt combination to attach it.

4. Then I attached the brackets to the board with the nuts and bolts. This was done using the flat head screw driver and the adjustable wrench.

5. After attaching the brackets I attached each servo to the brackets with the nuts and bolts.

6. Finally, I pushed the caster wheel into the whole.

Step 10Making the Wheels

iMaking the Wheels
  • IMG_2691.JPG
  • IMG_2690.JPG
The wheels were a tricky problem for me. I had actually bot some certified robot wheels but realized they were a) too heavy and b) I had no way to attach them to my chosen servos. That's when I remembered using jar lids in high school for a similar project. So it was off to the store in search of a suitable robot wheel alternative.

Each wheel is made from the lid from a Ziploc Twist 'n Loc container. Other good lids are those on peanut butter jars or other food goods. I don't advocate wasting food but save up your lids and you might find one is the right size for your robot project. I used the leftover containers to hold parts I've collected.

1. The first thing I did was pick the servo horn I wanted for the wheels. I picked the ones that had four horns and that were included with my servos when I bought them.

2. Before you do anything, drill a hole in the center of the wheel. I recommend doing this with your 5/32" drill bit. You'll need this so you can get to the screw that connects the horn to the servo.

4. Now screw the lid to the horn. I used four included screws with each servo to connect the lids to the horns. It might be easier if you pre-drill tiny holes through the lid like I did. I used a 1/16" drill bit for this. But be careful, drilling through this plastic with a heavy drill and a tiny bit can be difficult.

5. Now connect the horns to the servos using the small Phillips (4-sided) screw driver.

6. Finally, wrap rubber bands around each wheel to give you more traction. I got my rubber bands from produce I bought at the grocery store. Hopefully you have a few lying around.

7. At this point the entire body and wheels should be assembled.

Step 11Completing the Arduino Mothbot

iCompleting the Arduino Mothbot
With the body and wheels assembled it's easy to place the Arduino and solderless breadboard just atop the robot body. Make sure you can still reach the USB input on the Arduino in case you need to change the programming. I used some black electrical tape underneath each to stick them to the body. Electrical tape is easy to remove and holds quite well.

1. Tape the Arduino and solderless breadboard to the top of the robot body that you've built.

2. Using tape again it's a good idea to connect the 4AA battery holder and the 9V battery to the body. Make sure the wires reach.

3. Connect the servo wires to the solderless breadboard if you had removed them previously.

4. Connect the Arduino power

5. Connect the servo motor power

6. Now place your robot on the ground and press the on/off switch! It should now come to life and chase the light around the room:)

As a future add-on project I would include a simple bumper or wall sensor. This would be a switch, much like the On/Off button used in this project. However, when the button was pushed it would tell the robot to reverse direction, turn left or right, and continue with the program. Once that is completed this robot would be a great little testing platform for other sensors and devices.

Tuesday, July 3, 2012

The Online Guru: All-in-one Online Marketing Software!

Why Pay Others When You Can Do It Yourself? All-in-one Online Marketing Software Promotes Your Website For You All Over The Web!
Get Your Own Professional Website
FREE Domain Name for 1 Year
Professional Custom Website Design
Up to 5 Pages
Max 3 Graphic Artworks
1 Online Form That Allows Customers to Contact You


How to Make a Static Electricity Generator - Shock Anything & Fry Electronics with a Touch!

video How to Make a Static Electricity Generator - Shock Anything & Fry Electronics with a Touch!
In this video I show how to make a device that allows the user to gain the power of electricity. This high voltage generator can electrify a persons entire body with a static charge more powerful than rubbing even the softest footie pajamas on a carpet could ever muster. The electrical buildup can then be discharged with a touch to shock anything in reach.

Parts that may need to be ordered online:
Negative Ion Generator (Ionizer) (I bought mine here: Search for SW-750)

Automotive Power Converter (Cheapest here: Or find one at an auto parts store)

Parts that can be purchased in a hardware or electronics store (Such as Radio Shack):
Flux Core Solder
2" of Copper Wire
Heat Shrink Insulating Tubing (Optional)
9 Volt Battery (DO NOT USE A LARGER POWER SOURCE! Doing so may be DANGEROUS!)
9 Volt Battery Harness
On/Off Switch (Any type will work, even a light switch if that is all that is available)
Sticky Back Velcro
Dual Sided Velcro (Usually found in the form of cable ties)
Glasses Case
1 Gallon Bottle (Such as a windshield washer fluid bottle)
Hot Glue
Aluminum Soda Can
Duct or Electrical Tape

Soldering Iron
Wire Strippers
Hot Glue Gun
Sand Paper
Drill & Bits
File (Optional)

I was inspired to create this video when I read the article posted here:
That article is based off of the information provided in this even older article:

Both of the above use a design that contains the generator within a pair of shoes, but I decided that it would be better modified into something that could easily be strapped on and off over anything the user happens to be wearing. The design used in the article also has a nasty habit of shocking the bottom of your foot quite frequently.

Monday, July 2, 2012

How To Create Iphone Apps With No Programming Experience !!

Discover How To Create Iphone Apps Easily With No Programming Experienced Required. Learn From Some Of The Top Iphone App Developers To Get Your App Created Now.

Iphone And Ipad Tutorials And Starter Kits

Professional Tutorials And Starter Kits To Help Iphone/ipad Developers Make Their Own Apps And Games. Includes Space Game Starter Kit - Full Source Code And Tutorials That Show You How To Create A Cool Space Shooter Game From Scratch!

How To Convert Fluorescent starter to Thermal Switch

How To Convert Fluorescent starter to Thermal Switch
  • DSC01417.JPG
  • DSC01418.JPG
  • DSC01419.JPG
  • DSC01412.JPG
  • Thermal.png
  • DSC01425.JPG
  • Circuit.png

Fluorescent starter is essentially two bimetallic strips in a sealed glass capsule, with a small gap between them.

The principle of this experiment is Metal expansion and contraction .

1-  12 volt CPU Fan.
2-  12 Volt supply.
3-   Fluorescent starter.
4- Candle.

1- Break the starter glass and try to not damage the metal inside (Take all safety precaution when you do that to avoid any injury).
2- Make sure that there is a small gap between two metal as shown in attached picture.
3- Connect the circuit as attached in the first circuit diagram and fix the starter about 2 cm above the candle.

When the candle lighted up ,the starter metal  will expand and attached together , the fan will turn on  and turn off the candle ,the two metal will de-attach and turn off the fan.

Note that CPU fan is a brush less dc motor and it will not cause spark in starting ,the spark can damage the metal and it will not work for long time ,so if you connect a load that take more current  and cause a spark in the starter you can use transistor showed in the last diagram to avoid this issue .

if you find this tutorial useful to you , please vote for it in the Electronics Tips & Tricks contest.

Fastest way to Hack RC Car H-Bridge

Fastest way to Hack RC Car H-Bridge
  • RX-2.JPG
  • RX-2.png
  • RX2 2.JPG
I have some broken small RC car without remote control and I was interesting to hack the H-bridge of these car and connect them to micro controller circuit  in order to make for example a line follower robot or obstacle avoidance robot.

The common circuit of RC car consist of :
1-Receiver circuit which is define the frequency that the car will work on( for example 40Mhz or 27 Mhz).
2-Controller chip (De-Multiplexer circuit).
3-Dual H-bridge circuit for driving two DC motor (one for backward ,forward and the other for the steering).

you can see that from the above picture,  it's a little complicated to find the base of transistors that will make the motor  work ,also it will take  a lot of time, so instead of that I download datasheet of the controller and from chip pins diagram we can trace the H-bridge pins directly.

RX-2 Controller Chip:
RX-2 is a five function receiver chip work as a De-multiplexer and the multiplexer of this chip called TX-2 which is located in the remote control of  the RC car .it's a very interesting IC and compatible with RF and infrared (check attached datasheet ).

Now from the pin  diagram shown in the next picture  you can locate the pins of H-Bride  (PIN 6 ,7 for right and left ) and (PIN 10,11 for backward and forward).
By connecting +5 volt to these pins you will be able to control the motors but be careful don't connect 5 volt to right and left or backward and forward on the same time ,you might burn your circuit (depend on circuit design) .

Now you can remove RX-2 chip and connect the H-bridge pins to a micro controller  but it's better to connect a 330 ohm resistor between them for current limitation.

if you like or find this tutorial useful to you , please vote for it in the Electronics Tips & Tricks contest.

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Grants For Single Moms