Instructables

This is the story of how i made my first robot, and the instructions to build one yourself.
It's a simple line tracer, controlled by two op-amps. No microcontroller, no programming... simple analog circuitry.
I tried to make it as small as possible, using SMD components and tiny motors.

I'm very happy with the final result, the robot can follow 1-2cm wide black lines on white background, and is quite fast.
It can be made to follow white lines on black background by switching the position of a couple components.
I also made a custom charger because the robot is powered by a 200mAh li-ion battery, you'll also learn how to mae yours.
 
Remove these adsRemove these ads by Signing Up

Step 1: The circuit

Picture of The circuit
robot1.jpg
P2280111.JPG
The circuit works like this:
There's an IR LED pointing down at the front of the robot, the reflected light is sensed by the two phototransistors, then, the voltage signal is sent to the op-amp and it send more or less current to the motor (through a NPN transistor) depending on the gain, adjusted with the feedback pot.
The design of the circuit is divided into two equal parts, which have the same sensing and driving components.

The robot works in this way:
When it's on the black line, it advances at an average speed, when the line is curved, one of the phototransistors is out the line, and the other is going into it; the signal from the phototransistor out the line is a higher voltage than before, because it's resistance has dropped down, then the op-amp sends a bigger signal to the transistor and the motor of it's side goes faster, turning the robot back into the line.

If you want to make a robot that follows a white line on a black background, you'll have to switch the posotion of the phototransistor and the divider resistor, so the phototransistor has the emitter connected to GND and the collector to the resistor and the IN+ of the op-amp.

To make the circuit you'll need to make the PCB, you can print the PDF below, or order one with the .BRD file.
The componens I used are:
-Two 3mm phototransistors (mine from TCRT5000 modules)
-An IR LED
-a 2x and a 3x bent male headers, and a jumper.
-0805 resistors (2x4K7, 2x150ohm, 1x120ohm)
-2x 10K 3mm SMD pot
-2x S8050 SMD transistors
-a  MCP602SN dual op-amp (rail to rail)

Step 2: The mechanical part

In the circuit, i left two 3mm holes at the back, so anyone can hook up it's own mechanical part.
I made mine from a 1mm thick brass plate, in the photos you can see how i cut and bent it. This structure can hold the mini motors and the wheels together and it makes a pretty decent rpm reducer. Then i threaded the holes so i can bolt this structure to the PCB without nuts.
The mini ball roller is used at the front of the robot as an all direction wheel, you can just solder a 5mm LED in that part, it has more friction, but it should work.

With this mechanical design, there are a few problems, the robot turns too fast the front part when there's a speed change in a motor, resulting in a instable direction, without changing the design, the only solution is making the robot slower, that can be done lowering the gain with the pot. But i realized that a better solution would be to made a different robot design, with the wheels in the same part as the  sensors, so the feedback would be much better. But for my first robot, this is OK.

Step 3: Building the robot

To build the robot i had to bolt the motors in the back, and solder them to the outputs. I glued a couple pieces of metal at the front to prevent crosstalk between the IR LED and the phototransistors. Then i put the battery with double side tape and soldered it to the circuit. Finally i added a screen to prevent external light reaching the back of the sensors, and i secured it with the bolted ball roller and a nut.

The final result is a tiny line tracer, the overall size is 15mm tall, 55mm long and 35mm wide.
A lot of improvements can be done to this design, from mechanical ones, to using a microcontroller. But i wanted to keep it as simple as possible, using the least components and materials.

Step 4: The charger

Picture of The charger
If you use a li-ion battery, you'll need a proper charger. My battery was from a smartwatch that was broken. I didn't have the charger, so i had to make one. Battery datasheet: http://pdf.datasheetcatalog.com/datasheets2/45/45633_1.pdf
There are plenty of ICs designed for this application, and they make the circuit design easier, but they're rather expensive, and i had all the components i used avalible.

The charger consists in a current and voltage limitter, that is what a li-ion battery needs. I used a MCP602SN dual op-amp (rail to rail) to controll the charging cycle in the circuit, R4 and R5 set a voltage reference equal to the max current in amps, in this case, 100mV for a 100mA max charging current.
The current is controlled in that way: The first op-amp  outputs enough voltage so the transistor starts conducting, and continues until de current gets up to 100mA, at that point, if the circuit outputs a little more current, the voltage accross the 1ohm sensing resistor would be greater that the one set in the first reference, so the op-amp would ouput a lower voltage than before, maintaining a constant current. When the battery is in the constant current AKA CC stage, the op-amp keeps the refernece voltage equal to the one in the sensing resistor.

