Instructables
Picture of Simple Light Switch
In building Simple Bots, we are going to use a series of photo-coupled devices called modules. But, before we can do this, we need a good photo-couple to use as a light-activated switch. To make one of these switches, we will be using a special OSRAM-brand photo transistor and any standard NPN transistor (like a 2N2222, 2N3904, BC546, etc.). These switches will allow the motor to spin in direct correlatoin to how much light it senses. In other words, the more light, the faster the motor goes and the less light, the slower.
 
Remove these adsRemove these ads by Signing Up

Step 1: Go get stuff

Picture of Go get stuff
You will need:

(x1) OSRAM-brand photo transistor
(x1) NPN transistor

Step 2: Line up

Picture of Line up

Lay the phototransistor atop the NPN transistor such that the base of the NPN transistor aligns with the emitter (longer leg) of the phototransistor and the collector of the NPN transistor aligns with the collector of the phototransistor.

Step 3: Twist

Picture of Twist

Twist together each lined-up pair of NPN transistor and phototransistor leads.

Step 4: Solder

Picture of Solder
4F.jpg

Solder together the connections of each twisted pair of transistor leads.

Step 5: Trim

Picture of Trim

Trim the middle pair of wires such that it is shorter, but the connection between the base of the NPN transistor and the emitter of the phototransistor remain soldered together.
jbates138 months ago
will this work to power leds?
randofo (author)  jbates138 months ago
I would guess it should. Not 100% sure though.
cruisetom9510 months ago
Any other substituent for osram based phototransistor? Thanks
Wareneutron2 years ago
it is so helpful to me!!!
now i know more on sensors
!!
Krayzi992 years ago
Wow. I hate to see what this would look like if I did this. SOLDER BLOBS IN MEH EYES!
codongolev2 years ago
very clean. while I like circuit boards for organization, free-form circuitry is always really cool when you can pull it off.
seraine2 years ago
If I make this light switch, which lead would I attach to the load and which would I attach to the power?
rimar20002 years ago
Randy, this is very interesting, but lacks some explanations for those as me, that are almost absolutely ignorant in electronics. Please add a circuit of how it is connected to activate a motor.

How many volts can it handle? How many watts?

When I redo my solar cooker, this can be a very simple device to keep it aligned with the sun. The cooker will have equatorial mount, so with only one movement, only one motor, it will be aligned.  That can be done easily putting your light switch into a black tube, or behind a black screen for when clouds hide the sun for a while.
Don't expect too much current handling for to92 packages. The most usual are 100-200mA (to92 with metallic can reach 800mA). Voltages are variable, usually around 40V in C-E.
But they are hard to be cooled and these parameters usually are the maximum.

More flexibility can be achieve with the to220 packages, usually TIP series, for example... there're many different types of transistors for resuming here xD
Thanks for the data, gomibakou. I want use it to feed a 12V motor with reductor, those used in car glass lifts. I think the intake is not so high.

Do you suggest to replace the Phototransistor? Forgive my ignorance.
The phototransistor works in this example like a "current regulator". The transistor works in saturation but the saturation current depends on the current in the base. Because the phototransistor varies it's output current with the light, then the main transistor will vary it's outoput current with the light, indirectly.

This is important because the phototransistor current will determinate the transistor current across it's gain.

http://www.instructables.com/id/How-Electronic-Switches-Work-For-Noobs-Relays-and
http://www.instructables.com/id/Simple-Transistor-Switch

Basicly any transistor can handle 12V. The problem is the current. You should measure this current in different stages: when the motor is moving freely, moving with load and when it's stalled. The worst case is when it's stalled (max resistence max current consumption), because the transistor will have to deal with such currents.

For example a small DC 5V motor while moving freely can drain few mA (for example 100mA), but when it has a load current increases and if you stop it, then it can reach easily 5 or 10 times more current (depends on the motor).

You also have to keep in mind the peaks. When motor starts moving it has high currents (the same when the motor stops due to the energy kept in the coils), and it can destroy easily the transistor, solution is easy: protection diodes like used in the relays.

For transistor, it's hard to find one here and the most common is the BPW40, i think it's easy to find over any country. But you need to keep it protected from light sources because it's very sensitive.


In this site, recommended for all newbie phanatics on robotics you can find some information/experiments really easy:

http://www.robotroom.com/HBridge.html
http://www.x-robotics.com (spanish)

Also you could use RELAYs, and add a circuit to trigger the relay (just a transistor to supply the few mA the relay needs to perfom its action), a common circuit easy to find.

All depends on what you need: high speed of conmutation? transistor, high current? power transistor + heatsink or relay, speed control? transistor, ... ...

For example, the BC457 can handle aprox. 40V and 100mA (teorically xDDD). Really it can handle that but it starts working in the non linear zone then it can have a strange behaviour sometimes. It's safe to buy a transistor capable of deal the double currento you need: if you need 100mA then buy one of 200mA at least (and surely will have more protection against surges).

