Author
Topic: Light sensor and brake mode (Read 2637 times)

I am working on a small robot car at the moment, my prototype works well but I want some more speed. The car starts and stops with a simple micro switch (stopping switch turns off motor when the car impacts the end of the track). When I speed the car up I think I will have trouble stopping it safely within the track. I was wondering if I could install a light sensor that would detect a 3mm black line on the track and switch off the motor and possibly put the motor into a brake mode to slow the car down. I have been doing some searching and have found this for the light sensor.

Im a little unsure if this will work as this is my first attempt, I am keen to buy the parts and wire it up but I don't know if this will actually work. I am hoping to get the robot to move along a 1.2m (4ft) track in about 2-3 seconds so the light sensor will need to be pretty responsiveCan you help me out with any possible options or ideas?

i dunno if that would work for sensing a line to well as ambient light could get in, have you considered a small bump in the track and a microswitch underneath the car so the bump pushes the microswitch in? also have you considered using a microcontroller?

I am working on a small robot car at the moment, my prototype works well but I want some more speed. The car starts and stops with a simple micro switch (stopping switch turns off motor when the car impacts the end of the track). When I speed the car up I think I will have trouble stopping it safely within the track.

You could have the circuit wired so that when you switch it off, the motor is shunted.If you have the switch on the underside, a cam on the track could switch it off and this cam could be positioned a bit before the end of the track.

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

The ambient light could be a problem I think I know what you mean, would using a infra-red light source work? kind of like lego mindstorm sensor..

The bump in the track is a good idea but but I would like to work on this as a optical problem as the track that im using is just a simple piece of ply wood, it has a raised edge that Im currently using to trigger the micro switches to break the motor circuit. I suppose I am looking to understand how a optical sensor works and how a dc motor can be used as a brake...

Using a microcontroller, what would that involve? it sounds interesting, would it help with using a optical sensor?

well if you are just after a quick stop moving type thing a microcontroller will not be needed, and infared is an option, you could have a row of infared leds built into the "track" and an infared photo transistor one the bottom of your car maybe?

yes but therein lies a problem with your idea, the motor will only be stopped while it detects the light. so as soo as it passes the led the motors will reengage and keep going, one way to solve this problem is to use a strip of leds so the sensor is seeing leds until it comes to a halt. but this would require a fair few leds as if you had a line with too few leds the motor would constantly be switching on and off producing a kind of "jerky motion".

the other option which i described before was to use a microcontroller. now this option requires you to know a few programming basics. which in turn would be good for you if you decided to get into robotics ever. pretty much you will have your motors hooked up to a driver then to the mcu's digital outputs. then you would have a phototransistor or photodiode hooked up to the mcu's analogue input you may also need a comparator but i dont know much about them

then you will program your mcu to read the analogue pin and if there is a value high (which means it found the led) to stop pulsing the motors. although the second setup is more expensive it is worth it if you intent on building some robots later on, and not to mention more reliable eh?

They could also have it set up so once the relay is tripped it just stays that way until it is reset by a switch. Which would avoid having to use a microcontroller. Would need a single pole double throw relay so the normally closed goes to the motor and the normally open will feed back to the coil through a momentary normally closed switch (reset). That way when the relay is tripped by the circuit sensing the infrared it will stay energized until the momentary switch is pressed. Might need a diode or something to keep from feeding power back into the light sensing circuit. I'm not sure about that but I'm sure someone here can answer that part. I also don't see why a similar setup to a line follower wouldn't work just instead of following a line once the line is no longer present the brakes are applied. That way it's all contained in the vehicle. Course you would probably want a line wider than 3mm.

So, if I can get a sensor to trip the relay I could wire it into a "lock out relay". This sounds good to me...

I am looking at getting some of the gear together to do this as I should be able to make this work. Do I simply wire up the light sensor (with a distinct line on the track) like this one, http://www.reuk.co.uk/LM741-Light-Dark-Sensor-Circuit.htm and then for the brake do I wire up the relay to short the motor terminals?? im a little unsure of how to design the motor brake, do I need to incorporate any electronics or is it a dead short across the motor terminals?

To use the motor as a break which is the whole point I believe he does need to short the motor terminals (someone please correct me if I'm mistaken)

Quote

just use a normally closed relay and when it gets power across its poles if opens thus shutting off the circuit.

I believe he needs a single pole double throw relay and not just a normally closed relay else the relay can't keep itself energized (again someone please correct me if I'm mistaken)

brad the circuit you linked to uses an LDR I'm pretty sure a photodiode or phototransistor circuit would be more suited but that would be best answered by someone more experience. they may even have a better solution than the relay.

The basic concept of this is that if you short the power and ground leads of your motor, the inductance created by your motor in one direction will power your motor in the opposite direction. Although your motor will still rotate, it will greatly resist the rotation.

Thanks for the advice, I think i'll have a chat with some of the guys at the local electronics store. I'll take in a few schematics and see if I can source a phototransistor / photodiode for infra-red and visible LEDs and get the parts to test the circuit.

I'll try to keep the sensor (and maybe a LED light source) on the robot and make the finish line as thick as I need for the sensor to work consistently. If anyone has a link to a circuit that would work for me that would be appreciated. I have found this which has gotten me a little excited http://www.discovercircuits.com/DJ-Circuits/fastphotonpn.htm but i'll need to modify it (which might be tricky) to incorporate the SPDT relay (and motor)

Thanks again for your help , as soon as I get this working i'll be sure to put up the schematic and some photos/video of the robot if this would be helpfull to anyone else.

the bottom left one looks like it may work, and it looks like the easiest one besides the first. ill take a look at it and see if i can find the easiest way to include that setup madchimp said. but wait, does the voltage drop when it senses something?

Thanks SmAsh, I think the voltage may drop when it senses light??? (i could be wrong on this) but if it increases voltage when it senses darkness then this may be what im after... low voltage when it senses light, and then energises the relay when it detects the finish line..

see the photo i attached, the squiggly line is the signal line, i "think" the 5V is the before and the 2V is the after. like 5V is before the sensor detects something and the 2v is when i detects as there is an output change. what we want for the relays is the opposite, we want the voltage to increase so it can power the relay.