- #36
NascentOxygen
Staff Emeritus
Science Advisor
- 9,242
- 1,074
Only one resistor. It's R1 that soaks up the spare voltage (and in the process sets the circuit current). Don't put a resistor where you show R2.
Other than that, it is fine? What about the output of the arduino. Should I limit the milliamps or voltage going into the transistor? And does the voltage going into the base affect the current/voltage going through.NascentOxygen said:Only one resistor. It's R1 that soaks up the spare voltage (and in the process sets the circuit current). Don't put a resistor where you show R2.
Oh, I see what you were up to. Yes, you'll probably need a resistor in series with the base to limit the current from the Arduino. So you had just shown it in the wrong place. How many volts will the port deliver for output HIGH? Anyway, choose R to limit the base current to about 3 or 4mA.HeyAwesomePeopl said:Other than that, it is fine? What about the output of the arduino. Should I limit the milliamps or voltage going into the transistor? And does the voltage going into the base affect the current/voltage going through.
NascentOxygen said:Oh, I see what you were up to. Yes, you'll probably need a resistor in series with the base to limit the current from the Arduino. So you had just shown it in the wrong place. How many volts will the port deliver for output HIGH? Anyway, choose R to limit the base current to about 3 or 4mA.
What is the maximum current the Arduino port can supply?
0V of supply, the output of the transistor?NascentOxygen said:Are you definitely going to power the Arduino board from the same voltage source as the LED array? If so, as well as connecting the +12V to the Arduino, you need to connect the 0V of the supply to the 0V of the Arduino board. It might be labelled GND or (-).
The emitter of the transistor, which is also the 0V of the power supply, connects to the 0V of the Arduino.HeyAwesomePeopl said:0V of supply, the output of the transistor?
The transistor base won't need that much current. Around 4mA will do.HeyAwesomePeopl said:Using the 3.3 volt output of the arduino, a 100Ω would make it 0.033 amps
There is a 3.3 and 5 volt version boards. In this case its 5 voltsNascentOxygen said:The emitter of the transistor, which is also the 0V of the power supply, connects to the 0V of the Arduino.
The output is 3.3V or 5V ... how does it choose?
So using a 5 volt board, it would come out 4.4 volts, and to get it around 4 milliamps (3.8 milliamps) it needs a 1200Ω resistor.NascentOxygen said:The transistor base won't need that much current. Around 4mA will do.
The base uses 0.6V, so that leaves 2.7V across the base resistor. You can calculate the Ohms needed from that.
Sounds good. Are you going to update your circuit diagram now?HeyAwesomePeopl said:So using a 5 volt board, it would come out 4.4 volts, and to get it around 4 milliamps (3.8 milliamps) it needs a 1200Ω resistor.
Updated diagram with 3 colors of LEDs and correct resistors:NascentOxygen said:Sounds good. Are you going to update your circuit diagram now?
With the reds figured out, have you researched how many volts you'll see across your green and yellow LEDs? When you do this, you may decide to go with just 3 LEDs of each colour. :)
Why 3? 5 too many? They are pretty cheap at 5 for a buck.NascentOxygen said:When you do this, you may decide to go with just 3 LEDs of each colour. :)
Thanks. I used the data sheet to provide the recommended voltage and amperage per LED type. The Luminous Intensity varies for the LED colour, and would have to overamp/volt the LEDs which could significantly reduce life expectancy.NascentOxygen said:I was thinking over 3V drop for one colour, but just checked and that's for whites.
You might end up tweaking the LED resistors, anyway, if it seems one colour is too bright in comparison with the others.
Don't forget to connect the power supply gnd to the circuit's gnd.
Good luck!
The power to the board is a 2.1mm plug. That is why I question you plugging everything into the boards ground. The boards ground is usually only used if you use the boards 5V power pins.NascentOxygen said:Instead of making the dimmer LEDs brighter, you could make the over-bright ones dimmer.
I wasn't talking about mains ground. I meant the "negative" terminal of the 12V supply should be connected to the negative or ground on the Arduino board and your LED board.
The 2222 transistor will be okay. It's always a good idea to place a finger on these switching transistors when you first switch the power on, they should not get even warm. If they get noticeably warm, you've made a wiring or design blunder.
Confused. Like this?NascentOxygen said:You can connect the LED board directly to the +12 and 0V terminals of the supply, and connect the Arduino's plug to the two terminals of the supply also.
That one line includes a postive and negative. It's kinda confusing, I cannot seem to split the line.NascentOxygen said:Two wires from the 12VDC supply have to go to the Arduino. You show only one, and it's +12V so should not be going to GND.
Oh yes, I just forgot to remove that. Each "+5" sign resembles another pin used. In this case, I am using 3, one for each color.NascentOxygen said:Separate question: you show something going to pin 5 of the board. You need the base resistors to each connect to a different pin on the board. Do you have this sorted? You seem to have the base resistors going to a constant +5V on the board---this would keep the LEDs lit all the time, not under software control.
And 56 replies later, I have a solution! Thanks for everything.NascentOxygen said:
Haha I won't. It'll be a few weeks until I get the parts in.NascentOxygen said:Better not close this thread 'till you have it working ...
No. I suggest that you use resistors rated at at least 3 times the power you will require they dissipate. Some of your higher value resistors will dissipate close to 0.5 watts, so you should use nothing less than 1.5W. I guess this means going for 2W.HeyAwesomePeopl said:Just to confirm, to calculate the wattage rating I should get for the resistors, I should use P = I^2 * R which is Watts = Current^2 * Resistance. In this case, I would just need a half watt for this circuit.
Thanks. The Arduino chip will send a 5volt, 40mA signal when I program it to, triggering the transistor.Windadct said:Kudos for your diagrams - they are the language of electronics! ( Edit - not that they are perfect or follow the best practices(still good) , but that you took the time to do them with a proper schematic tool...)
Now how does it turn on and off:)
NascentOxygen said:No. I suggest that you use resistors rated at at least 3 times the power you will require they dissipate. Some of your higher value resistors will dissipate close to 0.5 watts, so you should use nothing less than 1.5W. I guess this means going for 2W.
If you were to divide your LEDs up into strings of 3 LEDs and 2 LEDs you might need only 1W resistors. Do the math!
(An alternative to a single 2W resistor is to use 3 resistors, either: each 0.5W but 3 times the Ohms that you need all in parallel,
or
each 0.5W but one-third the Ohms you calculate, connected in series. Or something equivalent.)
Like I said, I am new to all this stuff. So this is really helping. But one thing I thought the transistor was to do was to act as a switch for the leds. The transistor would complete the circuit when it is provided a current. Isn't that what I did?Windadct said:Hap..
Not really to criticize -- the Arduino is a micro-controller(uC) platform ( easier to just say Arduin) - They are based on a chip - like ATmega328... just guidance...
The output is 5V, but the 40mA is based on the load think 40mA MAX ( it will not "force" 40mA) - the reason I make this distinction is when you look at the ATmega320 datasheet ( or which ever one is for your version of Arduino) the actual chip can put out a Max 40mA in one GPIO ( general purpose Input Output) - but the chip I think has a Max total of 200mA - so what does that mean? you can run 5 BPIO at 40mA - or 15 at 13mA etc.. -- but I would not advise it... as a general rule of thumb - if you are communicating (logic / signals) no problem - but almost any load ( think work..light, sound, motor etc) - use some type of a switch where arduino ( or any uC - including chips) is the control but not the source of the power to drive the load.
That makes sense. I'll be sure to keep that in mind with later projects.Windadct said:As for why should the resistor have 3x the power rating -- you generally can not predict everything the system will see ( experience) over time - one period of extreme conditions and the system will die. However for this case ( 1 pc build, LED load, non-critical application) I think 3 x is probably more then you need. It can also be considered what is the consequence if this resistor dies... LEDs and the Transitor-- worst case... I would be comfortable with 2 x or less. Above 1 W resistors tend to get expensive.
Yes that is the plan, to use an ultrasonic sensor and PIR to watch for movement, then turn on LEDs.NascentOxygen said:Presumably the 12V to the LEDs and to the Arduino will be present all the time (at least until this guidance system is no longer needed). This will be switched off at the wall power outlet, if ever it need be.
Do you intend having all LEDs off until a vehicle is detected entering by the ultrasonic sensor? Is that the plan?
The reason will under-rating resistors is so that the board and nearby components are not troubled by heat.
Oh I see, a photoTRANSISOR. Turn everything on when a light source is detected. Yes, I will do this then, it would be better.Windadct said:I was thinking to use a photo-transistor to power up the arduino. Basically the system sits near zero energy state until there is light - from garage light, headlights - daylight - etc.
NascentOxygen said:...
Okay I got some help from the forums over at the Arduino website. They helped me fix my diagrams and helped with more specific data. Here is my current diagram:Windadct said:...
Try this: https://www.dropbox.com/s/itfpuxfn903zw5p/Stoplight-Project-2 (4).png?dl=0NascentOxygen said:Pic: ERROR 403
probably requires a login