Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: vipulan12 on June 01, 2013, 12:04:43 PM

Title: Photo resistor switch
Post by: vipulan12 on June 01, 2013, 12:04:43 PM
i want to turn on a motor using a photo resistor for a rube Goldberg project, can anyone give me some advice
i have the circuit i planned up but i am having a hard time to get it working(attached)
it could use any battery but for now i am using 4 AA batteries in series so 6 volts

the concept behind the circuit is to allow light to lower the resistance of the photo resistor using a LED, with the LED on the resistance becomes approx. 475 ohms, this is too high(Resistance) for my toy motor, so that is why I connected the battery parallel to the motor with a resistor to allow more current to flow but(here's the catch) i need to supply enough current so that when the LED is on, both the current from the photo resistor and the power from the normal resistor can turn the motor on

but keep in mind that when the LED is off the motor should not turn on since the current from the normal resistor shouldn't be enough to turn the motor on independently

if what i am saying isn't making sense reply and if you think this isn't going to work please tell me
i have been experimenting for a while and  i cant get this to work

thanks any comments  is appreciated

 
Title: Re: Photo resistor switch
Post by: johnwarfin on June 01, 2013, 12:40:00 PM
the led idea is sound but a transistor is needed to increase drive of the ldr enough to power a motor. putting another led in place of the motor would be a good test for now. but the ldr will not pass anywhere near enough current to run most motors at reasonable speed w/o amplification.

base to ldr, collector to +, emitter to motor.

that resistor wont do much except waste power and generate heat.
Title: Re: Photo resistor switch
Post by: waltr on June 01, 2013, 12:43:54 PM
I don't see either the battery or an LED in the circuit you posted.

How much current does the motor draw?
Having a largish series resistance with the motor may or may not work depending on the motor's current draw (remember Ohms Law, the Voltage drop = I *R).

You probably need a transistor to turn on the motor driven by the photo-cell.
Title: Re: Photo resistor switch
Post by: vipulan12 on June 01, 2013, 03:22:37 PM
i do have a couple of NPN transistors but i cant seem to find a datasheet ( 2N2222A338)
the battery is connected to the line where both the lines meet before the resistors
and i am not sure of the current draw but it needs approzimately 0.3 amps to run
Title: Re: Photo resistor switch
Post by: johnwarfin on June 01, 2013, 05:38:46 PM
2n2222 is good for almost an amp. most small motors draw less unless stalled.should be ok for testing.  fet is better because of lower on resistance.
Title: Re: Photo resistor switch
Post by: vipulan12 on June 01, 2013, 05:52:56 PM
can you send me the datasheet, i would really appreciate it thanks
Title: Re: Photo resistor switch
Post by: waltr on June 01, 2013, 10:13:57 PM
Just google "2N2222A" to find a data sheet. This is a very commonly available transistor.

Will it work? I would not know until you answer the question about the motor current.
Title: Re: Photo resistor switch
Post by: jwatte on June 01, 2013, 10:18:31 PM
Btw: I just finished some detectors for a position sensor for the slides in the airsoft guns on my robot today. I use an integrated LED/phototransistor sensor, and a potentiometer to set a reference voltage, and an opamp to output a clean 0V/5V signal. Works well for indoors environments without interference, although full-bright sunlight does white it out, and an IR remote can also trigger it.

The sensor is a TCRT1000, which costs about a dollar: http://www.digikey.com/product-search/en?WT.z_header=search_go&lang=en&site=us&keywords=751-1031-ND (http://www.digikey.com/product-search/en?WT.z_header=search_go&lang=en&site=us&keywords=751-1031-ND)

Here's the schematic:
(http://watte.net/detector-sch.png)

Here's the board layout:
(http://watte.net/detector-brd.png)

The board uses the top layer as a 5V pour, and the bottom layer as a GND pour, hence those traces aren't visible.

I don't think a 2N2222 is sufficient. I'd use a N-channel MOSFET. The IRLB8721 is good, for example. Hook the "detect" line to the gate of the MOSFET, the source of the MOSFET to GND, and the drain to one motor terminal; hook other motor terminal to positive voltage.

Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 11:32:29 AM
the motor needs 0.3 amps to run also can someone send me the datasheet  so i could use this transistor for other projects
Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 11:43:31 AM
the Beta would be nice
Title: Re: Photo resistor switch
Post by: waltr on June 02, 2013, 01:49:34 PM
Did you google 2N2222A?????
http://www.google.com/search?q=2n2222a&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox (http://www.google.com/search?q=2n2222a&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox)

I case you don't know how!
Title: Re: Photo resistor switch
Post by: jwatte on June 02, 2013, 01:50:16 PM
[strikethrough]2n2222 is limited at 200 mA.[/strikethrough] BS170 is "the same" but limited at 500 mA. BS170 should work. IRLB8721 can do up to 60A, so it's certainly capable for this project.

Edit: I was thinking of 2N7000, limited to 200 mA. 2N2222 is 500 mA, but watch the low maximum emitter-base voltage of 6V on that device! Also, it will get hot and waste current. I still prefer IRLB8721 for this.


Data sheets:
http://www.fairchildsemi.com/ds/BS/BS170.pdf (http://www.fairchildsemi.com/ds/BS/BS170.pdf)
http://www.irf.com/product-info/datasheets/data/irlb8721pbf.pdf (http://www.irf.com/product-info/datasheets/data/irlb8721pbf.pdf)
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00003223.pdf (http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00003223.pdf)

However, what does it even mean to "send you the data sheet"?
These links are a 5-second Google search away.
Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 02:13:20 PM
i meant to post it thanks for the data sheet
Title: Re: Photo resistor switch
Post by: johnwarfin on June 02, 2013, 02:23:58 PM
just about any transistor will drive that small motor. ratings are conservative. 2n2222 will handle over an amp in many cases. considering you have one on hand maybe time is better spent wiring as i described in 1st reply than fussing over specs on the internet.

Quote
ON Semiconductor 2N2222A: MIL-PRF-19500/255: 50V, 800mA ...
Quote

http://www.onsemi.com/PowerSolutions/product.do?id=2N2222A (http://www.onsemi.com/PowerSolutions/product.do?id=2N2222A)
Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 02:53:32 PM
should i worry about reverse voltage
Title: Re: Photo resistor switch
Post by: waltr on June 02, 2013, 03:22:53 PM
Any time you switch current on/off into an inductor you need to be concerned about the reverse EM 'kick'. So put a diode across the motor (inductor) to 'clamp' any reverse current from the collapsing EM field.
Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 04:40:14 PM
if the motor were to discharge from which motor lead would it discharge from the negative powered or positive powered one?
Title: Re: Photo resistor switch
Post by: jkerns on June 02, 2013, 05:08:15 PM
The flyback current created when the power is shut off flows in the reverse direction from when the motor is running. So you put the diode across the motor so that with power applied the diode is reverse biased and does not conduct.
Title: Re: Photo resistor switch
Post by: vipulan12 on June 02, 2013, 06:14:46 PM
i got it to work with the NPN transistor i had, thanks the advice
Title: Re: Photo resistor switch
Post by: johnwarfin on June 04, 2013, 05:24:09 PM
youre welcome. i do love happy endings.
Title: Re: Photo resistor switch
Post by: jkerns on June 06, 2013, 09:09:00 AM
Nice video showing the use of a flyback diode including o-scope traces with and without

http://youtu.be/LXGtE3X2k7Y (http://youtu.be/LXGtE3X2k7Y)
Title: Re: Photo resistor switch
Post by: johnwarfin on June 06, 2013, 10:07:14 AM
depending on supply and breakdown voltages those diodes may not be necessary. 1s lithium or 3s nixx usually well under the safety limit for modern devices. personally i dont bother even with 12v and never saw one fry. also note that popular fets like 2302, 2502, and 6401 already have built in diodes.
Title: Re: Photo resistor switch
Post by: jwatte on June 06, 2013, 12:34:36 PM
Quote
also note that popular fets like 2302, 2502, and 6401 already have built in diodes

I would express that differently -- any N-channel or P-channel enhancement or depletion mode MOSFET transistor will have a body diode function. This is because of how the device works. It's not a "built in diode" so much as the fact that a MOSFET transistor _is_ a kind of diode, where the gate control voltage allows you to make it conduct in the reverse direction as well.

However, in a single-ended application, the body diode of the MOSFET doesn't matter, because it doesn't straddle the motor. Only in H-bridge applications will the MOSFET body diode be active as a flyback diode, and even so, that will only lead it into the battery or other power source, rather than dissipating it right on the motor. (To actually do that in a bi-directional H-bridge, you'd need a synchronous rectifier, rather than a diode... seems like overkill to me :-)
Title: Re: Photo resistor switch
Post by: johnwarfin on June 06, 2013, 01:14:42 PM
no, not body diodes. modern fets like mentioned above are more like integrated circuits than descrete transistor/ there is an integrated back emf diode built-in. with significant area for real protection.

imo this is moot as i dont believe its a concern in most cases with small motors and low voltage batteries.
Title: Re: Photo resistor switch
Post by: jwatte on June 06, 2013, 04:32:18 PM
I don't see any mention of a diode other than the body diode in the data sheet for the 2302: http://www.vishay.com/docs/68645/si2302cd.pdf (http://www.vishay.com/docs/68645/si2302cd.pdf)
The diode conduction specs and voltage drops all look very consistent with typical body diode performance.
Where did you get the information that there is a separate diode added to the device, and where can I read more about it?
Title: Re: Photo resistor switch
Post by: johnwarfin on June 07, 2013, 09:51:39 AM
maybe we are having trouble with the term body diode. these are not accidental junctions resulting from process like you might find in a small signal device (2n7000, etc). the parts i listed have purpose built protection devices:

Quote
Body diodes may be utilized as freewheeling diodes for inductive loads in configurations such as H-bridge or half bridge. While these diodes usually have rather high forward voltage drop, they can handle large currents and are sufficient in many applications, reducing part count, and thus, device cost and board space.

http://en.wikipedia.org/wiki/Power_MOSFET#Body_diode (http://en.wikipedia.org/wiki/Power_MOSFET#Body_diode)

anyway my point was theres little need for additional protection diodes or other devices in this particular application. some high power setups might warrant it but imo not here.
Title: Re: Photo resistor switch
Post by: jwatte on June 07, 2013, 11:00:34 AM
Quote
Body diodes may be utilized as freewheeling diodes for inductive loads in configurations such as H-bridge or half bridge. While these diodes usually have rather high forward voltage drop, they can handle large currents and are sufficient in many applications, reducing part count, and thus, device cost and board space.

Yes, that is exactly the same body diode that *is* the transistor. There is nothing "acceidental" about it. This is why many MOSFET symbols actually put a diode right into the symbol for the MOSFET, as it is always an integral part of how it's made. Doesn't matter if it's a 2N7000 at 500 mA or a AUIRFS8408 at 100A; a MOSFET *is* a diode one way. This is not a separate "protection device" that the manufacturer puts on the die. Adding a diode that could stand the same kinds of currents as the MOSFET would significantly add to body capacitance, which would be a bad thing for the switching characteristics of the device.

Anyway, the important part is: A H-bridge does not manage the flyback voltage directly, other than leading it back into the battery/power source, because an H-bridge does not let the voltage through from one wire of the motor to the other. With sufficiently small motors or over-specified drivers, this doesn't matter.
Title: Re: Photo resistor switch
Post by: solak on July 31, 2013, 02:58:44 PM
It’s a really nice thread with a lot of information about how to drive a motor... I also agree that IRLB8721 would be the best choice to use as it will allow up to 44 A current to pass through it which would be really helpful here. But with 6V, I wouldn't try to get a lot of current in the circuit. Does anyone think that upgrading the voltage source, would be helpful? With just 6V, I guess the circuit won't start to look good when the current through the circuit becomes even 1A.

low volume pcb assembly (http://www.7pcb.co.uk/low-volume-pcb-assembly/)
Title: Re: Photo resistor switch
Post by: jwatte on July 31, 2013, 11:37:32 PM
Why does voltage matter to current handling capability?

If you have a voltage source with a low source impedance, then you can easily push 40 Amps with 6V. If you look at high-capacity LiPo batteries used for small quadcopters etc, you will find batteries with capability of sourcing up to 100A, at a nominal voltage of 3.7A. Not for a very long time, as the energy stored will be depleted (the battery will be discharged,) but for long enough that you can fly for potentially several minutes at max load.

Also, the IRLB is nice because it has a "logic level gate." It gets most of its conductive capacity when the gate is 4.5V above the source, so 6V is quite sufficient to turn it "on."

Finally, if the motor described in this thread is specified for 300 mA "to run," that says nothing about the "stall" current. If there is load on the motor, it may draw a large multiple of the "free running" current. (like 10x or more)

Ohm's law is pretty amazing. If you understand the concept of source impedance in batteries, and on resistance in MOSFETs, and current draw in motors, you can write out all the math and understand exactly how the circuit will behave! (Well, you need to know Ohm's law, AND be able to do multiplication and division -- but that's still something I think everyone can do!)