1
\$\begingroup\$

I power up my project by plugging a power supply into the power socket.

power connectors

There's a microcontroller inside. Sometimes it boots successfully, sometimes not. I think it depends on how much I fumble while inserting the power connector. If there's an flaky connection right at the start, perhaps it causes a problem.

First question: is that a likely explanation?

Second question: how can I fix it? Is there some way to deny power until the connection is steady? Or is it better to reset the MCU as described here? (I don't understand how that solution would work though.)

There's a 470uF capacitor on the analog side of the circuit on the 9V side of the 5V regulator which supplies the MCU. Could that be part of the problem?

My main constraints are cost and board space. Power consumption isn't a huge concern: I measured consumption as 70mA, and typically at least 150mA would be available.

Edit

Here are (what I think) are the relevant parts of the circuit. Apologies for not including these earlier.

power circuit

Itsy and display

And here's the analog part of the circuit:

enter image description here

\$\endgroup\$
7
  • 2
    \$\begingroup\$ What is currently connected to the reset pin of your microcontroller? \$\endgroup\$
    – HandyHowie
    Commented Nov 20, 2022 at 8:32
  • 2
    \$\begingroup\$ Please edit your question and add a schematic. The schematic tool in the edit menu is very easy to use. This can't be answered correctly without a reliable and complete schematic of what you have. A text description doesn't do it. Thanks. \$\endgroup\$
    – TonyM
    Commented Nov 20, 2022 at 8:40
  • 2
    \$\begingroup\$ We don't know which MCU it is and how it is powered. Yes, how the plug is inserted could cause the MCU not to boot if the circuit between connector and MCU has problems. To even guess if the capacitors are a problem the whole circuit must be analyzed. Also if you use some MCU module instead of just MCU, add that to details. \$\endgroup\$
    – Justme
    Commented Nov 20, 2022 at 8:53
  • 2
    \$\begingroup\$ Useful search term: power-on reset. \$\endgroup\$
    – winny
    Commented Nov 20, 2022 at 9:51
  • 1
    \$\begingroup\$ There is a 470uF on regulator input but nothing on output. No bypass caps in the order of 100nF. Have you measured how long it takes for the 5V or 3.3V to rise fully? the 470uF may be absurdly high as well as the 100uF with 80 ohm RV for the display and connecting the plug will just cause the power supply to go into overcurrent/undervoltage shutdown momentarily. Also the display is 5V powered but the MCU module has 3.3V IO, are they even compatible? \$\endgroup\$
    – Justme
    Commented Nov 20, 2022 at 20:31

2 Answers 2

5
\$\begingroup\$

There are "voltage supervisor"- or "reset"-chips for exactly this purpose.

Such chips monitor the supply voltage and enable their output when the supply voltage is time x (usually in the range of 0.5s) over a certain threshold voltage (usually selectable with part number).

The output of those chips is then connected to the reset pin of your MCU in such a way that the MCU is held in reset during time x.

Often times MCUs have similar features integrated. But a dedicated chip is usually the more robust solution since it does not rely on firmware (peripheral configuration).

Another point is robust firmware design. That's a whole different topic, but it's basically about how your firmware reacts to unexpected/unusual events.

For example, if your MCU reads an external EEPROM after bootup, but that EEPROM isn't ready yet. Does your firmware hang itself? Does it continue with corrupt data? Or does it handle this in a more robust way?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ The voltage monitors integrated into MCUs do not necessarily depend on firmware. When the MCU is powered up, the voltage monitor has to already do its job before any firmware is run. \$\endgroup\$
    – Justme
    Commented Nov 20, 2022 at 9:49
  • \$\begingroup\$ Many ICs that I use, though I'm not sure how common this is in microcontrollers, have a well-defined threshold on their enable pins, so that you can implement an undervoltage lockout (UVLO) with just a resistor divider. Again, though, not sure how common that is on microcontrollers; I use a lot of SMPS controllers, where it's very common. \$\endgroup\$
    – Hearth
    Commented Nov 20, 2022 at 17:29
4
\$\begingroup\$

80 ohms is too much resistance between the 7805 and the output cap for the regulator to remain stable. The datasheet probably says the max capacitor ESR should be an ohm or less. Move the cap inside the 80ohms, or have a big cap on either side of the 80 ohms.

Also, the USB can backpower the 5v bus too, so plugging one in before the other could conceivably latch up the circuit. Follow the same sequence each time, or protect against the wrong power sequencing.

The part below here is what I wrote first, before I realized you "micro" was a board with reset circuits already. I still feel it's worth saying though:

In general, never ever leave the reset pin floating unconnected.

Anything can couple to its high impedance input, even capacitively, and cause a halt.

Read the processor manual for recommendation on how to tie that pin off properly. And if there are any registers to configure, as well.

\$\endgroup\$
5
  • \$\begingroup\$ The 80 Ohms and 100uF are supposed to be a 20Hz low pass filter preventing power supply ripples from escaping from the display. Those values keep the supply voltage to the display within the band it requires, and the cap small enough that I can source it and place it mechanically. \$\endgroup\$ Commented Nov 21, 2022 at 7:48
  • 1
    \$\begingroup\$ I don't understand how a high resistance could prevent stable operation of the regulator - the 80 Ohms is relatively small compared to the internal resistance of the display as far as I can tell (otherwise it would bleed off too much voltage), and it's in series with the display. Wouldn't the regulator be stable if there was no load? \$\endgroup\$ Commented Nov 21, 2022 at 7:48
  • \$\begingroup\$ Please could you provide a sketch illustrating what it would look like with the cap "inside"? Thanks for the tip about the USB - for this USB will only rarely be connected. I've found there are no problems if the +9V is supplied before the USB is connected. \$\endgroup\$ Commented Nov 21, 2022 at 7:53
  • \$\begingroup\$ Bill,the 80 ohms can allow the feedback mechanism of the regulator to oscillate. I humbly suggest cutting the 80 ohms. let the regulator do it's job. The datasheet on most linear regulators will explain the math , but when you add the 80ohms, the regulator can't sense a drop in the load voltage at the cap as fast, because of the low pass you've added, and then when it eventually does see the drop, it turns up the output current to compensate, when the transient may have reversed. This can cause the regulator to be like a dog chasing its own tail, it never catches up, and keeps oscillating. \$\endgroup\$ Commented Nov 22, 2022 at 9:02
  • \$\begingroup\$ thanks for the clarification. I'll bypass the 80 Ohms and see if the noise creeps back in. It could be that the problem that LP filter was intended to fix has sorted itself out in some other way. \$\endgroup\$ Commented Dec 6, 2022 at 20:12

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.