loading
Picture of Make A Robot Ant
Build a robot ant that can be remote controlled or operate autonomously. Using an infrared detector, it can find and pick up objects. It is controlled by a Picaxe 20x-2 microcontroller.

While this is a fairly intricate robot, some of the motor techniques and circuits can be used for other simpler robots.

This instructable shows how to:

1-Use a Picaxe controller to receive remote control signals from a standard universal TV remote.

2-Use a Picaxe controller to interface with an infrared distance sensor.

3-Send serial commands to a serial motor controller or serial servo controller.

4-Make a simple one servo robot gripper.



The video shows the robot using infrared to locate and pick up a wooden block. It also shows that like most ants, the robot ant has a certain disdain for its puny human masters.

18+


 
Remove these adsRemove these ads by Signing Up

Step 1: How It Works

Picture of How It Works
antbottom.jpg
A Picaxe 20x-2 microcontroller controls an infrared distance sensor to locate and pick up objects. It uses serial commands to control a motor controller which operates the two gear motors that move the tank treads to propel the robot.

It also uses serial commands to control a servo controller which positions the three servos which operate the body, head and gripper movements.

It can be controlled by a standard TV remote control or it can operate autonomously.

The robot ant uses modular construction. Each circuit is a module that plugs into .1" header sockets. This makes it easy to test each circuit on a breadboard before it is installed. It also makes the modules available for the next robot or other project.

For details on making these modules see: http://www.instructables.com/id/Picaxe-Projects-1-Making-Fast-Printed-Circuit-Mo/

The robot ant is about 12 inches long and was made intentionally larger than necessary to allow room for more circuits. I intend to use it as a test platform for skin sensors and antenna sensors that I am working on.



Step 2: Parts and Pieces

Picture of Parts and Pieces
Parts from Sparkfun: http://www.sparkfun.com/index
PICAXE 20X2 Microcontroller
http://www.sparkfun.com/products/9432

Polymer Lithium charger
http://www.sparkfun.com/products/8293

2- 3.7v. Polymer Lithium Ion Battery - 110mAh
http://www.sparkfun.com/products/731

2-3.7v. Polymer Lithium Ion Battery - 1000mAh
http://www.sparkfun.com/products/339

These LiPo batteries are great in that they are lightweight with a low profile and do not lose their charge quickly when not in use, like regular Lithium batteries do. They also have a built in circuit that protects against shorts and over-discharge.


Parts from Polulu:
Pololu Micro Dual Serial Motor Controller- This very small motor controller is no longer available, but could be replaced with this: Pololu Qik 2s9v1 Dual Serial Motor Controller-http://www.pololu.com/catalog/product/1110

Pololu Micro Serial Servo Controller (partial kit)-http://www.pololu.com/catalog/product/208

Pololu Step-Down Voltage Regulator D15V35F5S3

Sharp GP2Y0A21YK0F Analog Distance Sensor
http://www.pololu.com/catalog/product/136

Parts from Tower Hobbies:
3- Futaba S3114 Micro High-Torque Servos
http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXNCV6&P=ML
These are very small and powerful servos for their weight.

Gearmotors and tank treads from Solarbotics:
Gear Motor and Tread Package-http://www.solarbotics.com/products/gmtpkg/

Panasonic PNA4602M IR Receiver Module from:
http://www.hobbyengineering.com/H1527.html

Parts from Mouser.com:
Various capacitors, resistors, and LEDs

SOLDERABLE PERF BOARD, LINE PATTERN-Used for making modules and the robot motherboard:
http://www.allelectronics.com/make-a-store/item/ECS-4/SOLDERABLE-PERF-BOARD-LINE-PATTERN//1.html

Step 2 pic shows the three polycarbonate domes that protect the abdomen, thorax, and head of the robot ant. They were hack sawed and then power disk sanded to shape. They were made from parts from a snow globe making kit that is no longer available. Something similar could be made using parts of plastic wine glasses. Or, a more flexible opaque shell could be made from Oogoo: http://www.instructables.com/id/How-To-Make-Your-Own-Sugru-Substitute/


Step 3: Make a Robot Gripper

