Check Ohm's law.
V=IR, so the resistor you choose is the voltage you provide to the LED divided by the current it draws.
e.g. if the LED draws 20mA and you power it from 5V, then the resistor you need is 5/0.02 = 250 ohms in series with the LED. This current is drawn from the positive voltage supply through the resistor and then the LED, and then the transistor.
This is a fairly good tutorial: http://www.ehobbycorner.com/pages/tut_transistors.html
Ninja Jamm - a revolutionary new music remix app from Ninja Tune and Seeper, for iPhone and iPad http://www.ninjajamm.com/
Gemnotes-0.2: Live music notation for Pure Data, now with dynamics! http://sharktracks.co.uk/
From: Charles Z Henry czhenry@gmail.com To: Epic Jefferson jeffreyconcepcion@gmail.com Cc: pd-list pd-list@iem.at Sent: Wednesday, 7 August 2013, 20:41 Subject: Re: [PD] electro-mechanical piano (player piano) - Arduino, Solenoid Issue
On Wed, Aug 7, 2013 at 12:05 AM, Epic Jefferson jeffreyconcepcion@gmail.com wrote:
Hey Charles,
it seems like this might work. i got some pnp transistors and built the circuit from julianvogels site. The only problem is that the LED on the test circuit barely lit up. I think it's because the transistors are not for 20mA, none were available. i'll check another electronics store to see if i find some.
I think you just need smaller resistors. Every transistor in a 3-pin package I've ever seen could run 20mA or much greater. Swapping the transistors will have no effect on the amount of current.
Chuck
There are two ways to solve your problem:
The proper one is to use PNP transistors or P-channel mosfets (remember I already told you about that ? :))
See this document, you can find the wiring at the end: http://julianvogels.de/wp-content/uploads/2013/06/stromkreis_transistorschal...
http://julianvogels.de/extending-pwm-output-pins-with-a-texas-instruments-tl...
The good enough one is to put a pull-up resistor (10k works) on every NPN transistor base, and use the TLC as a pull down. In this case, the on-time on the TLC corresponds to the off-time on the solenoid. Also when the arduino reboots and every time the BLANK is issued, every solenoid will act for a veeeeery short time. This can be a big problem in your project. I did this for a 96 channels motor+led strip system, and I regret not using PNPs instead.
Enjoy,
-- Charles
Epic Jefferson wrote:
Hey guys,
updating on this project. I got the pwm shields and i've hit a wall. The driver circuit I'm using to control the solenoids via arduino is this one from instructables (linkhttp://www.instructables.com/id/Controlling-solenoids-with-arduino/))
and it uses a single pin to control the pwm signal.
The pwm shield (linkhttp://www.practicalmaker.com/products/arduino-shields/pwm-shield-assembled)
is based on the tlc5940 which requires each pin to have it's own ground instead of a common ground across all drivers. This is a problem because all of the information i've found suggest that the signal from the pin controls the gate (transistor - TIP102). But i think, in the case of the tlc5940, the 5v supply is constant and the ground is being controlled, that's why it works perfectly for LED's but seems to be ill suited for this circuit.
Any suggestions on how to modify the instructables circuit for use with the shields? or would the circuit have to completely change?
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- www.epicjefferson.com www.avmachinists.org Puerto Rico based Art Collective/ Non-Profit Org _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list