$USD
  • EUR€
  • £GBP
  • $USD
TUTORIALS Robotics

How to make your first robot

DFRobot Feb 16 2015 373
This tutorial is the easiest way in the world to give you a fast start into building robots. 

Materials needed


It used to be a hassle to buy the materials, because not one single webshop was carrying everything needed, and you had to buy from several shops.

Good news is that Solarbotics now have made a kit for these instructions:

Solarbotics shop (Webshop, located in Canada)

- And if you buy it there, you even support hosting of letsmakerobots.com - because in order to be on the list above, the shops contacted us, and we made a deal :D

Everything you need can also be found in webshops, and via Google, if you do not want to buy the LMR bundle. And as it is sold in webshops, you can get it where you are, in any country.

 

No matter from where you get it, the following is what you will need:

(The following is all included in the bundle)

 

1 PICAXE-28 Project Board

The 28 pin project board is like a game of Mario Bros; Fun and full of extras and hidden features, making you want to play over and again. It is an extremely good board to get you started, and it can be used for a fantacillion different projects, don't get me started :)

 

Male "snap off" Header Pins,  at least 10 pins on a strip

Many times the boards that you buy just have holes in them, and that makes it hard to plug something in / on. One way to overcome this, is to solder wires into the holes. Another is to add these pins, so you can plug on wires, like with the servo and female headers shown below. "Why don't they just put pins in all the holes from the factory", you may ask. Well, I don't know. Maybe to give us the option. It is also possible to solder female headers onto the board, perhaps this is why.

You get these in long rows, and simply break them apart with your fingers.

 

3 Shorting Blocks, Top Closed

Put these over 2 pins next to each other, and there is a connection between them!

 

5 or more Female-Female Header Jumper cables

Yes. These are nice. When I started this hobby a couple of years ago, these where really hard to get. Now they are everywhere, and that is really good. Most things in this new robot-hobby of yours have pins (or you solder some in ;) - and by using these jumpers, you can make quick connections without soldering. Nice!

 

1 USB PICAXE Programming Cable

You write your robots programs on your computer. Plug this cable into the robot, and transfer the program. Unplug, and the robot runs the program by itself.

 

1 PICAXE-28X1 IC

This chip is a Microprocessor. That is often explained as "A computer in a chip". It can be placed in the board described above, after that, it can be programmed from your computer via the programming cable.

Your program can tell the controller to "listen for inputs", "think about them", perhaps make some calculations or look in some datas, and make outputs to something like the motor driver below. 

It is chosen here, because it is quite strong, yet very easy to program, as you will see below.

 

1 L293D Motor Driver IC

I will describe this later, when we install it below :)

 

1 DIL 330 x 8 resistor array

The Yellow chip! It is very dull, just a row of little resistors. You will be using it to set your board up for servos.

 

1 Standard servo

A Servo is a cornerstone in most robotic appliances. To put it short it is a little box with wires to it, and a shaft that can turn some 200 degrees, from side to side.

The microcontroller can decide to where the shaft should turn, and stay there. Like go to "3 o'clock". That is it pretty handy; You can program something to physically move to a certain position. Next thing (after this project) could be to let one servo lift another servo. You would then have what is referred to as 2 DOF ("Degrees of Freedom"). But let's start with one ;)

You may wonder why my servo has that white pin, where yours might have a flat disc, a cross, or something. It does not matter, servos comes with all kinds of "servo horns". We just need something there to glue the head on to!

 

1 Sharp Analogue InfraRed Range Finding System (AERS) with cable

The one "eye" sends infra red light. The other sees the reflection of this (if there is one), and the unit returns the distance to the object in front of it. It has 3 wires (make sure you get the cable for it, or it can be a little hard to hook up). You give it power on 2 of the wires, and the third one plugs into the microcontroller, and tells it the distance.

 

1 4 x AA Battery Holder if you are using rechargeable batteries
or 
1 3 x AA Battery Holder if you are using non-rechargeable batteries

