EDIT: I've revised the circuit in response to comments from Andy aka. I have also updated my questions to make it more clear what I am asking. I'm leaving the top paragraphs for completeness' sake.

I am trying to design a circuit using an Arduino (U2) that will detect the incoming voltage from my car (V1) in addition to detecting the voltage on a backup battery (V2) in the circuit. I wrote all of the Arduino code for this before even realizing that the schematic design for this circuit was beyond my beginner's knowledge. I've taken a crack at producing the schematic of my system, below.

The Arduino code triggers a relay that energizes my load (a raspberry pi computer with some other accessories) when the car is providing voltage (my cigarette lighter is keyed with the accessory switch) and when the system loses power, it will run from battery for 30 minutes before gracefully shutting down the raspberry pi. It's just about done except for the circuit in this post. While the system is operating, I am hoping that the input current from the car electrical system will top-off the battery (it is a 12V SLA deep-cycle.)

When I run the simulator on this circuit, the voltage out at VBat is not 12 or 13.8V as I was anticipating, so I'm hoping that someone else can shed some light. I'm also curious about how I can prevent the voltage from the backup battery in this circuit from seeping back into the car electric system (I'm assuming I need a diode, however I was unable to make a diode behave as I would expect in the below circuit)

What is the proper way to hook up a backup battery in this scenario so that the battery not only is appropriately isolated from sending back-voltage to the car, but also receives charging voltage from the car?


simulate this circuit – Schematic created using CircuitLab

After Andy Aka's circuit revision, I have a now properly-operating circuit according to circuitlab. The only problem I need to solve for is how to properly charge the 12V battery from the 13.8V line. Andy aka's answer below makes reference to a Schottky diode but I'm not sure how I would wire that up to provide charging voltage to the battery.


simulate this circuit

  • \$\begingroup\$ I read Vout/Vbat as always being 13.8V - 12V = 1.8V - is this meant to be? \$\endgroup\$
    – Andy aka
    Commented Sep 11, 2013 at 17:53
  • \$\begingroup\$ No, I am expecting to receive ~12-13.8V on Vout. \$\endgroup\$ Commented Sep 11, 2013 at 18:22
  • \$\begingroup\$ What's the purpose of a separate battery? Can't you use a constant battery line in the car? \$\endgroup\$
    – DJkrugger
    Commented Sep 11, 2013 at 20:08
  • \$\begingroup\$ @DJkrugger The spare battery is to give the raspberry pi time to power down after the car circuit is turned off. I don't want to modify my car's electrical system since it's leased, I instead am using the cigarette lighter adapter which is keyed off of the accessory line, which is only active when the key is in "ON." \$\endgroup\$ Commented Sep 11, 2013 at 20:22

1 Answer 1


This is more of a comment than an answer because your requirements are made fuzzy by your illogical (don't take it to heart) circuit:

Are you looking for this type of basic configuration of your batteries: -

enter image description here

If so, then add the relay contact either in series with the 12V battery or in series with Vout. I'm assuming that your arduino will always take power from one of the supplies. I guess you'll need some kind of charge circuit for the 12V to keep it topped up too. This can be done with a schottky diode in series with a resistor from 13.8V directly to 12V BUT it depends on your battery type and I'm no expert on battery chargers.

  • \$\begingroup\$ Using this design seems to provide what I'm looking for, but it does still require the charging circuit as you say. I will edit my question with the updated schematic and restate my core questions. \$\endgroup\$ Commented Sep 11, 2013 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.