Meanwhile, the voltage in the battery is slowly increasing (see the chart in the datasheet), and we all know that li-ion batteries shouldn't be charged above 4.2v. The second op-amp is there to save the day:
When the battery voltage is under 4.2v, the voltage at IN- is higher than the 0.8v refernece in IN+ ( which is always VCC-4.2v). But when the battery voltage reaches 4.2v, the voltage at IN- is slightly lower than the reference at  IN+, and the op-amp otput voltage increases, the diode starts conducting and the voltage in the first op-amp at IN- goes higher, the op-amp beging to output lower voltages, and the current starts to drop. The constar voltage or CV stage has begun.

Along this stage, the voltage at the battery remains constant, at an ideal value of 4.2v. Meanwhile, the current slowly drops, until it goes under the ideal value of 3% of the max charging current. At this point the battery is fully charged.
You can see, that in the circuit i haven't installed any charge indicator. I just leave it charging 3 hours, because i know that it will be fully charged. If a battery is already charged, with this circuit, is okay to leave it plugged a bit more, because the current is still going down and it won't harm the battery.

If you use this charger design with a 200mAh battery, you can leave the design untouched. If you use lower capacity batteries, lower the first voltage reference (R4 & R5) at the value where the voltage in milivolts is 0.5 times the capacity of the battery in mAh.

If you use this charger design with bigger batteries, you'll have to do a little modifications in the circuit:
First of all, use a transistor capable of delivering  more current, this will force you to use another package, like TO-122 (not sot23).
Then, if you still use the 5v as VCC, don't use a computer USB if you draw more than 300mA, and then, use a lower value sensing resistor, in the way That 4.2v plus Collector-Emitter Saturation Voltage AKA VCE(sat) plus the voltage accross the sensing resistor at peak current still under VCC 5v.
If you use a higher voltage power supply, for example 12v, you'll have to calculate the voltage dividers again, the second one, must output VCC-4.2v or more, not less. The first one should output the same voltage as the spected accross the sensing resistor at maximun charging current.
As you can see, this circuit can be used in more battery-powered projects by adjusting some component values. It can charge both li-ion and li-poly batteries.

Step 5: Give it a test!


With this little robot project, i've learnt a lot about electronics and mechanics, and somtimes failing was worth it. 
The robot can follow 1-2cm wide lines, and they can't be drawn with a permanent marker, i had to print them with toner in a laser printer, because it's very good at absorving light. The lines have to be rather smooth and whith no closed curves.
The robot design can be improved, and i hope you do so, but i'm very happy with the result, even though the robot is not too fast, too accurate nor can follow complex lines.

I hope that you've learnt as much as me of robots, op-amps and battery charger charger circuits.
If you did so, and enjoyed learning with this instructable, please vote it for the Full spectrum laser and Robot contests.

If you have suggestions, doubts or questions about anything, feel free to ask me, and i'll help with all i can.

Thanks for reading.
1-40 of 44Next »
solsmac4 months ago
What's the song in the video?
pinomelean (author)  solsmac1 month ago

The song is from the game "icebreaker"

I've been wanting to make this for a while and when my teacher said he wanted to do robotics with us I mentioned this and he asked me to prototype it but I can't find where to get the wheels or the roller, if anyone has the links can they please send them? It would be a great help, thanks - Luke

pinomelean (author)  ClockworkPheonix1 month ago
The rollers or wheels are just rubber pieces from a printer/cassette that i had lying around.
I bought the micro motors from ebay
http://www.ebay.com/itm/Load-3-7V-30000RPM-Micro-VDC-Motor-6mm-Diameter-12mm-Length-Model-CL0612-/200911920772?pt=LH_DefaultDomain_0&hash=item2ec7489e84

Thanks for the help, one more question, where did you get the roller ball?

pinomelean (author)  ClockworkPheonix1 month ago

I made it from a brass stand-off screw, a steel ball and a spring.

robobot31126 months ago

can you make it on breadboard?

joshdont8 months ago

This is beautiful! Well done : )

ricardouvina8 months ago

Where did you get that mini ball roller?

you can take it easily from ball roller pens i think