(See more below, regarding batteries, and why the difference - Point is that you need as close to 5V as possible, one way or the other, and you can use something completely different in terns of batteries if you want. As long as it is just about 5 Volts.)

 

2 Geared motors and wheels to fit

It is very important that your motors have gears. You want a slow robot; Go for high ratios, like 120:1 or higher, as a slow robot is so much more fun in the beginning, because you can see what it is doing.

Apart from that, there is not much to say. Well, that would be, that there are many ways of moving and steering. This way of only using 2 wheels, is sometimes referred to as "skid steering". And it is worth remarking that if you'd like to add belt tracks later on, the basics are the same ;)

 

1 Roll of double sided foam tape

Oh yes! If there is something you cannot fix with this tape, it is because you are not using enough! It is a very, very fast way of sticking 2 items together. In fact we will be using it to make this entire robot! Depending on the make, of course, it is also reasonably easy to take apart again.

Paint stirring sticks, this tape, and a melt glue gun is the backbone for most of my fun with robots :)

 

1 Heat shrink tube (5 mm approx)

Sometimes you do need to solder 2 wires together. For instance the Sharp IR Range finder; It comes with straight up wires on the plug. What you do, is cut one of the female cables (above) in 2 parts, solder them together.. but before that, you cut a little piece of this heat shrink tube to slide over the place without insulation. Then with a lighter, you can quickly heat up the tube, and it shrinks to fit.

That is so much smarter than using tape ;)

 

All of the above materials are included in the LMR bundle.

 

 

 

Also needed:

 

Batteries

Either 3 AA Non rechargeable, or 4 AA Rechargeable.

This robot needs 5 Volts. Mainly because the Sharp IR, really feels best on 5.0V, that's what it's made for. Motors and servo would like more, microcontroller could live with 6.0V, but keeping it simple is the core here, so we feed the whole robot with as close to 5.0V as possible. And rather too little than too much, so we make sure not to fry anything, now that this is your first robot ;)

Now, you may know, that normal batteries provide 1.5V. However, you may not know that rechargeable batteries only provide 1.2V!

No matter if you knew that or not, 3 times 1.5V from normal batteries, is 4.5V. If we use 4 times 1.5V we would get 6.0V, which might be a little scary to use on the Sharp, rated for 5.0V.

4 times 1.2V from rechargeables is 4.8V, which is nice and close to 5V. And then it is much cheaper in the long run. So I strongly recommend you to get some rechargeables and a charger.

Tip: The best rechargeables have the highest capacity, measured in "mAh". The 2500 mAh AA-size is a fine battery.

 

A Soldering iron and solder

If you are new to soldering, this might interest you.

 

A lighter and a cutter

Lighter for heat shrinking, cutter to.. cut.

Tip: If you want to use the cutter to remove plastic from cables, turn it this way; Imagine that you where sticking the cable right into the cutter from where you are now, into the table it is laying on. That way. And not from the table, and out to where you are. Then gently close around the wire, and pull the plastic off.

 

A computer with an internet connection and a free USB port

              

Can be Mac, Linux or PC. The software needed for this is free.

 

 

Nice-to-have tools, though not essential:

 

A multimeter (aka measure-thingey), a wire stripper, and a screwdriver

Ready? Let's make a robot :)

 

Pins in holes!

First unwrap your board (I am sure you already did that :), and then see that it may have some red stuff underneath. That is just there from when they made it; They insert the components on the upper side, and dip the boards lower side into hot solder.. and areas where they don't want solder to be stuck, they have placed that red stuff. So just take it off :)

Let's look at somewhere where we for sure are going to add some pins.. Yes, the motor-outs.

The A & B on the board. We will get back to them, but for now, snap off 2 times 2 pins, and plug them in.

It does not matter if you snap off single pins or anything like that. They are simply little metal rods in plastic. Short side down into board.

Use some foam tape to hold the pins in place.

Turn the board around  and solder..

And now, tatataaaa.. You can plug in any standard female header, where you used to have a hole :)

Nice, and while you are at it, also solder a pin into analogue port 0, that we are going to use for the Sharp:

Then solder a pin into output 0..

And you are done with pin-soldering.

If it was me, I'd just solder pins in all the holes, but you may want to leave that for later. You have soldered all the pins that we need for this project now.

 

Next, general instructions: Extensions and alternations of wires and cables:

Connecting 2 wires "The right way" is almost a religion to some. Here is how I do it :)

First, I simply twist together the 2 wires

Then I solder them together, cut some off, if it is too long, and bend it along the side of one of them.

However, BEFORE I do this, I make sure that I have cut off a little piece of heat shrinking tube, and placed it over one of the wires. Then I slide that over..

A lighter quickly heats it up. This makes it shrink, hence the name, and it is a perfect insulation.

I don't think you realize how hard it was to take that picture all by myself :) It had to be in focus on the right spot, you know. And yes, the wire got a little burned :p Good shot though, if I may say so myself.

 

From now on, I expect you to just extend wires that are too short, hook up headers on wires when needed, and if you need to connect something to the board, where there is only a hole... you simply add a pin :)

 

 

Get it together!

 

Fixing up the motors

Mount the wheels on the geared motors. You may have a completely different set than I do here, but as long as they are geared motors that run fine on a few volts, and some nice wheels, you will be all right.

When you have the wheels on the motors, cut one of the female-to-female wires in halves, take away some of the plastic from the end of the wire, and solder it on. And do the same for the other motor.

Make sure no solder or wires touches the metal on the motor :)

Some wheels come with optional rubber tyres. It can be a good idea to wait with putting on this rubber, because if the robot is stuck, it can just slide, which is nice when testing and developing.

 

Chips in the board!

The Picaxe 28X1 Microcontroller that you have here, and the board, is a pretty amazing and very powerful little package.

I remember how amazed I was that I could actually make this control everything I could imagine, I hope you will get that sensation at some point as well; Seriously, you can make this thing do all sorts of stuff with all sorts of electronics. Even if you know nothing about anything, and electronics is as strange to you, as it is to me.

You can also make it handle your servos, motors, calculations, monitoring distance.. everything a robot needs. And that is what we are going to set it up for now

The microcontroller is the long chip. That is the one you program, and then there are inputs and outputs on the board that it can use.

 

Have a look at this page: 28 pin Project Board (AXE020), Picaxe for dummies

 

Now, I do not expect you to read that page now, because I have promised you that you will building building the robot as fast as possible :) However, it is important that you read that page at some point, to learn about the board, and the microcontroller. Promise me to get back to that, make a bookmark for next step ;)

OK, enough talk, insert the long black chip, that is the microcontroller.

Make sure to turn it the right way: It has a marking in one end, and so does the socket. They should match.

 

Now, when you bought the board, it should already have a black chip in it, in the slot where I have placed the yellow chip, in the picture below.

Take up the black chip, and as I did, replace it with the yellow one. It does not have enough pins, but see picture for what end to leave open. (the inner side)

The yellow chip is sitting between the microcontroller and the topmost row of pins on the picture. That row has (as you will know when you read about the board, your bookmark, remember?) the outputs.

We are going to hook up the servo to one of these. Servos are sending a lot of electrical noise back on the line. The Yellow chip is a series of 330 Ohm resistors, that will reduce the amount of noise that is sent back to the microcontroller. It is simply straight lines across, with some resistance between, making the signals travelling both ways a little weaker. So it is there to protect the microcontroller.

Frankly, I have never heard of anyone frying a microcontroller because of servo noise, but since manuals tells us to do this, and the board is prepared for it, we might as well.

I have also heard of black versions of this chip. How boring, but none the less, and yes; You can use it, no matter the colour, if it has the same functionality.