Picture of Make a Robot Gripper
gripperbot.jpg
How It Works
The ant mandible is a very simple gripper that works by being held closed by a spring. A cam on the bottom side is rotated by a servo to open it up. So, when the open gripper is closed it will grasp with the force of the spring and hold tightly on objects of various diameters. The two sides of the gripper are fairly smooth and they pull the object being gripped toward a rubber friction bumper that keeps the object from sliding down as it is being lifted.

This design allows the servo to swing freely all the way counterclockwise or clockwise and no pressure sensors or stop switches are needed to grasp an object.

The ant gripper fingers and body were made using copper clad FRS circuit board material. The Pivot bearings are just 4-40 bolts through drilled holes in the circuit board.

The step3 pics show the top and bottom of the gripper.


Step 4: Picaxe 20x-2 Microcontroller

Picture of Picaxe 20x-2 Microcontroller
20x2a.jpg
20x2b.jpg
The Picaxe microcontrollers are, in my opinion, highly underrated. They have a very small form factor that requires a minimum of external parts. They are inexpensive and very easy to program in the intuitively obvious BASIC programming language. In short, they are the easiest microcontrollers to learn how to hookup and program.

The Picaxe 20x-2 is my favorite microcontroller. It has plenty of inputs and outputs and many ADC inputs. It can operate as high as 64 MH. It also does not require more than 1 resistor (to keep Serin from floating) to create a stand alone module.

Controlling The Robot Ant
The Picaxe sends serial commands to the motor controller and servo controller. They continue to maintain the last command received. This allows the Picaxe to spend its time scanning its sensors to determine the next response.

Room For Expansion
In this application only about 1/3 of the programming space was used up. Less than 1/3 of the inputs and output pins were used leaving plenty of room for more sensors or actuators.

For details on making fast Picaxe modules using perfboard, see:
http://www.instructables.com/id/Picaxe-Projects-1-Making-Fast-Printed-Circuit-Mo/

For a very small micro robot controlled by a Picaxe see:
http://www.instructables.com/id/Building-Small-Robots-Making-One-Cubic-Inch-Micro/

For an even smaller robot controlled by a Picaxe see:
http://www.instructables.com/id/Build-a-Very-Small-Robot-Make-The-Worlds-Smalles/

Step 4 thumbnail pics show the top and bottom of the Picaxe module.


Step 5: Serial Motor Controller

Picture of Serial Motor Controller
drivemotors.jpg
The Polulu motor controller receives serial commands from the Picaxe Controller to control the two gear motors that move the tank treads. Once a serial command is sent to activate a motor the motor moves as directed until a new command is sent by the Picaxe. This allows the Picaxe microcontroller to send commands and then go back to sensor detection. The motors can be controlled for speed and direction.

The tank treads come in a kit and can be configured like a regular tank or in the three wheel version as I did. To do this I had to buy two extra idler wheels. The drive wheel and idler wheels were mounted on standard copper clad FRS fiberglass circuit board that was painted.


Step 6: Infrared Distance Sensor

Picture of Infrared Distance Sensor
I have experimented with several ultrasonic sensors and while they are good for detecting larger objects like walls or people, they send out a relatively wide beam which does not have the precision necessary to line up a gripper to a small object.

The Sharp infrared distance sensor sends an invisible infrared beam and then measures the angle of reflected light to detect an objects presence and its distance. It is quite precise and sensitive and can detect a vertical pencil a foot away. It can detect an object or wall anywhere from 4 to 32 inches.

It measures the distance to the object and then outputs a voltage that is proportional to the distance. This is fed to an input of the Picaxe controller and its ADC (analog to digital converter) is used to convert the voltage to a number which the program interprets to tell the robot how far away the object is.

The step 6 pic shows the sharp sensor which is the black rectangle with two lenses.


Step 7: Robot Ant Schematic

Picture of Robot Ant Schematic
antschematic3.jpg
antschematic4.jpg

Here is the robot ant schematic. The thumbnail pics show it enlarged.

Things to consider when interfacing the different modules:

It is usually a good idea to keep separate power supplies for the control circuits and the motors. The motors and servos can be electrically noisy and this can disrupt a microcontroller. It is also a good idea to keep microcontrollers a good distance from motors and servos so they are not effected by magnetic fields.
While it is not necessary to have a voltage controller for the motors, it gives more consistent movement if the voltage stays constant

