Other Question to the electronic engineers

D

Deleted member 103

Guest
Hi guys,

I use an Arduino Nano USB-powered and 9V battery.
The standard circuit of Arduino is so that is always uses the input with the higher voltage.
I want to but that Arduino 9V battery only be used when there is no voltage on the USB port is available.

Know someone how I can do that?
Perhaps a simple circuit?
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
I'm not sure the UPS example is correct for @Filippo requirement. The most simple and effective solution I can think of is to use the smallest 5V relay you can find. Have the normally closed contact connected to the 9V supply and the normally open contact connected to the 5V supply with the common going to your Arduino. Also connect the 5V to the coil and common up the zero of both supplies.

This way, whenever the 5V is present it will energise the relay and supply your circuit using the 5V supply and will completely disconnect the 9V thus preventing the battery from draining. When the 5V is removed, the relay will de-energise and re-connect the 9V. Nice and simple ;)
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I also thought of that, but a mechanical switch may force the R'duino to reset, thus restarting the program, which may be undesirable!
Also, the Relay being always energized when in USB mode, will force for a "minimum" current of a few dozens milliamps plus the board power consumption, which may not be negligible!
 
Upvote 0

Adie

Member
Licensed User
Longtime User
hi, use a Diode. It is basically a 'one way valve' --|<-- Will let power flow from 'right to left' but not 'Left to right.

We use it extensively for backup power on the arduino.
 
Upvote 0

KitCarlson

Active Member
Licensed User
Longtime User
Instead of a relay, a P channel MOSFET, might be used as a switch for the 9V input. The MOSFET would be arranged such that without USB power the gate is low, that would switch the MOSFET on. When the USB powers the gate could be at MOSFET source level, so it is off. Might take a resistor or two. I would recommend use of a circuit simulator to test the circuit.
 
Upvote 0
D

Deleted member 103

Guest
Hi guys,

Thank you all.

I have now made such a simple circuit with a optocoupler, what do you think, it may function?
I know that between the diode and 9V should include a resistance, but is now for the circuit not important.

Schaltung.JPG
 
Upvote 0

KitCarlson

Active Member
Licensed User
Longtime User
That is a good idea! There are opto mos solid state relays that may improve over the 4n35.
Clare and Renesas may have parts for opto mos.
 
Upvote 0
D

Deleted member 103

Guest
That is a good idea! There are opto mos solid state relays that may improve over the 4n35.
Clare and Renesas may have parts for opto mos.
Unfortunately it does not work with the 4N35.
I need an optocoupler which inverts the signal, that is, the battery may be used only when the USB input is not a tension.
Can anyone tell me what would be the right optocoupler?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
That's the thing with opto couplers... They are always NO (normally opened)
You could use a transistor to trigger a low state when USB is plugged in, thus turning the opto coupler off
 
Upvote 0
D

Deleted member 103

Guest
That's the thing with opto couplers... They are always NO (normally opened)
You could use a transistor to trigger a low state when USB is plugged in, thus turning the opto coupler off
I thought that should work with the HCPL-2601, but is not so, or am I doing something wrong.
HCPL2601.PNG
 
Upvote 0

KitCarlson

Active Member
Licensed User
Longtime User
There is a CPC2317N form C solidstate relay. Use the form B section. It is normally closed, but with USB on the LED emitter, it opens. The part is $2.10 USD. There are many more parts, but they cost more.

Use about 3.8k resistor to limit LED current to 1mA when powering from USB. Load needs to be under 120mA on switch side.
 

Attachments

  • CPC2317N-274800.pdf
    128.9 KB · Views: 311
Last edited:
Upvote 0
D

Deleted member 103

Guest
Hi KitCarlson,

I finally bought the CPC2317N, but unfortunately does not work the circuit.
I do not know what's wrong, you can build me a circuit?
 
Upvote 0

KitCarlson

Active Member
Licensed User
Longtime User
I might be able to help if you show the circuit you tried. Not working is not enough information. Use volt meter, measure what happens pins 1-2, and 7-8 with and without USB.

Use 3.8k resistor to limit current at pin 1. Apply +5V from USB to resistor , and ground to pin2. Use pins 7 and 8 to enable 9V feed.

Pins 7 to 8 conduct when USB is absent, with USB pins 7-8 open.

Might try to reduce 3.8k to 2k, see if more LED current helps.
 
Upvote 0
D

Deleted member 103

Guest
The problem is that the connection between pin 7 and pin 8 is open, just like pin 6 and pin 5. :(
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
In the circuit diagram (post# 7), the LED is reverse biased. Flip the two pins.
 
Last edited:
Upvote 0
D

Deleted member 103

Guest
In the circuit diagram (post# 7), the LED is reverse biased. Flip the two pins.
between pin 7 and 8 I should have a passageway, but is not the case.

Here is the circuit again.
Schaltung_2.JPG
 

Attachments

  • fritzing_01.zip
    4.4 KB · Views: 304
Upvote 0
D

Deleted member 103

Guest
I think that something is wrong at the chip CPC2317N.
Pin7 + 8 and Pin6 + 5 are always open!
Only if at Pin1+2 or pin3+4 a voltage is the Pin7+8 or Pin6+5 are closed.

IMAG1164.jpg

IMAG1165.jpg
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Hi Filippo
You are using an operational amplifier IC but refering to it as solid-state relay. The IC LM358 is an op amp while the number in the red arrow in post# 18 is refering it as CPC2317N which is a relay.
 
Upvote 0
Top