The black chip that was in its place, is a so-called Darlington driver. If you need more info than that, please read the manuals :) But it is a good chip, if you are not hooking up servos right on the board. It is amplifying the signals, so for instance you can hook up a speaker right on it (where we now will be placing a servo) - and using the command "Sound", you can make it beep quite loud, play tunes etcetera. You have got to try that as well! Just not now ;) Disadvantage of using the microcontroller and this board for everything is, that when you want to play with servos, you take out the Darlington, and the fun it provides. But there is more, wait and see!

Last chip is the motor controller, throw that in as well!

When your microcontroller is placed in your board, it can switch power on/off. You could use that to drive motors. However, motors are "rough", and could fry the microcontroller's outputs. And another thing is that if the microcontroller can only turn power on/off, then.. how do you drive backwards? 

A motor driver takes care of all this; 
This little motor-driver-in-a-chip can drive a pair of small motors (600 mA each, for the tech interested), without frying the microcontroller. And furthermore; It can make the motors go backwards. Which is handy when facing a wall :)

Your nice board has a place for a motor driver that can take a pair of small motors, and make them drive both forward and reverse.

The board is set up, so the microcontroller's outputs 4, 5, 6, and 7 are fed into the motor controller, and out comes 2 fine pairs of wires that you can hook up to a pair of motors: Motor A and Motor B. And you just soldered pins into them, how nice.

Tip: New chips in
New and unused chips usually have the two rows of legs a little too wide apart. So gently push down the side of the chip towards a table to correct it, before inserting it into a slot. You will understand me once you try to place a new chip in a socket ;)

Tip: Old chips out
It is easy to get a chip out of a socket, by inserting a flat screwdriver below it, push it under, to the far end, and gently push it up.

Fact: Later in your life, you will want the microcontroller to just be a microcontroller. You then buy extra other boards for something like servo control and motor control. These boards will get their commands from the microcontroller. And then your robot can do everything much more powerful, and simultaneously.

However, it is pretty amazing what you can make this set-up do, as you have it right here! Many, many cool robots and other project use far simpler or just this set-up.

 

Make the body.. without a body!

In order to keep this as simple as possible, we are just glueing all the parts together, and call that a robot! Yes.

If you prefer, of course you can make it more advanced than this. Only thing to note as such is that we use 2 central wheels, each with one motor. Driving both forward makes the robot drive forward, and if one is going backwards with one forward, it turns on a plate. If one is still, and the other is driving, it is more like "sliding" to one side.

What you can do, is simply to stick on the motors to the battery holder, using the foamy tape. If the batteries are in there, and the wheels are big enough to have them placed below the axle, the whole thing will simply balance on its own. Quite strange, actually, when I think about it :)

Somehow also leave some room for the servo in front. Or stick it on to the front of it all.

Most important is that wheels touch ground, and the rest is more or less in balance. It does not matter if it is tipping a little backwards.

Feel free to make your own design, of course :) If you do not like the balancing part, or cannot make it work, you can just add some smooth "pads", or extra wheels. A pearl, or an old LED could make nice little "third wheels", that usually are placed in the rear of the robot.

Now, as you can see, this time, I used the 4-battery holder. Because that is the biggest one, which makes it easier to stick it all on to it.

- But if you are using non-rechargeables, and only should use 3 batteries, here is a tip:

Find an old telescopic antenna, from a radio or something.

Cut off a piece (Here is a tip on how to cut it), and insert it instead of one of the batteries. Bingo ;)

OK, next thing is to place the board on the robot, and hook everything up (apart from the Sharp, wait with that).

First: Take out the batteries again (or at least one of them). Just to make sure you don't fry something by accident. We don't have an On/Of on this robot; Batteries in, and it is alive. But we want it dead now, so one battery out! (and not like on next picture, doh!)

Some battery holders have wires (like the one I am using), and some have a clip that fits right onto the clip on the board, as illustrated in the 3 battery holder below. If you have a clip, then hook it up, you are done. If you have wires like me, cut off the clip from the board, and connect black with black and red with red. (and use shorter wires than I did ;)

The + from the battery should go the where the RED is hooked up on the board, from the factory.

 

if you want to read more:http://letsmakerobots.com/start

 

REVIEW