Simulating a Terrible Power Supply

I’ll start with a TLDR: how do you test that a module will work with a terrible power supply!

Now for the long version: I made a simple digital module and it worked fine when it was the only module connected to the power supply. After a bit of initial testing I put it in a case with some other modules. This system is not very good - it has a pretty poor power supply and some of those horrible flying bus cable things.

At this point, my module wouldn’t start unless I powered everything on, then turned it off for a second and turned it on again. I checked with the oscilloscope and it was due to the power supply taking a long time to ramp up.

I came up with several ideas to fix this problem, but one of them needed some changes to the firmware / fuses and the Arduino core I was using didn’t seem to support them, so I ported my code from Arduino to pure C++. Before implementing the changes I tried to reproduce them again, but now it (seemingly as if by magic) just works. In fact sometimes a different module fails to start now!

So I’m not looking for a solution to the power supply problem right now. I can see in the Mutable Instruments modules there is sometimes an LDO for the MCU and another 3.3v regulator for the analogue stuff (if needed). I will try this and some other things, but before I try that I need to reproduce the problem!

This is my question: how to I reliably replicate the initial behaviour? Is it best to try to attach some kind of load to the power supply? Do I use a lab power supply and slowly ramp up the voltage to 12v manually (I highly doubt this is the answer!)? Do I need to make a special power supply where I can control the ramp up speed?

I have no idea why switching from Arduino to native C++ caused it to need less power on startup!

What’s the processor exactly? You may be able to use an integrated brownout detector. Another solution could be an external reset controller for the processor that monitors the power and releases the reset pin once power is stable.

There’s a thread on MW (Befaco VCMC DIY - boot issues - MOD WIGGLER) that talks about bootup problems with a Teensy in very similar circumstances (loaded rack, slow ramp up of power lines). That got solved in (Arduino) SW, so there’s a possibility that your switch to C++ avoids this same problem.
Similar thread on Teensy forum (Teensy 3.2 not booting)

not sure if this helps: ADDAC300 Dual Power Starvation

I understand what’s causing the problem and how to fix it. I even have some LDOs and voltage supervisor chips on my desk right now and have looked into the internal brownout detection.

My question was how to make the power supply worse so that I can replicate the problem!

As it’s “fixed” itself, if I implement any of these things I have no way of knowing if they’ve worked or not. I need to be able to reproduce the problem before I fix it, so that I can be confident that the fix really works!

1 Like

you can use a transformer (1:1) to couple into the DC supply lines a small signal (200 mV) from any generator in various frequency ranges to simulate ripple. I used to have to do this when I had to design and test satellite communication equipment.

1 Like

Some programmable bench power supply have USB or Ethernet connections. You can use this to program a ramp up or down. Some have a built-in timer to program these ramps.

This is an interesting module, but I don’t think it will work for this. I would have to adjust the knobs to manually ramp up the voltage, in which case I could just adjust the voltage on a bench power supply.

This is interesting - I’ve never come across this before.

I think if it was just a case of ripple being my problem this would probably work, but it’s specifically the ramp up time of the PSU that I need to simulate.

I think this is THE solution to be honest, which is unfortunate because it involves expensive hardware!

I’m wondering if I can make some kind of ramp up circuit instead to emulate this more cheaply. Maybe I can supply the +12v rail through a transistor and use some kind of slope generator (either capacitor based or even another MCU) to ramp up the current.

I’m not sure if anyone is interested, but I thought I’d update this thread just in case someone stumbles across it.

In the end, there was no cheap and easy way to simulate this. I looked into USB controllable power supplies and they are expensive. I thought about making a ramp-up circuit but that would have been very time consuming - not because it’s necessarily a complicated circuit, but by the time I’ve designed it, tested it, maybe iterated a few times it would just be a whole lot of time that I don’t have!

What I did to reproduce the issue was to re-flash my original Arduino version of the firmware, but then use the other toolset to just set the fuses. This worked perfectly - my module would only start up about 5% of the time!

As for the actual solution, I’ve tried 2 things that seemed to work. First of all, enabling the RESET pin and installing a voltage supervisor chip (I used the TCM809). This was super easy and involved just 1 additional part.

The other, even easier thing that worked was just setting up brown out detection (BOD) in the microcontroller by setting the right fuses.

So hopefully if you are a random person stumbling upon this thread with a similar issue, you might have some ideas on how to replicate it and how to fix it!

As for what caused this change in behaviour between the 2 firmware versions, I don’t really know. I googled about and found some people had had a similar issue with a Teensy development board, and in that case it seemed to be that the real time clock (RTC) was causing the problem. So I suspect some peripheral is probably enabled by default in the Arduino version which is causing a bit more power to be drawn on start up.

I think a lesson everyone can learn from this is that although Arduino is very convenient and just works seemingly by magic, it does some things that you may not expect! If you can work in pure C / C++ then it might save you from some headaches later on.