Electronic – Espressif ESP-01 plus Digispark (Tiny85) design power supply oscillation (fine on batteries)

atmegaesp8266oscillationpowervoltage-regulator

WARNING: If you try to do something similar to this (using a non-isolated small power supply inside one of your home appliances in an attempt to provide power to "user-added" functionality like e.g. WiFi control or Arduino control inside the case of the appliance), or in any event if you even don't know what a non-isolated Power Supply is to begin with, then please have first a look at this very good read (and practice):

IMPORTANT: Good info on using non-isolated Power Supplies for your Arduino or small uC, low voltage projects

I've learnt myself a couple of two HIGHLY important things from that link. Thanks to all the people that commented down the road and in fact adviced me on further investigation before fully embarking on this project's quirks…

Anyway, let's go to the full story:


In the process of adding WiFi-activation capabilities to an express coffee machine, I've added an ESP01 which receives the coffee "commands/presets" plus (and because of the limited count of pins in the ESP01) a Tiny85 "algorithm microcontroller" which receives line in form of pulses from the ESP01's GPIO2 pin and executes all the control logic for the TRIACs activating the pump, heater element and also controls the machine's only visible LED.

This design works like a charm when e.g. I access the back-installed USB ports in order to program/ flash one (or both) of these devices.

But as soon as I try to use the design when getting power from the coffee machine's own 5V (well, 4.5) rail, it works right but as soon as the Tiny85 acts e.g. on the LED to activate it, ALL power goes into a kind of oscillation (0.5 secs period or such), in which all goes into blinking, the LED, the power to the 3.3v regulator (for the ESP) AND basically all the system.

No smoke, no "fried part" odor, just that, oscillation of power rails, I guess it's from the (whichever) regulator on the original coffee board (5v.reg) and my 3.3.reg (either internal to the Tiny, which i think there isn't any, or most probably the one I inserted for the ESP01), but curiously I can remember a "basic test" of my configuration in which even bypassing the 3.3v-reg (which is hazardous for the ESP01, so I just tried it for a couple seconds) it went also into oscillation!

(Just for the record, whenever I program the uCs I obviously connect this design to the USB port in my computer WITHOUT the machine being AC-powered.)

So I guess it's either a case of coupled oscillating of two regulators happening, or just a "lack of power" in the main regulator of the machine which causes it to shut down and then "reboot" and this goes on and on…

But thing is, I don't want to have a "secondary" battery feeding the ESP or Tiny separately, and this could case overheating of such batteries too, I'm afraid, so… what's my chances? How can I get rid of this oscillation? Tried to isolate each rail with its own Schottky diode (solution read elsewhere) but did not succceed.

Any ideas? Both for causes and remedies… Thanks for any input!

PS-(rough paper handmade "schematic" added)
ALSO, ADDED SCHEMATICS OF ORIGINAL POWER SUPPLY SECTION. See last pictural below!

ROUGH SCHEMATIC

PS2- (picture of said/ original coffee machine board, the power supply section is located to the right edge… the electrolytic replaced by a 220uF was an SMD one, which was badly burnt due to a short circuit but otherwise machine is working good, only that as long as BOTH ESP and Tiny85 uCs are on, it seems the PS gets fully loaded and so the oscillations!)

ORIGINAL MACHINE'S PCB INCLUDING POWER SUPPLY AREA (TO THE RIGHT)

PS3- I measured the LED's current when ON and it's just about 3.42 mA, so I think current overload due to LED switching is not the real cause…

PS4- Some other scenario currents measured: here are the results. Based on these, I can mostly sure tell it's a textbook case of original PSU's underpower (it had originally just to power a small 16F Microchip uC, and a couple gate currents for the TRIACs). Any ideas on how can I deal with this? Just dropping out the original PSU is not a good solution to me, because it would involve translating all the TRIAC and isolation planes etc. out to another PCB which then would need a proper full PCB redesign for this, it now just being a "simple" add-on if you wish…

CURRENTS MEASURED SO FAR:

  • LED on consumption: 3.4mA
  • With Tiny85 "algorithm" uC powered (still w/out ESP01 being fed):
    Boot: 17mA
    Idle: 23mA
    When LED on: 19.6mA
  • With Tiny85 AND the LM2596 DC-DC 5 to 3.3V conv, (but w/out a load):
    Boot: 31.3mA
    Idle: 36.8mA
    When LED on: 33.8mA
  • With just the LM2596 Dc-dc module on (this time do feeds the ESP01 subboard): sustains 80-85 mA without PS oscillation, but a bit quirk behaviour i.e. some current ripple in the neighborhoods of 80-90 mA.

-Confirmed that could about the current limit of the original PSU, since:
with BOTH uC's connected, goes on OSCILLATING (0.5secs on.off current behavior): goes from 0-20mA briefly uo to 90-110 mA, then cycles.

Notice that I added up a 470uF "reservoir" cap to the 5V rail upon entering the LM2596 (think it's redundant now, since the LM2596 module has its own SMD electrolytics onboard), and a 22uF is in the 5V rail at original PCB level (just before going out the two cables leading to my "addon").

PS5- My first (partly wrong) draft of original Power Supply schematic

MACHINE’S ORIGINAL POWER SUPPLY SECTION SCHEMATIC

PS6- I corrected the schematic (posted new version), also posted a capture showing the "Application" which the Datasheet for the Switcher IC illustrates, which is mostly identical to my own case, although for 12V output, not 5V.

(CORRECTED) MACHINE'S ORIGINAL POWER SUPPLY SECTION SCHEMATIC

APPLICATION IN THE DATASHEET, WITH A POWER SUPPLY MOST SIMILAR TO MY CASE (BUT 12V, NOT 5V)

Best Answer

First, if your "LM2596" is the usual $1 module from aliexpress which has counterfeit LM2596, "cost-optimized" inductor which saturates on every peak, and no-name general purpose caps totally unsuitable for switching supplies, place it where it belongs: in the recycling bin. As an alternate solution you can run it at rated current until the capacitors die, but make sure it doesn't power anything expensive. Output ripple on these things is just ridiculous.

An offline 3.3V supply for your ESP like this small PCB mount Meanwell IRM-02-3.3 costs 5 € which is much cheaper than the time you'll spend reverse engineering and debugging your current setup. Plus it won't start a fire or electrocute you, which is always a good thing.

enter image description here

If you want a replacement for your "LM2596" there are many PCB mount DC-DC modules available, like these from CUI. Plenty of choice available on the digikey/mouser/farnell search engine. At 2€ each, for one-off projects, it isn't worth the time designing a DC-DC and reading all these datasheets. Plus they're tiny and efficient.

enter image description here

For your project I'd use the offline isolated supply, and an opto to isolate the coffee machine from your ESP circuit. Then the whole project is isolated from mains and safe, and you can use the programming/debug probe.

Isolated triac drive can be done with an opto-triac like MOC3041. Here's a random example from the net:

enter image description here