Re: Piano Stairs Project Update
We don't have a tutorial, but I'll be happy to help you out.
A transistor is like an electronically-controlled resistor, but we talk about it in terms of its 'conductance' rather than its resistance.. how much current can flow through it, rather than the amount of current that corresponds to a specific voltage.
A transistor has three terminals called the 'collector', 'emitter', and 'base'. There are two current paths through it: one between the base and emitter (the 'BE' path), and one between the collector and emitter (the 'CE' path). Since the emitter connects to both other terminals, we usually just talk about 'base current' (I.b) and 'collector current' (I.c).
A transistor's collector current is proportional to the base current.. for today's transistors, I.c is usually about 100 times as large as I.b. If you send 1mA through the base, up to 100mA can flow through the collector.
Transistors are made from silicon though, and silicon is a photovoltaic material.. if you shine light on it, you get current. Early on, researchers discovered that shining light on a transistor would generate a small amount of base current, thus allowing a much larger collector current to flow. For normal transistors that's a problem, so the silicon has to be encapsulated in an opaque container. Sometimes that's useful though, so we have chips specifically designed to do that well, called phototransistors.
In practical terms, almost no current flows through a phototransistor in the dark.. the effective resistance is around 10 megohms. When light shines on it, up to about 20mA can flow through. Assuming a 5v supply, the effective resistance would be about 250 ohms. It would be about 500 ohms for a 10v supply, and only 50 ohms for a 1v supply, so a transistor's conductance doesn't obey the same V=IR rules as a regular resistor.
To use a phototransistor, put it in a voltage divider like this:
When no light falls on the phototransistor, the output will be HIGH. When light shines on it, the output will go LOW. To use it with a microcontroller, treat it like a pushbutton switch with a pull-up resistor.
You can adjust the sensitivity of the sensor by changing the value of the upper resistor. The 100k value shown above falls in the midrange. If you use a higher value, it will take less light to swing the output from HIGH to LOW. If you use a lower value, it will take more light.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.