Keep a 270 ohm to 1kohm resistor between any sensor outputs and the Picaxe inputs to avoid accidental shorting of either device.

The Sharp infrared distance sensor turned out to be extremely electrically noisy. When I hooked up on a breadboard to the Picaxe, it worked fine. As soon as it was installed in the robot the Picaxe stopped working. I solved the problem by putting a 10uf capacitor across the power inputs of the Sharp sensor. This reduced the voltage fluctuations to the power supply that it was creating.



Step 8: Programming The Robot Ant

Picture of Programming The Robot Ant
How It Works
In autonomous pickup mode the robot rotates to the right looking for an object. If it finds nothing it will stop after rotating 360 degrees. When an object is detected it stops and corrects for over steering and using the measured distance for the detected object, moves forward a specific distance. It then closes the gripper and lifts.

Remote Control
In remote control mode the robot waits for a signal either for a movement such as forward or for a command into autonomous mode. A standard universal TV remote can be configured to output Sony TV code which the Picaxe can decode. The infrared from the remote control is received by the Panasonic receiver module.

Here is the programming code for the robot ant:

'robot ant, Picaxe 20x-2
let dirsc =%00000000
setfreq m8
pause 2000

'loop22: 'test of infrared distance sensor
'readadc 7,b4
'debug b4
'goto loop22

startreset: 'reset for start
serout c.0,t2400,($80,$01,$01,2,30)'set4 for servo#,speed set5 from 0to127
serout c.0,t2400,($80,$01,$04,2,26,30) 'body down 26
pause 200
serout c.0,t2400,($80,$01,$01,1,30) 'speed set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,1,26,127) 'close gripper 26
pause 200
serout c.0,t2400,($80,$01,$01,0,20) 'speed set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,0,26,127) 'head center
pause 1000

loopinfra: 'remote control of motions or activate autonomous sequences
low c.1 'blue eye
high c.2 'blue eye
irin c.5, b6
if b6 = 0 then act1 'remote button1 =0
if b6 = 1 then forw 'b2
if b6 = 2 then act2 'b3
if b6 = 3 then left 'b4
if b6 = 4 then stop1 'b5
if b6 = 5 then right 'b6
if b6 = 6 then act3 'b7
if b6 = 7 then rev1 'b8
if b6 = 8 then biteme 'attack
' if b6 = 59 then biteme 'attack
if b6 = 11 then putdwn 'enter put down
if b6 = 21 then startreset 'reset servos
'debug b6
goto loopinfra

act1: 'robot ant moons the world
gosub forw2
pause 2500
gosub bodyup2
gosub left2
gosub headleft2
pause 300
gosub forw2
pause 1200
gosub stop2
gosub forw2
pause 500
gosub stop2
gosub headright2
high c.1 'red eye l
low c.2 'red eye r
pause 1000
gosub right2
pause 2500
gosub headcenter2
gosub bodydwn2
gosub rev2
pause 2500
gosub stop2
gosub leftfast
pause 500
gosub stop2
gosub rightfast
pause 500
gosub leftfast
pause 500
gosub stop2
gosub rightfast
pause 500
gosub stop2
pause 2200
gosub forw2
gosub bodyup2
pause 3500
gosub opengrip2
pause 500
gosub stop2
goto loopinfra


biteme:
gosub forw2
b8=1
for b8=1 to 175
'find obstacle
high c.2 'red eye l
low c.1 'red eye r
readadc 7,b4
if b4 > 60 and b4 < 135 then next3
pause 30
next b8
goto loopinfra

next3:
gosub stop2
gosub bodydwn2
gosub opengrip2
'pause 100
gosub bodyup2
gosub forw2
pause 300
gosub closegrip2
pause 900
gosub stop2
gosub rev2
gosub bodydwn2
pause 6000
gosub stop2
goto loopinfra


act2: 'Pickup,putdown
'forward
serout c.0,t2400,(128,0,1,100) 'forward right 20min to 127
serout c.0,t2400,(128,0,2,100) 'forward left 20min
pause 4500
gosub stop2
pause 100

'find block
b8=1
for b8=1 to 75

'find block and pickup
high c.2
low c.1
gosub right2

