Maker Pro
Maker Pro

Auto-disable secondary battery?

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
Hi guys and gals!
I hope you guys can help me, im looking for a way to disable a secondary power source when the first one is re-connected.

I have a kids bike trailer/stroller that i want to put some lights on, mainly rear turn indicator and position (red) light for when its used with my bike, but also front (white) lights for night strolls.
Since my bike is having its electronics overhauled i figured i just throw in yet another problem in the mix.. :)

Now, my bike has a battery, that will provide power to the whole system and i want to use it to power the trailer lights aswell, so i know that my whole vehicle is lit up when in traffic.
Currently i have 3x battery packs on my bike and its not a rare occation that i notice that one of the packs is dead, therefore i want a single pack and a single problem to remember about. :)
But i also would like to use a secondary (smaller) battery onboard the trailer, so i can just turn on the front lights and bypass all the other electronics (Pin extender, FET transistors and so on) when the trailer is used for walking.

I imagine two circuits, the bike circuitry on the left, and my stand-alone-light circuit on the right, containing a switch, battery and a resistor for that imaginary front headlight in the middle.
As one of the circuit is turned off, i can turn the light on with any one circuit.
But my headache starts when i "forget" to disable the secondary battery with the stand-alone-light-switch, i figure i will be feeding that front light double the juice, probably burning it up in a flash.

So i need a way to disable the secondary "system" in a automatic way, as soon as i connect the power from the bike.
Ive been trying to use transistors, trying to figure out how to "invert" their behaviour, keep open when no signal and use the voltage input (from the bike) as a off-trigger.
But im simply not smart enough (or educated enough) to solve this riddle on my own..
Someone suggested a relay but im not too sure.. Appearantly it requires a certain type of relay and im having dificoulties finding one matching the tipsters vauge descriptions.. is that really the best option here?
 

Bluejets

Oct 5, 2014
6,901
Joined
Oct 5, 2014
Messages
6,901
If the primary and secondary battery sources are slightly different voltage( or configured as such) then perhaps a voltage comparitor circuit with afore mentioned relay or mosfet controlled output.
 

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
I feel my previous post was a bit unclear and contained irrelevant parts, so i thought i would edit the previous post but i havent found that feature yet...

Anyhow, this is the essence of the question; the schematic below.
The USB+SHIELD is representing my "BikeBus" that provides all the sub-system-boards with a control signal and 5V from the main board and battery on my bike.
The dual BATx are AA 1.5v batteries, representing the onboard battery in the trailer, from now on known as the trailer battery.
Self-disabling-trigger-schematic.png

As you can see im trying to disable the bottom part of the schematic when there is +V detected at the bikebus connector.
Im far from a electrical engineer level of skills, im much closer to that other end of the spectrum, so any attempts towards explaining and/or correcting idiotic mistakes made by me (here and in any other post) especially when it comes to electronics, are much welcome as they will further my knowledge. :)

With that being said, what the above schematic is supposed to achieve is the following:
When PushbuttonSwitch is activated, the XOR comparator will check if there is +V at USB and if not, turn on the Q1 FET, enabling ground connection to the rest of the circuit.

If there is +V detected at USB, then Q1 will remain off, therefore disabling both batteries and not provide any extra juice to the rest of the system.

And in reverse, if PushButtonSwitch is disabled, when +5V gets fed thru the BikeBus, the XOR will sense no battery and therefore enabling the ground connection, but the PushButtonSwitch is disconnecting the circuit on the other side of the batteries.

Now my big question is, is my schematic sound? would it actually work as intended?
 

Bluejets

Oct 5, 2014
6,901
Joined
Oct 5, 2014
Messages
6,901
Where does the xor get it's supply from during all this ?
 

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
Where does the xor get it's supply from during all this ?
From happy thoughts?
I honestly don´t understand half the stuff i'm doing, just trying to piece together what little i can from information floating in cyberspace.

As i understand the xor gate, you will have 3 pins, A, B and Output, represented in this circuit above.
And of course, the IC chip that contains the XOR gate will need some juice and i figure i would try to integrate a dual power feed, since i would need it to work regardless of what battery is plugged in.
Worst case would be to use dual IC chips, one powered by each source, but both controlling the same FET (Q1)
The trailer battery might just as well be unplugged, at home charging, i would still need the trailer to work when hooked up to my bike.
 

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
Bluejets, that idea actually makes sense. :)
Still, i might be running the trailer lights on secondary power if primary power level drops (during heavy loads and so on).

