That is it for the Super Simple First Robot! If you followed the steps you should be up and running.
If you want the wheels shown in the article, email me directly. I sell them for 15.00 USD per set and that includes mounting hardware, aluminum wheels and the tires.
Next week we will add another sensor and have some programming fun.
Ted
Sunday, February 8, 2009
Super Simple First Robot! (How To + Source Code)
Description:
This is my first robot creation for the How To Build A Robot Blog. It is probably about my 30th robot or so.. but it was fun to step back and build something quick and simple.
If you are a beginner I hope you can take something away from this Blog.
I chose to go with the ooPic R microcontroller because its object oriented language makes it super fast and easy to program due to all of the built in hardware objects. Also, this micro allows me the opportunity to plug servos/modified servos directly into the board. The micro also has a built in voltage regulator to provide power to the servos off the main battery.
Parts list:
-Savage Innovations ooPic R Microcontroller (In the US http://www.thebotshop.com/)
-Sharp GP2D12 With wired JST connector
-Raptor Spun Billet Aluminum Wheels/Tires (my shop)
-Hitec HS-311 Servos, Modified
-Super Glue
-.5 X 1 inch Double Sided Tape
-Scrap wood
-Dubro .20-.40 RC Airplane Tailwheel assm.
-Misc. spaces/standoffs and screws/nuts-9 Volt battery
-Heat shrink tubing 1/16 x 3 inches
-3 standard female crimp pin receptacles
-Paint *optional
Tools:
Tools:
-Misc Screwdrivers
-Drill and bits
-Saw
-Soldering Iron
-Solder
Total Cost approx. $95.00 USD
Time to Build approx. 2.5 hours
Time to Build approx. 2.5 hours
Step 1
You will need to modify your servos using the super glue the potentiometer method. Due to a pending article that I wrote for Robot Magazine I cannot publish the process I use on this Blog, but a quick google will lead you to dozens of ways to do this.
Essentially you need to tear them apart, find the 90 (no movement) position, super glue the pot top and bottom, put it all back together, modify the output gear, file off the top of the pot shaft flush with the case mold.
The Hitec HS-311 has a plastic pot shaft that makes it easy to file down. If you use a different servo that has a metal pot you must alter the underside of the output gear instead.
Step 2
Cut a piece of 1/4 inch birch plywood or equivelent, into a 3.25 inch square for the base.Cur a piece of scrap wood into a 2 5/16 inch long, 3/4 inch tall, 1/2 inch thick GP2D12 mount.
Step 3
Using your microcontroller as a guide, layout the mounting holes on the plywood.Using the tailwheel mount as a guide, layout the mounting holes on the plywood.
Step 4
Super glue the GP2D12 Mount from Step 2 to the bottom of the plywood making sure to center it left and right as well as flush it up with the edge of the plywood.
Step 5
Using a servo as a guide, determine where the wires need to be drilled the GP2D12 mount.Drill holes with a 5/16 drill bit.OPTIONALLY you can reroute the wires through a small hole drilled in the bottom of the servo.
Step 6
Install the tailwheel assembly as shown at the center rear of the base. Do not worry about height right now, we will adjust it later.
Step 7
It is best to get your board standoffs mounted right now. Using a screw, a standoff and a nut,install one at each board corner as shown.
Step 8
Super glue the servos to the bottom side of the plywood base. It only takes a drop or two..Route the wires through the holes in the GP2D12 mount.
Step 9
Step 10
Step 11
Adjust tailwheel assembly so that the base sits level.
Step 12
Double sticky tape the battery in the space behind the servos and in front of the tailwheel on the bottom of the base. The batt needs to sit on edge.
Step 13
Plug the left servo into servo port 31.Plug the right servo into servo port 30.
Step 14
Super glue the Sharp GP2D12 over the holes/wires on the front mount. Place it wire up and you can see a little reliefin the plastic case for the servo wires to fit behind.
Step 15
The hardest part of the whole robot, trust me.
On each of the wires for the GP2D12 place a 1 inch piece of heat shrink tubing. Slide it way out of the way.
Solder (or crimp) a single female crimp pin receptacle on to each wire.
Slide the heat shrink tubing flush to the face of the crimp receptacle.
Using a lighter of heat gun shink the tubing.
Sorry, I could not get a good picture.
Step 16
Find any open 5 volt pin on the oopic and plug the red GP2D12 wire into it. There are lots of them.
Find any open GND pin on the oopic and plug the black GP2D12 wire into it. There are lots of them.
Find pin3 and plug the white GP2D12 wire into it. There is only one of them lol.
That should wrap it up. Go ahead and hook up your ooPic R to your PC serial port and upload the provided code.The code is ultra simple but the bot avoids most obstacles it sees. It is easy to take my code and expand it.
NOTE - you will see in the pictures that I used long Male/Female standoffs to secure the board... that is for tomorrowsexpansion of a servo and a sonar!
Have fun and build more bots! You can email me on or off list for help.
Very Basic Source Code for the ooPic IDE
Very Basic Source Code for the ooPic IDE
'WW_LMRBOT
'Ted Macy
'BIGBUG
'2/6/09
'Dev for ooPic R Ver. C1.1+
'-----------------------------------------------------------------
' Create all of our objects
'-----------------------------------------------------------------
Dim Servo_Right As New oServo
Dim Servo_Left As New oServo
Dim GP2D12 As oIRRange(3,8,cvOn)
Dim x As New oByte
Servo_Right.IOLine = 30 'Set the servo to use I/O Line 30.
Servo_Right.Center = 28 'Set the servos center to 28. (see manual)
Servo_Right.Operate =cvTrue 'Last thing to do, Turn the Servo on.
Servo_Left.IOLine = 31 'Set the servo to use I/O Line 31.
Servo_Left.Center = 28 'Set the servos center to 28. (see manual)
Servo_Left.Operate =cvTrue 'Last thing to do, Turn the Servo on.
'-----------------------------------------------------------------
' Main is the first routine called when the power is turned on
'-----------------------------------------------------------------
Sub main()
'--do a program loop that never ends--
Do
Call Check_Sensor
If x =0 Then
Call Forward_All
Else If x = 1 Then
Call STOP
Call Spin_Left
End If
Loop
End Sub '--end of main program loop--
'--start of subroutines--
Sub Check_Sensor()
If GP2D12.Distance.Value>64 Then '--approx 1 foot--
x=0
Else x=1
End If
End Sub
Sub Spin_Left()
Servo_Left.Invert=0
Servo_Left = 62
Servo_Right = 62
ooPIC.Delay=500
End Sub
Sub Forward_All()
Servo_Right.Invert=0
Servo_Left.Invert=1
Servo_Right = 62
Servo_Left = 62
End Sub
Sub STOP()
Servo_Left = 0
Servo_Right = 0
ooPIC.Delay=250
End Sub
'--end of subroutines--
WELCOME TO THE WORLD OF HOBBY ROBOTICS!
CHECK OUT THE OOBUG - ooBug Website
Subscribe to:
Posts (Atom)