DC (via PSU) switch...
 
Notifications
Clear all

DC (via PSU) switching to battery


RomeoSierra
(@rsalvage)
Active Member
Joined: 7 months ago
Posts: 5
Topic starter  

Hi All.

Firstly, I am quite inexperienced at electronics but try very hard to solve my own problems before asking for help.  IMHO that is the best way to learn - especially in these days of the internet and youtube rather than having to get on a bus and visit the library!  Dronebot workshop has been a fantastic resource and after watching I have incorporated several 74HC165 and 74HC595's in my project.

All of that said, there comes a time when you do need to ask for help, and this is it for me.

My circuit and programming is quite complex but it is a basic thing that is causing me a problem.

I have a pre-built (purchased/chinese) switchover relay.  On one side it has 7.6v coming in via a DC PSU and on the other it has 6xAA batteries @ 2000mah.  The output is 7.6vDC default via the PSU, switching to battery when DC power is lost.

My problem is that there is a 1/4 sec (unmeasured) loss of power during the relay switch, which is causing my ESP32 to reboot.

I have tried to put a 3300uf cap in to smooth it and that didnt work.  I then doubled the 3300uf in parallel to create 6600uf and that didnt work either.

My circuit draws ave 220ma with a peak of 290ma when the SIM800L transmits (telling me there is a power problem!).  During the design and build the circuit works fine.   I assumed (lesson now learned) that the relay board would take the switching into account and provide a smooth output but it doesnt.

LUCKILY I decided to run a final test before etching the board.  That is when I found this problem.

Unfortunately I am not allowed to upload a diagram or picture for some reason.  The "dia" below

DC--->

             Relay module --+ve--------1N4001 DIODE---47K Res -- 3300uf CAP --- Load (eg test LED)

Batt -->                     -ve  GND

Any help would be greatly appreciated.

This topic was modified 5 months ago 2 times by RomeoSierra

Quote
DaveE
(@davee)
Reputable Member
Joined: 1 year ago
Posts: 407
 

Hi @rsalvage,

  Switching a relatively high current with a relay without risking a brownout voltage dip is tricky.

Depending upon the design of your whole circuit, it might be possible to arrange a 'protected' supply for the ESP32 with extra 'hold up' circuit, but that requires a very customised approach following detailed analysis of your specific circuit. The ESP32 seems to have a fairly narrow 'tolerance band' when it comes to power supply voltage, and the internal brownout circuit ensures the slightest dip causes a reset.

Similarly, it is possible that your relay switching circuit could be modified to detect the supply failure before the power voltage has appreciably fallen. Assuming your 7.6V supply includes a voltage regulator, a 'system' approach might be to monitor the power input to the 7.6V regulator, and switch as soon as it starts to fall. Obviously, this assumes you have access into the internals of the power supply, which (for safety reasons) I would not recommend if you are not familiar with such circuits.

A common approach is to arrange for the back up voltage (say 9V) to be less than the normal voltage (say 10V) by at least one 'diode drop' -- maybe 0.7V. Connecting the output to each of the two supplies to the power input point via a diode in each line, each diode orientated to conduct from its supply, as illustrated below:

image

When the 10V power is available, its diode (D1) will be forward biased, and the unit powered, albeit with the loss of a fraction of a volt. The other diode (D2) will be reverse biased, since the 10V supply will be ensuring the input to the unit is a higher voltage than the battery (9V).

When the normal voltage disappears, the back up supply voltage will maintain the load input voltage at about 8.3V, assuming D2 is 'simple' silicon diode.

Obviously these voltages etc. are a bit different from yours, and only chosen to illustrate the concept. It assumes that the voltage regulation built in to the 'load' can cope with any changes you make. It also assumes your 7.6V supply can be converted/changed to provide a higher voltage than the battery. (NB 6 x AA new batteries are likely to output about 9.6V, which should be included in your calculations.)

Depending upon the design of your "10V" power supply (V1), you might be able to replace D1 with a wire link, thereby removing the voltage drop from D1. Some power supplies will play nicely when the voltage on their output is supplied from elsewhere, some will draw some current depleting your batteries, others may follow the "magic smoke" route.

It is possible to replace D1 and D2 with a pair of power FETs and appropriate drive circuit to emulate the diodes function. The advantage is FETs are essentially 'resistors' from drain to source when conducting, and it is feasible to reduce the resistance to the milliOhms range, thereby reducing the voltage drop. The downside is the extra complexity. I have read about chips specially designed for this purpose, but I can't remember if they are appropriate for your voltage, current and budget levels.

----------

Sorry, I don't have a simple magic answer .. perhaps someone else will do a better job.

Best wishes. Dave


ReplyQuote
RomeoSierra
(@rsalvage)
Active Member
Joined: 7 months ago
Posts: 5
Topic starter  