I'd try first to know how much current your motor drains... it's the key. Connect a multimeter in current mode to the motor (i say if you don't know:

[Motor +] -----------------------------------------------------------VCC
[Motor - ] ----------[red probe] [black probe]----------GND

And measure the current, when it is stopped and starts (if you have time to see!! xDD), in nominal operation, when it has a load, and when you force it to stop. Think if someday the window gets stuck, and you didn't prepare your circuit against it, then you'll fry it sure.

Knowing the Voltage (12V), and Max current (protection diodes helps to minimize peaks even a startup capacitor), calculate the power dissipation. With these data you can find a suitable transistor (or relay if better in the situation). Take the datasheet and calculate the necesary data to make the transistor work in saturation (google: transistor like switch).

As i learnt recently (humans never learnt), do things step by step. Avoid using a phototransistor as switch because they can be little tricky (specially if you didn't read the datasheet before). Test your circuit with a normal switch. When working as expected then you can add the phototransistor.

Recently i had to redesign and make new pcbs, after having a finished circuit for not following my own rule, all after testing again in a breadboard... a waste of time. Lesson learnt? dunno only time will tell :D
WOW, this is an exhaustive explanation! Thanks, I will study it tonight.
One thing more... i was talking about BJT transistors, but usually for high current MOSFET are a good deal, they can manage more current at lower price but:

1-mosfet are driven by voltage instead current (bjt).
2-the ON umbral is really wide. It can vary from 0.7-3V easily. You should apply a voltage over it to make the transistor working in saturation (for the example). With BJT the voltage is usually 0.7-1V.
3-mosfet are quite sensitive to ESD (electrostatic discharge). Many of them have built-in protection diodes (i talked about them in previous post), otherwise it's wise adding them.
4-As bjt there're 2 kinds: N and P (channel). P are really expensive in comparation with N. There are some tricks to use N mosfet as P (or very close).
5-Mosfet introduces a resistence when they are ON. it can be important or not...

6- Chek the BS170, common N-channel Mosfet.

http://www.fairchildsemi.com/ds/BS/BS170.pdf

Params: 500 mA, 60 Volts, RDS(on) = 5.0 Ohm. Max ratins of course.
About $0,10. It can control easily a standard futaba 3003 RC servo.

7- Oh, and one important thing: take care of commutation speed. Mosfet can become really hot if they switch fast, burning and you won't realize why. It's not an issue for what i think you need, but it's important for speed control for example.

Normally for motor driving MOSFET are used because their current capabilities. So if you look for motor control you will see the mosfet are widely used.

ah, it's not exhaustive... really it's far beyond of being exhaustive. It's a mix, an overviewl about the most common points that you will face.

OK, thanks.

For my knowledge, this is very exhaustive, yes.

I know that transistors are those little black things, normally soldered on a little board...
hehe ok.

If you can deal with English, in this site there is nice information to start, simple, accurate, with pictures and basic examples:

http://www.electronics-tutorials.ws/transistor/tran_1.html

(you can select 8 pages of tutorial).

Buy a bunch of NPN and PNP general purpose transistors and play!

Ouf, i found this site (i never knew it before) and looks great!

http://alltransistors.com/

Big dabase for many transistors, with multiple languages :)
Thanks, gomibakou. Your info is very valuable, despite my "yes Bwana" English.

Electronics is one of the many things I would like to know, but I'm too lazy to learn. Maybe next winter (here in south it is coming) I decide to study a little.

Don't know electronics today is almost as don't know to read.

Hi rimar2000;

Take a look at this solar cooker solar tracker:

http://www.redrok.com/electron.htm#ledcooker3

http://www.instructables.com/files/deriv/FCG/4P2R/H1YOHJLW/FCG4P2RH1YOHJLW.THUMB.jpg

This circuit is perfect for use with solar cookers with relatively small motors.
It can be powered with batteries or a small solar panel.

Duane
ledcooker3.png
OK, thanks very much. I will keep them in account when do my equatorialyl mounted solar cooking. It will use only one motor.
andyk752 years ago
Very good idea! Simple, robust and cheap!
But you should include a schematics for people using different transistors. And maybe a hint to figure out which leg on a transistor is what. Not all transistors have the same C-B-E ordering of their legs!
Jayefuu2 years ago
You have are have a mistake in the first sentence :)

James
seraine2 years ago
When I look at the link, it appears that the photo transistor is out of stock. Is there any others I could use, and what properties make that phototransistor the correct one?
randofo (author)  seraine2 years ago
I am not sure about a suitable replacement, but what made that one ideal is that it had it was very responsive in the visible light spectrum. Most of these are fine-tuned for IR.
randofo (author)  randofo2 years ago
Perhaps try this one: http://www.mouser.com/ProductDetail/OSRAM-Opto-Semiconductors/SFH-314/?qs=K5ta8V%252bWhtbR6gV8hNfmATd6ftDkb0eH0AduyQe8MSk%3d

Its datasheet places it at 460 nm to 1080 nm
dagob2 years ago
Does it need to be the "OSRAM-brand photo transistor"? Why not any LDR? Thanks, I'll keep it in my favorites
randofo (author)  dagob2 years ago
A photoresistor is going to require more additional circuitry to work.
wirenut19802 years ago
Great idea! Simple, easy and practical!