an Arduino Duemilanove & Transistor Question?

Discussion in 'The Projects Forum' started by quant, Nov 4, 2009.

  1. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Hi,

    Please help me understand the following...

    I have hooked up the following circuit:
    1- 9V supply through an R to the cathod side of an LED.
    2- The Anode side of the Led to pin 1(Collector) of a C547B Transistor.
    3- Arduino Duemilanove Pin 13 to Pin 2(Base) of the sam Transistor.
    4- the Ground of 9V source and the Ground of Arduino to Emitter of the Trans.
    5- When the Arduino Pin 13 is Set to high, the LED Lights.

    Questions:

    A) Why is the Arduino pin sending just 1.15 V? Isn't it supposed to be 5V?
    B) The Voltage at Tr. pins 1(collector) and 3(emitter) is 9V when the LED is off and 0 when lit, please explain the process... is it like with Base at 0V, the voltage is being held at the Tr. gates hence the 9V and when the Base is powered the gates open and the current flows to the LED and so the voltage at collector pin falls to Zero? That was a lot of making up I just did... whats the real story though?

    thanks
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    Do you have a resistor between the pin of the controller and the base of the transistor?
    If not the base current will be to high and can even break the transistor and / or controller.

    Greetings,
    Bertus
     
  3. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Nooooooooo I did NOT!
    I just turned it off and will do it and report back.
    What size R please?
    thanks
     
  4. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    What is the current of the led?
    The base current must be about 1/10th of that current.
    I think a 2.2 k resistor will do.

    Greetings,
    Bertus
     
  5. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Hi bertus,

    Thanks for the advice, no wonder I had already gone through about a dozen Tr.s already!

    I added the 2.2k R. and the Controller's pin Voltage is at about 5V now, thanks to you.

    The LED voltage is as before 9.6V when off and 0V when on(High), is that correct?

    thanks
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    Can you draw a schematic now?

    Greetings,
    Bertus
     
  7. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    OK, let me go to work on that.
    thanks
     
  8. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    OK, here it is and excuse the mess... my very first circuit drawing!

    [​IMG]
     
    Last edited: Nov 4, 2009
  9. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    Your explanation of the operation of the transistors in post #1 is pretty close.

    When the output pin of the Arduino goes HIGH, 5V, a current is generated into the base of the transistor. The current in the base of the transistor activates a current path through the collector and emitter. When using the transistor as a switch, the voltage on the collector gets close to 0V, the emitter voltage. Current is drawn through the LED to turn it ON.

    When the Arduino pin goes LOW, 0V, there is no current being injected into the base of the transistor. Therefore, no current is allowed to flow through the collector to emitter path. The voltage at the collector will be 9V and the LED remains OFF.

    There is a basic transistor explanation for its use in your circuit. Pretty close to what you said. For more details on the operation of a transistor, refer to the AAC book...

    http://www.allaboutcircuits.com/vol_3/chpt_4/index.html
     
  10. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Thanks a lot for the link and confirming my concept of the Transistors.

    How about my circuit? Does that look about right?
    Although it works just fine but, I need to know so I could move on to the next part which would be replacing the LED with a Solenoid and adding the relevant Diode to it.

    appreciate your help
     
  11. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Please find below the new circuit including the 24V 2.6A Solenoid.
    Please verify if it's about right or not and appreciate it very much if the specs on the followings could be provided too:

    1- Diode D.
    2- Transistor Q1.
    3- Relative Relays.

    very much appreciate your help in advance.

    [​IMG]
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    D2 in your schematic should be pointing the other direction to shunt the kickback from the inductor in the solenoid.

    In addition, the current orientation, D2 would turn on before D1 (The LED), so the LED and solenoid would never turn on. Reason for this is the VF of a standard silicon diode is around 0.6V, while the VF of an LED is 2-3.5V. For the same reasons your Arduino output showed the 0.6V when connected directly to the base of the transistor, the LED wouldn't get the required voltage to illuminate.


    The real requirement for D2 is to shunt (short out) the kickback from the inductor when it is turned off. When a coil is de-energized, the magnetic field around it collapses rapidly, inducing a voltage in the coil, often tens of volts. This is polarity reversed from the current previously
    flowing, hence the "backwards" insertion of the diode, with the cathode towards the positive supply.

    Finally, you may want the LED and it's current limiting resistor in parallel with the solenoid, rather than the solenoid in series with the current limiting resistor for the LED. With limited current, the solenoid (or relay) may not fully engage.
     
  13. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Hi,

    Thanks so much for your comprehensive explanations.
    Below is the corrected version according to my understanding and I have also added an OptoCoupler. Hope I am not too wrong?

    [​IMG]
     
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Close, optocoupler isn't necessary as shown.

    In the solenoid to Collector of Transistor, Swap the LED and its current limiting Resistor (330) with the coil and diode (which is in the correct direction). The LED & Current limiting resistor should be in parallel with the coil, otherwise, the resistor will limit the current to the coil as well.

    Also, with the change to 24V, you may want to use a 1.5k resistor in series with the LED so it doesn't fry from overcurrent using the current 330 Ohm. Most "Bright" LEDs (clear case) can handle about 20mA, using ohm's law: 24V/20mA=1.2k for the resistor, or the next higher standard value that is handy, up to 5k would work, but the LED would be dimmer. If you have an LED that is colored, the maximum current is usually around 8-10mA, so in that case, the resistor should be 2.4k-3.3k.

    I'd fix the schematic for you, but you seem to have it down and are very quick at it for just starting! :)

    --ETA: Just noticed the solenoid draws 2.6Amps. Is that correct? If so, Another transitor may be necessary, as the microcontroller cannot output 300mA to switch a single transistor for 3 Amps. Most all small signal transistors are only rated for .8-1A at most, with the average around 0.5A.
     
    Last edited: Nov 5, 2009
  15. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    - OK, thanks. Optocoupler is out(I was trying to isolate and protect the Arduino though).
    - Yes, the Solenoid draws 2.6A! It's very thin(10 mm Dia.) and 6cm long and needs to pull 80 grams...
    I'll go to work on the rest, the second Transistor that needs to be added, will be powered by the 24V source???

    thanks
     
  16. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Well, wasn't the Optocoupler resolving the Amp drawing of the solenoid and not putting any burden on the Arduino???

    Excuse the so many questions but just trying to learn... :)

    p.s.
    they only share the ground and if need be I could and should seperate their grounds too?

    please advice.
     
  17. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I do not know what transistor you are currently using.

    One that will meet the requirements will need the existing transistor to drive it. There is also the option of using a MOSFET as a switch for the high current path.

    As for the LED, I guess I wasn't clear when I re-read my post.

    If you were to remove the LED and it's current limiting resistor (R1), you'd have the circuit to operate the solenoid (with D2). What you then would want to do for indication that the solenoid is "on" would be to put R1 (a larger value, as stated above, 1.5-2.2k) and the LED in parallel with the solenoid & D2 combination. e.g. Just as D2 is in parallel with the solenoid, R1 and LED would be "stacked" on top of D2 and the solenoid, but as a set, keeping R1 and the LED in series. If that helps clarify.

    Searching the site for "MOSFET Drivers" will give you a good idea for circuits to drive motors, which are similar to solenoids in that inductive kickback is still a concern.

    --ETA: Saw your second post. The 2.2k base resistor is all that is needed to protect the microcontroller and drive the transistor. The problem now is to switch enough current to turn on the solenoid. I'm going to do a search here. The grounds should be combined. The 5V will feed the processor and logic, and the +24V will drive the output devices, all will use the same return.

    -- It looks like the simplest solution would be to change out the NPN transistor for an IRLZ44 Logic Level MOSFET, most of the circuit would remain as it is, with the corrections noted above.
     
    Last edited: Nov 5, 2009
  18. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Thank you all for your patience and help :)
    I'm trying hard to get this right and with your support I will.
    Here's the modified version. Please let me know what other changes are necessary?

    thanks again

    [​IMG]
     
  19. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    In your updated schematic, the LED, kickback diode, and solenoid are connected so the current will only be limited for the LED. That's perfect.

    The only thing left is how to drive the current needed for the coil. The simplest would be to swap out the NPN transistor for the IRLZ44 MOSFET, a $2 transistor.

    MOSFETs are switched by voltage, rather than current (an NPN Transistor is a current operated device). There is no electrical connection between the gate and either the source or drain. You can think of the gate as the "base", the source as the "emitter", and the drain as the "collector" for now, though I'd suggest reading our online e-book, Volume 3 on semiconductors for a better understanding.

    The IRLZ44 is a Logic level MOSFET, which means that it can switch Large Currents (up to 40Amps) with a 5V signal on the gate. To keep the Gate from "floating", you would want to add a 100k to 1Meg resistor from the Gate to ground, and the uC output to the gate as you originally connected the transistor. The MOSFET will draw minimal current and switch quickly. NOTICE: Most other MOSFETs may not work with the 5V input, they need to be specified as "Logic Level".
     
  20. quant

    Thread Starter Active Member

    May 21, 2009
    114
    0
    Great thanks a lot, always wondered what the heck MOSFETs were? Now I know... :)

    Will be right back with the Schem.
    Also, what's the final word on the OptoCoupler, stays or is out?

    thanks a Mil...
     
Loading...