readadc 7,b4
if b4 > 61 and b4 < 164 then detect0 '34-75

pause 50
next b8
gosub stop2
goto loopinfra

detect0: 'stop and correct
gosub stop2
'turn left slow
serout c.0,t2400,(128,0,1,60) 'forward right 20min to 127
serout c.0,t2400,(128,0,3,60) 'rev left 20min
pause 240
gosub stop2
pause 100
low c.2 'red eye
high c.1 'red eye

'forward, pickup
gosub opengrip2
pause 1000
gosub forw2
if b4 < 50 then pa1
if b4 < 60 then pa2
if b4 < 70 then pa3
if b4 < 80 then pa4
if b4 < 90 then pa5
if b4 < 104 then pa6
pa1:
pause 9000
goto stopat

pa2:
pause 5920
goto stopat

pa3:
pause 3800
goto stopat

pa4:
pause 2800
goto stopat

pa5:
pause 2100
goto stopat

pa6:
pause 980
goto stopat

stopat:
gosub stop2
pause 200

'closegrip
serout c.0,t2400,($80,$01,$01,1,30) 'speed-set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,1,26,127) 'close gripper 26
pause 2000
gosub bodyup2

'putdown
gosub leftfast
pause 1400
gosub stop2
gosub forw2
pause 1800
gosub stop2
gosub bodydwn2
gosub opengrip2
pause 500

'gloat
gosub rev2
pause 2000
gosub stop2
gosub bodyup2
gosub headleft2
gosub headright2
gosub headcenter2
low c.1 'blue eye
high c.2 'blue eye
goto loopinfra

act3: 'open gripper and forward
'forward, pickup
gosub opengrip2
pause 400
gosub forw2
pause 280
gosub stop2
goto loopinfra

act4: 'close gripper and lift
gosub closegrip2
pause 600
gosub bodyup2

goto loopinfra


' '*** gosubs

leftslow:
'turn left slow
serout c.0,t2400,(128,0,1,60) 'forward right 20min to 127
serout c.0,t2400,(128,0,3,60) 'rev left 20min
pause 220
gosub stop2
return

stop2:
serout c.0,t2400,(128,0,0,0) 'hard stop right
serout c.0,t2400,(128,0,6,0) 'hard stop left
return

forw2:
serout c.0,t2400,(128,0,1,100) 'forward right 20min to 127
serout c.0,t2400,(128,0,2,100) 'forward left 20min
return

left2:
serout c.0,t2400,(128,0,1,100) 'forward right 20min
serout c.0,t2400,(128,0,3,100) 'rev left 20min
return

right2:
serout c.0,t2400,(128,0,2,100) 'forward left 20min
serout c.0,t2400,(128,0,0,100) 'rev right 20min
return

rev2:
'stop
serout c.0,t2400,(128,0,0,0) 'hard stop right
serout c.0,t2400,(128,0,6,0) 'hard stop left
pause 50
'reverse
serout c.0,t2400,(128,0,0,100) 'rev right 20min
serout c.0,t2400,(128,0,3,100) 'rev left 20min
return

opengrip2:
serout c.0,t2400,($80,$01,$01,1,30)'set4 for servo#,speed set5 from 0to127
serout c.0,t2400,($80,$01,$04,1,13,127) 'open gripper,13
pause 1000
return

closegrip2:
serout c.0,t2400,($80,$01,$01,1,30) 'speed set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,1,26,127) 'close gripper 26
pause 2000
return

headleft2:
serout c.0,t2400,($80,$01,$01,0,20)'set4 for servo#,speed set5 from 0to127
serout c.0,t2400,($80,$01,$04,0,15,127) 'head left 15
pause 800
return

headright2:
'serout c.0,t2400,($80,$01,$01,0,20) 'speed set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,0,32,127) 'head right 30
pause 1600
return

headcenter2:
serout c.0,t2400,($80,$01,$01,0,20) 'speed set last # from 0 to 127
serout c.0,t2400,($80,$01,$04,0,26,127) 'head center
pause 500
return

bodyup2:
serout c.0,t2400,($80,$01,$01,2,30)'set4 for servo#,speed set5 from 0to127
serout c.0,t2400,($80,$01,$04,2,13,30) 'body up,13
pause 220
return

