This is a fun robot and easy to make but little difficult to programme. But, I will write the codes. So, lets make it !!!!!!!
( sorry for my english, I am a 12 year boy )
Step 1: MATERIALS NEEDED
• 1 picaxe 28 pin project board
• 4 2AA battery holder
• 1 standard servo
• 2 wheels
• 2 geared motors
• 10 or more female-female header jumper cables
• 1 28 by 1 micro controller
• 1 motor driver IC L293D
• 1 resistor array
• 1 sharp IR sensor ( and its cable )
• 3 shorting blocks
• Solder iron
• Double-sided foam tape
• Picaxe programme download USB cable ( to transfer programme into the robot )
• Soldering iron
• Soldering cream
• Soldering wire
This robot is easy to make with a little programming. So, anyone can make it.
Step 3: Building the Robot
First of all, lets get started with the 28 pin project board. You can see that this board has a chip fitted in it. Remove that chip with a screwdriver and fit the resister array in place of that chip. The chip that you removed is used for sound if you attach a speaker. And the chip you fitted in place of it is used to lessen mechanical voice made by the robot.
Step 4: Pin Soldering
Now, come to pin soldering. If you are new to it, you will find this interesting.
OK, now solder the "male header pins" into the board. Just simply pass the pins through the holes and solder them and you are done with pin soldering !!!!
Step 5: Fixing the Microcontroller
The microcontroller is a chip which get fits in the board and command the motors, the servo and the Sharp IR Sensor. So, fit it in the board by seeing the image that I have uploaded.
Step 6: Fitting the Motor Driver
You will get a thing called motor driver. Fit it into the L293D. And you are done with chip fixing !!!
Remember that you have to place the chips in correct position. The chips will have a mark on one of its end and the fitting slot also.
Step 7: Hooking Up the Motors
You will get two geared motors. You want a slow robot ????? Go for a higher ratio.
You may also get female-female header jumper cables. Take two wires and cut them in half. Now, attach the wires to the clips of the motor.
Step 8: Making the Body
Now, its time to make the body by setting up everything. Or otherwise make it on your own.
We will start by taking the battery holder as the base of the robot. Turn the battery holder with the batteries facing down and fix the servo in front of the holder with the help of double-sided foam tape as given in the image above.
Step 9: Hook Up the Motors
We are going to place the motors to which we hooked up the wires earlier. Now, place the motors with the servo as given in the picture.
Step 10: The Project Board
We are now going to place the project board the top of motors as it is the only place where it can be placed without any problem and also it will not fall off.
Step 11: Connecting the Wires
Now we will connect the motors, the servo and the IR sensor to the project board. First of all, connect servo to the board. Make sure that you connect the wires to the correct place on the board. Please see the image above for more help.
Step 12: Connect the Motors
After connecting the servo, we will connect motors. Also attach the wheels before connecting the motors. The wires of one motor will go to "A" on the board and the wires of the other motor will go to "B".
Step 13: IR Sensor
Do not forget about the Sharp IR sensor. Buy the latest version of that. And keep one important thing in mind, that if you connected the sensor wrong way, then it will probably fry itself. So, look at the above image carefully.
Step 14: There It Is !!!!!!
We are finished with the building of the robot. And it is very cute. You can also attach an extra wheel for support or an LED bulb also. The last step is programming.
Step 15: Programming Software and Driver
Make sure that you have AXE027 USB cable to connect the robot to the computer to transfer the programme.
Download the driver from this website-: www.picaxe.com/axe027
After installing the driver, install the programming software from this website-: www.picaxe.com/Software/AXEpad/
Step 16: Programming
Enter this code into your editor, and press F5 while the robot is connected:
readadc 0, b0
debug goto main
Now take your hand in front of the robot´s head and notice how the variable b0 changes value. You can use the knowledge gained to decide what should happen and when (how close things should get before..) You may notice how things start to go "wrong" if stuff is too close to the "eyes"; The Sharp is made to work with objects 10-80 cm away. Things that are closer than 10 cm (4 inches) appear to be further way, which can be quite a challenge to program. You can get many other distance sensors that do not have this problem. However the Sharp is the cheapest, and easiest to program, so that's why I made such a "bad" choice for you, sorry ;) Look around and see what everyone else is using, before you decide on an upgrade. Now I advise you to put your robot up on a matchbox or similar, as the wheels will start turning.
Enter this code into your editor, and press F5 while the robot is connected:
One of the wheels should turn in one direction. Does your wheels turn forward? If so, this is the instruction for that wheel to turn forward.
If the wheel is turning backwards, you can try this:
To turn the other wheel, you need to enter
(or the other way around for opposite direction.) What happens here is that by using only the options available to the microcontroller; power on or off (High / Low) on the pins, it is commanding the motor controller to set motor A or B in forward or reverse mode.
stops all motors
The servo you have already tried.
All the way to one side is:
servo 0, 75
- the other side is:
servo 0, 225
- and centre:
servo 0, 150
Here is a small program that will (should, if all is well, and if you inserted the right parameters for high/low to suit your wiring to the motors) make the robot drive around, stop in front of things, look to each side to decide which is the best, turn that way, and drive towards new adventures. In the code I have made so called remarks: explaining you what is going on. You can write such comments or remarks yourself in the code, it is a good idea to keep track. They are written with an apostrophe (or single quote) sign. However, copying this text from here might alter that to something else, and you will have to fix that manually, sorry. Your programming editor has colour codes, that will help showing you what it recognizes as comments and what as code.
Symbol dangerlevel = 70 ' how far away should thing be, before we react? symbol turn = 300 ' this sets how much should be turned symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it´s speed) before we measure distance
main: ' the main loop readadc 0, b1 ' read how much distance ahead if b1 < dangerlevel then gosub nodanger ' if nothing ahead, drive forward else gosub whichway ' if obstacle ahead then decide which way is better end if goto main ' this ends the loop, the rest are only sub-routines
nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors high 5 : high 6 : low 4 : low 7 return
whichway: gosub totalhalt ' first stop!
'Look one way: gosub lturn ' look to one side pause servo_turn ' wait for the servo to be finished turning readadc 0, b1 gosub totalhalt
'Look the other way: gosub rturn ' look to another side pause servo_turn ' wait for the servo to be finished turning readadc 0, b2 gosub totalhalt
' Decide which is the better way: if b1
body_lturn: high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way pause turn : gosub totalhalt return
body_rturn: high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way pause turn : gosub totalhalt return
rturn: servo 0, 100 ' look to one side return
lturn: servo 0, 200 ' look to the other side return
totalhalt: low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot! Servo 0,150 ' face forward wait 1 ' freeze all for one second return
With some clever programming and tweaking, you can make the robot drive, turn its head, make decisions, make small adjustments, turn towards "interesting holes" such as doorways, all working at the same time, while driving. It looks pretty cool if you make the robot spin while the head is turning ;)
You could also attach a lamp or LED to pin 2 & ground, and write (remember LEDs need to turn the right way around)
to turn on the lamp, and
to turn it off ;) - How about a Laser-pen, mounted on an extra servo? Then you could make the robot turn the laser around, and turn it on and off, pointing out places.. you can do anything now :) Pressing "Help" in the programming editors brings out all sorts of interesting tutorials and info!
Perhaps try this: Pull out the servo, and take up the yellow chip. Insert the Darlington that you took out earlier. Hook up the speaker to the 2 pins above where the servo was, tat is output 1. And throw in the LED, or whatever it was that you found on output 2. Then program it something like this:
sound 1, (100, 30) high 2 wait 1 low 2 sound 1, (105, 60)
That should make a sound and turn something on, make a new sound and turn it off again.
Or the more interesting, make sure the Sharp is still in, hook a speaker up to pin 1, and then program this:
noise: readadc 0, b0 sound 1, (b0, 2) goto noise.
Please vote for me.