Mic1008 months ago
Hi Great Work :)
999anthony9998 months ago

the materials can pass me

ricardouvina8 months ago

Hi, great instructable!!!

I have one question: does it follow crossed lines, I mean, when there is a line crossing another line, does it stops or continues?

pinomelean (author)  ricardouvina8 months ago

It does, but when it goes slow, it stops at them.

halamka8 months ago

I built several servos from lm339 chips. I had trouble with the lm339 because it will short when the battery goes low. Both differentiators turn on when the battery goes low. The servos work just like cox sanwa servos. zzzz zzzz 1993. What does the 602 do when the battery goes low.?

pinomelean (author)  halamka8 months ago

I don't know what happens, I've chosen the MCP602SN because it's a rail-to-rail op-amp, and it works with low battery voltages. Yours should also work...

12203madman8 months ago
could u use perf board because i cant print the circut
pinomelean (author)  12203madman8 months ago

Yes, you can sacrifice aesthetics and do it with a perfboard. It should work.

But making your own PCBs is not that hard, i make mine since i was 12 y/o and it's pretty easy, here's my instructable guide about making PCBs, see how simple it is, and how good the PCBs can be made.

rafael.pollon8 months ago

hey, i wanna buy one unity from you, you can sell?

pinomelean (author)  rafael.pollon8 months ago

Yeah, i can sell you the one in the instructable.

lumi30058 months ago

Awesome little robot and very good big descrition. Well done, I mean the robot AND the instructable. It was mentioned before, slowing down the motor wuld make a better choice.

pinomelean (author)  lumi30058 months ago

Yeah, if it could go slower, it would follow much more complex lines. But the smaller the motor is, the faster it goes.

NotACat8 months ago

To address the instability, would it work better if instead of speeding up the side which leaves the line, you slowed the other side down? (This is completely off the top of my head with no means of testing it myself right now, but it seems an obvious question to me: if I'm wrong or you've already tried that and it didn't work, sorry to waste your time ;-)

pinomelean (author)  NotACat8 months ago

It does both things; drive slower on the dark side, and faster on the bright one.

What are the chances of making this wired rather than PCB'd if one didn't care if the bot got bigger? Did the schematic get posted?

pinomelean (author)  onlylooklikepackrat8 months ago

You¡ll probably prefer to use trough hole components. And as i said, the schematics are already posted as photos.

BurgersBytes8 months ago

Would you happen to have some schematics of the circuits. I cannot open SCH files.

pinomelean (author)  BurgersBytes8 months ago

I've posted the schematics as JPG files (just the diagrams images in the instructable)

privatier8 months ago

Could you please publish your schematic as a pdf, png or jpg?

pinomelean (author)  privatier8 months ago

There's a screenshot of the two circuit diagrams. One for the robot, and the one for a charger.

sakrow8 months ago

Fellow imgurian?

mahesh_jo9 months ago

Good design and look. Nice thing is its without programming. I will also try it.

BTW what background music you have played in video. Its is also good to listen.

pinomelean (author)  mahesh_jo9 months ago

The music is from the nitrome game ''icebreaker''. They make awsome songs.

agis68 pinomelean8 months ago

and i said something it recalls this music!!!

csherrit8 months ago

I agree , non micro-controlled projects are a rarity . Since a micro can replace many components it is first choice but we loose a bit of the art.

ASCAS8 months ago

AWESOME! I forgot I had two unused "super micro geared motors", I can finally put them in use :D They are so small even the Arduino's DIP chip is wider than the two geared motors combined :)

pinomelean (author)  ASCAS8 months ago

Two mini geared motors would make the perfect robot, with mine, the only problem is the speed, it's too fast.

If you use those motors, the same circuit could work awsome, following even sharper lines.

If you make a robot, please, i would like to see it!

agrady19959 months ago

Who needs a bananna when you have that cute little guy!

joao.torres9 months ago

Nice Job. But what about the ambient infrared light? How it reacts at outdoor sunny ambients or an amient with light bulbs?

I'd developed an anolog line follower too but i used an modulated IR led (with 555) and a passive filter at the foto-diode input.

If someone get interested here is the link: http://protocoloj.blogspot.com.br/2014/03/robo-seguidor-de-linha-analogico-v10.html

pinomelean (author)  joao.torres9 months ago

It is litle affected by external light due to the shielding, but it still goes a bit faster in sunny places.

1-40 of 44Next »