bodydwn2:
serout c.0,t2400,($80,$01,$01,2,30)'set4 for servo#,speed set5 from 0to127
serout c.0,t2400,($80,$01,$04,2,26,30) 'body down 26
pause 200
return

leftfast:
serout c.0,t2400,(128,0,1,127) 'forward right 20min
serout c.0,t2400,(128,0,3,127) 'rev left 20min
return

rightfast:
serout c.0,t2400,(128,0,2,127) 'forward left 20min
serout c.0,t2400,(128,0,0,127) 'rev right 20min
return


Step 9: Other Possibilities

Picture of Other Possibilities
Smaller Circuits
A surface mount version of the Picaxe 20x-2 is available to make even smaller microcontroller modules. For details on easily soldering surface mount components see here:
http://www.instructables.com/id/Advanced-Soldering-Fast-and-Easy-Soldering-of-Sur/

Remote Control Ring
The robot ant can be controlled by other Picaxe controllers configured to output infrared Sony signals. For details on how to make a remote control ring that can control the robot, see here: http://www.instructables.com/id/Make-A-Remote-Control-Ring/

Robot Neurons
A biological ant has between 200 to 3000 neurons working in parallel to control its movements. If we consider a microcontroller to be a very crude neuron, the robot ant has the equivelent of 4 neurons. The Picaxe, servo controller, motor controller, and infrared sensor each have a microcontroller as part of the module. Many more microcontrollers than this will be needed to achieve the incredible parallel processing of even simple biological systems.

Ant Hairs
Biological ants have hundreds of fine hairs and each one is a touch sensitive sensor. The main problem with robots today is not a lack of processing power , but the lack of sensitive sensors in large quantities. Many more sensors will be necessary to make this robot ant come closer to the incredibly fine manipulations of a real ant.

Laser Cutter and Smaller Robots
A laser cutter could be used to make some precision parts to make a micro 3d printer. The printer would then be used to make even smaller parts for a microscopic robot. The microscopic robot could then be used to manipulate objects on the scale of molecules.



es increible

Wow! I could use this, only a bit bigger, and taller, or something in an robot arm, to get my bottles out of the fridge! Nice work!
Thanks for replying early. Perhaps for the gear problems you could use piezoelectric materials. I don't know much about them, but they are smaller.
Wow, for $39 this is an awsome build. I would like to see someone miniaturize it, as i have almost no skills is robotics building. keep up the good work! 5*
It's actually $300. $39 is for the treads.
mman15064 years ago
cool robot really like the tank treads but the price is kinda steep at 39$
What!? It's more like $300.
swilus mman15064 years ago
Seriously? You can spend $39.00 on a movie and snacks for 2-3 people!
D5quar3 swilus4 years ago
Ive spent 200 dollars now for my robot and it is still not working I wish I could take it all back and spend 39 dollars for a robot that does more than mine.
mikey77 (author)  D5quar34 years ago
Sorry, the 39 dollars was just for the tank treads and two drive motors. The robot ant parts cost about $300 in total.

Don't give up on yours. Most of my robots do not work well for long periods of time until I slowly find all the bugs and eliminate them.
I think people read my comment wrong i was just thinking of a cheaper method for the tank treads like the tamiya gearbox. I personnaly use use the picaxe all the time
It might have been easier to read if you used punctuation.
D5quar3 mikey774 years ago
I have heard the dont give up on it a lot of times before, and I will not until I at least get this one done and then get more complex

thx for the encouragement
Kolf35 swilus4 years ago
u kidding?im goin on a date soon and im gonna haf to pay 50 bucks nearly!!!!!!!!!
mman1506 Kolf354 years ago
Read the whole thread the total robot costs 300$. The tank treads cost 40$.
pbecker834 years ago
Agreed. We are using this chip for a low cost robot kit for our robotics club here in Nashville. Great projects!
Kolf354 years ago
the vidyo was amazing!!!!!!!!
raykholo4 years ago
Your instructables keep getting better and better. Keep up the awesome work!
how do i fave this thing???!?!!? i love it!!!
ynze4 years ago
Great!
ChrysN4 years ago
Awesome!
sweet!!!!!!!!
Dr. Pepper4 years ago
Amazing!