Using a CD4066 5v and 9v

Started by alparent, January 28, 2011, 12:37:01 PM

Previous topic - Next topic

JKowalski

Quote from: alparent on January 31, 2011, 01:49:29 PM
But you are saying that this isn't the best setup. I should use NPN's and let them do the heavy lifting.
But that would invert the voltage (I can deal with that!) But just out of curiosity. I can re-invert it back with another NPN. Right?
That's why I was thinking of using Darlingtons isn't a Darlington like two NPN's?

A darlington would not work. A darlington behaves like a normal NPN transistor. The darlington configuration ties another transistor's emitter to the base of the next one so that putting a little current through the first base causes more current (sunk from the darlington collector rather than the darlington base) to flow through the second's base, which turns it on.

The "front" transistor is basically just helping the signal source control the transistor by supplying additional current.

Two NPN inverters in series would work. But with the added complexity you might want to just consider non-inverting buffers (with low switching thresholds) as were mentioned earlier in this thread.

cpm

make sure the internal pull up for the input pin is disabled (20k pull up to 5v). This is enabled when you write HIGH on that pin in input mode. So try writing LOW after setting the pin as input.

alparent

Thanks for the explanation Chris.

earthtonesaudio

A transistor in common base/common gate configuration does not invert.  The main headache with this method is the DC bias for the base/gate, which should be high enough to turn the transistor fully on when the Arduino pulls the emitter low, but not more than about 5V.  If you use a MOSFET you'll just need the load resistor, but if you use a BJT you'll need an additional resistor in series with either the base or emitter.

alparent

#24
Quote from: cpm on February 03, 2011, 02:34:42 AM
make sure the internal pull up for the input pin is disabled (20k pull up to 5v). This is enabled when you write HIGH on that pin in input mode. So try writing LOW after setting the pin as input.

OK I will try this tonight. If this works...is there ANY reason I shouldn't do it like this? Man! I so scared of damaging my Arduino. :icon_redface:

Quote from: earthtonesaudio on February 03, 2011, 08:31:09 AM
A transistor in common base/common gate configuration does not invert.  The main headache with this method is the DC bias for the base/gate, which should be high enough to turn the transistor fully on when the Arduino pulls the emitter low, but not more than about 5V.  If you use a MOSFET you'll just need the load resistor, but if you use a BJT you'll need an additional resistor in series with either the base or emitter.

Thanks for that Alex......so is that's why I was only getting about 5v when using a non-inverting setup. http://arduino.cc/forum/index.php/topic,50565.0.html 3rd or 4th reply.
What do I need to add for this to work in a non-inverting way with a NPN transistor?

So basically a MOSFET is easier to turn fully on.

earthtonesaudio

I'm not 100% clear on how you had things set up, but for translating a 0-5V output from the Arduino to a 0-9V output, without inverting, a MOSFET is the way to go. 

From the Arduino to the MOSFET source, gate to +5V (use an N-channel MOSFET like a BS170 or 2N7000), drain to a 9V pull up resistor and the control pin on the 4066.  Larger resistors will be kinder to the Arduino's outputs, but slower.  10k is possibly a good starting value; I wouldn't go less than 1k.

alparent

Quote from: cpm on February 03, 2011, 02:34:42 AM
make sure the internal pull up for the input pin is disabled (20k pull up to 5v). This is enabled when you write HIGH on that pin in input mode. So try writing LOW after setting the pin as input.

OK .... one question.
If I do a digitalWrite (LOW) while in Input mode and then a digitalWrite(LOW) when in Output mode. Do I have to redo the digitlaWrite(LOW) every time I change pinMode? Or will it stay in LOW state?

Thanks again to everybody for helping out!

alparent

#27
Quote from: cpm on February 03, 2011, 02:34:42 AM
make sure the internal pull up for the input pin is disabled (20k pull up to 5v). This is enabled when you write HIGH on that pin in input mode. So try writing LOW after setting the pin as input.

Nope it's not working.....well is it working.......but I'm only getting about 5v.
Maybe I could use a lower resistor? I don't want to damage anything (I think you got that? :icon_redface: I can stop saying that!)

I guess it's back to the NPNs then (not big deal, but this looked promising.  :'()  

cpm

Quote from: alparent on February 03, 2011, 07:25:20 PM
Quote from: cpm on February 03, 2011, 02:34:42 AM
make sure the internal pull up for the input pin is disabled (20k pull up to 5v). This is enabled when you write HIGH on that pin in input mode. So try writing LOW after setting the pin as input.

Nope it's not working.....well is it working.......but I'm only getting about 5v.
Maybe I could use a lower resistor? I don't want to damage anything (I think you got that? :icon_redface: I can stop saying that!)

I guess it's back to the NPNs then (not big deal, but this looked promising.  :'()   

ok, i got it, on every pin there are diode clamps to rails. maybe you are getting 1 diode drop over 5v because of this.
I'm sorry i dont have my arduino availabe at the moment to test...

alparent

Thanks for your help Carlos.
Man I love learning!