@davee I really appreciate your input.  Thank you very much.

As I said, I am a beginner here and need to learn.  That said, this is only my second ever build in less than 12 months and I am quite proud of it as I started with zero knowledge (although I am sure that all of you experienced guys/gals are frowning and rubbing your brow looking at the attached schematic!).

In the top left of the schematic is a connector.  This is the power that comes from the relay module. Pin 3=GND  /  2=7.6v to a 7805 to provide 5v   Pin3=takes the 7.6 back out to a buck converter which provides 4.6v for the SIM800L (Conn U5 on the right) .  Research tells me that a buck converter is good as it can supply the current that the SIM800L requires.

I was only using the PSU at 7.6v as it is the min that the relay circuit and buck converter needs.  I thought anymore would just be wasted as heat on the 7805.  What I am trying to say is that I can afford to change to your circuit as the voltages are not critical.

I have run out of time today to try it, but genuinely appreciate your constructive and detailed reply and as soon as I get some time back behind the bench I will do some experiments and let you know how I get on.

 

This post was modified 5 months ago by RomeoSierra

ReplyQuote
DaveE
(@davee)
Reputable Member
Joined: 1 year ago
Posts: 407
 

Hi @rsalvage.

I hope my suggestions are helpful.

I have had a quick glance at your schematic and my first impressions are generally good, but (of course) I will only comment on my concerns/thoughts, some of which are trivial .. hope that is ok:

  • As discussed below, at first sight your circuit needs 4.1V for the Sim800L, and 3.3V for the rest, except perhaps the LEDS?
  • ESP32 I played with could be 3.3V direct to the chip or 5V, which is converted to 3.3V by onboard linear regulator. This reg was small and only had PCB for heatsink, so I don't know how hot it will get with 7.6V. Might wish to have another regulator, or make the 3.3V supply sufficient to drive ESP directly? I presume this could also be a buck regulator, albeit with some extra capacitance if you are using the ESP32 WiFi transmitter!

 

 

  • Taking above 2 comments, maybe my original suggestion of 6 x AA = 9.6V battery, 10.6V (approx) mains power, with two diodes is appropriate? This should move smoothly from power source to the other , without needing a relay or dipping below the battery voltage (minus diode drop). Probably choose 2.5A (or more) diodes to allow for SIM800 and ESP32 current peaks? Schottky diodes have a lower voltage drop, which might also be helpful.

Other trivia to consider

  • ESP32 is 3.3V only chip. Connecting devices like U2 with 5V outputs risks problems, including magic smoke or short life. I know many others on the web do similar things, and I suspect the ESP32 internal ESD diodes drag enough current to bring the effective output voltages within range, at least for a while, but it doesn't feel right. In your case, I only spotted inputs to this 5V supplied chip, so perhaps the ESP32 is unlikely to be in mortal danger, but the minimum input voltage for the high logic level for the HC chip when powered at 5V, is probably above the high output voltage that the ESP32 could produce, risking the 74HC chip being held in a 'midway logic' position, which is also not good. I presume your concern is getting a high enough voltage to drive the LEDs. In practice, your arrangement will probably work, but in the future, consider using an additional open collector/drain buffer chip to drive the LEDs and keep the logic chips connected to the 3.3V system.

 

  • LED0 looks backwards
  • Try to draw GND symbols downwards ... sometimes sideways (e.g. on the ESP32) is ok, but never upwards

Hope this is useful and good luck .. I hope it all works!


ReplyQuote
RomeoSierra
(@rsalvage)
Active Member
Joined: 7 months ago
Posts: 5
Topic starter  

@davee Thanks.

The buck, relay board and psu are not on the schematic as they are all pre-manufactured.  That is why I have used connectors.

I used 5v because I originally intended to use 5v for the power to the ESP32.  Only to find that it needed more than 5v in order to work (which is why I utilised the convenient 7.6v).  There was a reason that I used 5v, but it escapes me now.  I will take a look later and try to drop everything to 3.3v via a second buck converter.

I will check the LED and sort my symbols.

 

Thanks again.

 


ReplyQuote
DaveE
(@davee)
Reputable Member
Joined: 1 year ago
Posts: 407
 

Hi @rsalvage,

  If the ESP32 card has a USB socket that it should work with, then 5V ought to be enough .. as that is all USB (excluding the new high power USB-C modes) provides. However, it is widely accepted some modules struggle when the WiFi is on.

If a higher voltage than 5V 'fixes' the problem, this suggests the onboard regulator is struggling with the peaks, since this is the only device that sees the incoming voltage ... the rest is powered by the 3.3V output from the regulator.

One might guess, that a 'rock solid' 3.3V supply to the appropriate pins would also work, but no guarantees!

Good luck, Dave


ReplyQuote