![]() |
![]() |
![]() |
|
|
|||||||
| Robotics Chat Specific to discussions about robots and the making of. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hello everyone.
I want to make a simple, little line following robot for my desk, so I can watch it move around a line. The thing is, I want to keep this as simple as possible, just for a fun little weekend project. I am going to be using some very small, two DC motors (that I might get from a previous toy) and a microcontroller (16F628A or 16F684). As for the line detecting I have heard it can be done with a LED IR detector and emitter (both of which I currently have). So much question to you is, how do I set up (and program) the line detecting part of the project, using the emitter and detector. Preferably, any information on how I can wire it too, will help. As for the DC motors, I think it'll be quite easy. If I just stick the positive to an output pin and set it to high (and connect other end to ground), that motor will start to spin-- correct? Thanks a lot for your help, Omar |
|
|
|
|
|
|
(permalink) |
|
If it's a dark line on a light surface, I'm prety sure its just programmed to go straight if neither left and right detectors see light. Then if the left/right detector detects dark, then the robot just starts turning left/right. Some robots have 4 sensors- an inner left/right pair and an outer left/right pair with the second pair farther out to the edges of the robot. This way, if your robot passes outside of the two sensors before the robot has corrected for it, there is still one last chance to track the line as it passes beneath the outter pair of sensors- otherwise you will lose the line.
You could also have a center sensor in combination with 2 or 4 side sensors. The robot assumes that it is on top of the line whenever the side sensors read light. This means that if the robot loses the line, it will think wherever it is going is correct. If there is a center sensor present and it reads light then it means the line is not directly under the robot and it knows for sure some correction has to be made. This way, if the robot completely loses the line (ie. the center sensors reads light for too long and doesn't read dark again no matter how the robot tries to correct it, while the others. Many people just stick 6-10 sensors since photo detectors are so cheap. If a more expensive sensor is being used, then it's about 4 or so if the person wants reliability. The cheap robots just use two cheap sensors. You cant drive a motor by connecting it to a pin of a microcontroller- it can't provide enough current. You need a motor driver/H-bridge. You probably also want direction control. Last edited by dknguyen; 26th January 2007 at 11:36 PM. |
|
|
|
|
|
|
(permalink) |
|
Thanks for the quick reply. Actually, that makes quite a bit of sense. But rather, how would I set this up? Which pins would I connect the detector to, the emitter? How would it tell it if it is receiving any IR?
And as for the motor- darn. That's a bummer. I really thought it was possible-- after all I am using a REALLY small motor (I am hoping to make this robot very small, and it'll be very light. And where I am getting it from (an old hand held fan) which runs on 2 AA batteries. Will this one not work, either? Omar |
|
|
|
|
|
|
(permalink) |
|
Ah, thank you very much. I have seen that page, and the thing is that the author is using an ATMEL chip whereas I am using a PIC microcontroller. A lot of those things that are talked about seem quite complicated -- I just want to use 1 detector and 1 emitter. Though, the diagrams DID help explain how I can set up the line detecting.
I guess my question now is, if this makes sense: I set up a LED emitter on one pin that is HIGH. On another is a detector, that is input. Through BASIC (great cow basic), how will I know that the detector is picking up something? When the detector sees the IR, will it complete the circuit or something? And where should I place the emitter and detector underneath the bot (does the detector go in the middle and emitter to the side?).. Thanks so much! |
|
|
|
|
|
|
(permalink) |
|
The algorithm is the same no matter which processor you use. Interfacing the detectors/motors is pretty much the same. You have to use at least 2 sets of sensors for this to work, if you only have 1 then you don't know which side of the line you are on.
Mike. |
|
|
|
|
|
|
(permalink) |
|
Oh ok. Is that two different LED Emitters and detectors? Or two detectors and one emitter?
And as for the motor -- will the ones from a simple toy work? I guess it runs around 5 volts (because it runs on 2 AA batteries), and all I really need to do is turn one on and off depending on line. |
|
|
|
|
|
|
(permalink) |
|
You need multiple detectors for sure. If your emitter is strong enough and wide enough to illuminate the area that both detectors are looking at, you only need one. If there's just one light in the room, you're not blind in one eye right?
Yeah simple motors work. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
http://www.geocities.com/tjacodesign.../cerberes.html Tjaco's design graveyard Ooops, sorry, I have just realised that it's not a line follower, still, it might be a start. Last edited by House0Fwax; 27th January 2007 at 01:30 PM. |
||
|
|
|
|
|
(permalink) |
|
Oh I think I understand now. So I put the emitter (a few) directly in the middle. And the detectors will be off to the side.
I am glad to know that the motors will work out. Thank you very much! Just a quick question: PIC micro controllers I heard need a pretty smooth 5V fed to them so they can function (since for all of my projects I use a voltage regulator and some caps to smooth out the current). Is this the MAXIMUM voltage they can get? What is the minimum? Like that article that Mike linked (a few posts above), I want to run my robot off small batteries (maybe not watch-cell batteries, but maybe AA). |
|
|
|
|
|
|
(permalink) |
|
You want the emitters to be lighting up the area that the detector is looking at more than you want the emitters to be lighting up the line. so try spreading out the emitters. Maybe one "below" or "above" each detector if the emitters are weak.
I think the miinimum is 3.3V, but some of the PICs (or maybe even all of them) might be able to go as low as 1.8V or 2.5V. You will need a few AA in series to get the voltage you need. You're going to need that voltage for the motor anyways so you probably don't want to go too low so you can use just one set of batteries for the PIC and motors. |
|
|
|
|
|
|
(permalink) |
|
Thank you very much for your help
As well, I read that I cannot just stick the IR detector onto a pin... instead I need to make a voltage divider...? Do you know what this is or if I need to make one? Thanks, Omar Edit: I have tried messing around with motors and microcontrollers... it seems the chip is working (I have tried using LEDs instead of motors, and they blink showing that one pin is high, then low), but when I hook my motor to the pin it doesn't work. The motors are very small, and when I tested with 1.5 volts of current, they work. I checked the output from the pins, it was about 5 volts -- which should be perfect for the motors. It just doesn't work. Any ideas why? Last edited by Omar.M; 28th January 2007 at 08:39 PM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Oh, I got the motor from an old fan toy, so it uses very little power. I tried different voltages (since my wall wart came with an adjustable voltage switch)... I tried 1.5-5Vs, and the motor worked very well with all of the voltages.
I thought it would work with the PIC, because the voltage that I say from the output using my multimeter (from an output pin) was about 3-5 volts. And since I tested it with 1.5V (and it worked)... there is no reason for it not to with with the microchip. Yes, I am trying to supply directly from the chip -- is this a problem? And I am not so sure about the milliamps: is there any way to find out? |
|
|
|
|
|
|
(permalink) |
|
I dont understand what you mean about how a few AA in series would burn out the PIC since it can only take 5V max...the AA are only 1.5V each so you need to put a few in series...
You cannot connect a motor to the pins of a PIC. you need current AND voltage to drive a motor. Even though a PIC can provide 5V through the pins, it can only do so up to a few mA. If you draw more current than that from the PIC pins, the voltage will quickly drop to zero (and burn out the PIC). It's the same way a 12V, 20A power supply can only provide a maximum of 20A at 12V. If you draw more current than that out of the power supply, the voltage will start to drop. Even if a PIC could drive enough current to run a tiny tiny tiny, tiny, tiny, tiny motor, you don't want it to since motors are noisy and make voltage spikes that your PIC is not protected against. You need a driver circuit sitting between the PIC and motor to amplify the signal from the PIC into a larger current that can run the motor. This also means the PIC and the motor can be running off of different voltages (or even batteries). Last edited by dknguyen; 29th January 2007 at 02:27 AM. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Questions about a line following robot | mattg2k4 | Robotics Chat | 15 | Today 06:58 AM |
| need ckt for line following robot | anand_jain | Robotics Chat | 3 | 20th July 2008 06:10 PM |
| line follower robot program | UnD3aD | Robotics Chat | 2 | 23rd October 2007 08:13 AM |
| suggest me something that can upgrade line following robot | fatal_error | Robotics Chat | 6 | 26th August 2007 02:38 PM |
| Need help on black curved line tracking robot in | sunny0070 | Robotics Chat | 5 | 27th October 2003 03:43 AM |