And that also means that the trailer battery pack _MUST_ be the same voltage as the bike pack, in this case 5V.
That is not a problem in this case, i can easily adjust the circuits to be 5v instead of 3, and the added weight of the battery is of no concern.

But if thats the best option, its still way better than to stand up from the bike and go to the end of the trailer to flip a switch. :)
 

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
Well for starters, my electronics store are quite limited with relays, the ones they do have cost about the same as the rest of the project electronics combined and more.

I havent really used relays before, have practically no knowledge about them, more than they break down sometimes in our car.
 

MadMike

May 14, 2013
4
Joined
May 14, 2013
Messages
4
Just thought. '1n4004' diodes are going to make a dent in the 3v battery voltage. A low forward voltage drop Schottky diode would make more sense.

I suppose D2 could be omitted. In which case just be aware when the trailer switch is closed with the bike plugged in all lights would come on.
 

alphonse

Oct 1, 2016
8
Joined
Oct 1, 2016
Messages
8
Im sorry Mike, hope you wont get mad ( :) ) but i forgot to hit "post" when i had typed you a reply the other day. :)

Thats the back side of parenthood, you seldom get to finish what you started.. :)

What i was trying to explain in my previous (not posted) reply was that i tend to over-complicate things, and this project is no exeption..
Im using a central arduino nano as a main light controller, with MCP230xx as pin extenders.
Everything is 5V and i will probably be using single led or parallell for everything exept rear position-lights, witch is 2x 2V, 20mAh.
So each light-function already has its own lanes, so im simply hooking schottky diodes into those lanes.


In any way, im aware that there will be a voltage drop over each diode, im not sure how to calculate on this or how to compensate my circuit accordingly, but i really cannot figure out a better option while maintaining the project wish-list.

I am currently re-populating yet another prototype pcb, hopefully this one will be correct (enough) for for ordering.. :)

Here´s some pics of my schematics and PCB at its current state:
Trailer-Main-Board-error.png Trailer-schematic-module.png

Oh and please note, this is merely the main trailer card, the trailer system is built up of 4 additional cards, rear external light array and front light array, one of each for each side.
Then we have the bike PCB´s, current count is 8 PCB´s, including button/slide switch sub-pcb´s and LED status panel PCB.

I know, i went crazy on this project, but the PCB´s are merely 20 usd + 10usd shipping, and thats "regardless" of size (seems to be size spans for specific costs), meaning im paying the same for 1 PCB or 10 PCB:s, as long as the total PCB size isnt much larger than 150x150mm. :)
Im also saving 10 usd per PCB by cutting them out myself from a large sheet of multi-boards.. :)
 
Last edited:

MadMike

May 14, 2013
4
Joined
May 14, 2013
Messages
4
Good gravy you like a challenge.

Voltage drop across diodes - a good rule of thumb is 0.6 volt per diode (in series). You just add 0.6 to the LED voltage drop when working out resistor values. Schottky diodes drop about half this. If you hunt through the data sheets you'll see variations but not much.

I initially posted quickly before I went home. After re-reading your original post I should have realised it was more complicated!

let me know how you get on.

Mike
 

Andre van Stiphout

Aug 18, 2016
2
Joined
Aug 18, 2016
Messages
2
I have to agree with "frhrwa". Call it old fashioned but a relay with 2 N/O and 2 N/C contacts is the way to go. Old fashioned maybe, but only one active component and a few connectors. Cut out all the electronic crap. Remember, this is a bike and a trailer, not a Spaceship! Cheers.
 

MadMike

May 14, 2013
4
Joined
May 14, 2013
Messages
4
1 x single pole switch, 1 x double pole switch, 1 x single pole centre biased change over, 1 x double pole centre biased change over.

No voltage drops, no energy wasted through relays, across diodes or on space ship circuits. No electronic crap.BIKE-N-TRAILOR-LIGHTS2.png

This has been fun, keep us updated.

Mike
 
Top