Products > Embedded Computing

Arduino, data and supply voltages on same pin?

(1/2) > >>

gmc:
I'm busy with a project where I am using an Arduino to either switch 5V, 12V to data to a IC under test. Depending on which IC is under test it will either need 5V, 12V or data send to it.

I've come up with 2 ideas, not sure which one is better or if they are both terrible.

On the first schematic I would like to use something like a 4066 to switch supplies (I know the 4066 has a high resistance so would not be able to use this specific chip. Is there something that will suit my needs to switch a max of 40mA at 5V and 12V.

So if D10 is high (D11, D12 low) then 12V is powering the test chip.
D11 is high (D10, D12 low) then 5V is powering the test chip.
D12 is high (D10, D11 low) then data is send to the test chip from Arduino via D13

Downside of this is if I messup the programming or when powering up Arduino D10,D11, D12 are all high then I risk damaging Arduino

On the second diagram I'm using transistors to switch the supply voltages. A better option? Again a risk if D10 and D12 both on then I risk damaging Arduino.

Any feedback on this would be appreciated. Is there a better/safer  way to do this? I have to share output pins going to the test IC as depending what the IC  is under test, it requires different voltages or data pin.

Nusa:
Start by simplifying. I'd suggest using the 5V switch for data as well. When you want 5V, just hold the line high. When you want data, let the data flow. And as a bonus, you've eliminated your unprotected data line.

Otherwise, either of your methods is fine. Or use optoisolators (e.g. PC817) if you want complete isolation.

Also consider what happens if you turn on 5V and 12V at the same time. Adding a diode or two might be smart.

gmc:
Thanks, I thought about using the Arduino to supply the 5V but the test chip draws 40mA which could exceed the current from the Arduino IO pins.

Peabody:
I don't know what chip you would use for your first circuit.  The CD4066 will go to 15V, but the HC4066, which could supply the current, only goes to 7V absolute maximum.  Actually, you might look at the CPC1017.  It's described as a solid state relay, and is a little 4-pin SOP device, about $1 each.  You would need three of them.  Typical ON resistance is about 7 ohms.  And being optocoupled, it would absolutely protect your Arduino.  It looks like the CPC1006 would also work.

In the second circuit, it looks like your PNP transistors are upside down.

Either way, as Nusa says, diodes would be needed to prevent, say, the 12V supply from flowing into the output of the 5V transistor or switch gate when it's turned off.  Bad things tend to happen when you do that.  But maybe not needed with the CPC1017.

Doctorandus_P:
I would build the circuit like in the attachment.
(You drew the PNP transistors backward).

It works as follows:
Q1 and R3 form an Emitter follower, and because the Microcontroller output is either 0V or 5V, the current through R3 will be either 0 or 1mA.
If the Microcontroller output is low, then R4 wil keep the Base of Q2 high to prevent leakage paths.
If the Microcontroller output is high, then there will be almost 1mA through the resistor and the Emitters of both Q1 and Q2 and Q2 can deliver a few hundred mA to the "test IC".

R6 is just a combination of both your pull down resistors. No need to put 2 resistors parallel.

For the feedback:
For 0V to 5V, the voltage over R5 will be small as long as the microcontroller pins is an input (high impedance).
If Q2  is open and there is 12V on the right side of R5 then some current will be shunted through the skottky diode to Vcc.
Instead of a skottky diode do Vcc you can also use a zener diode to GND, or even 2 LED's in series (About 4V, depending on color).

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod