6
\$\begingroup\$

I've been playing around with PIC microcontrollers for a while now, and have had a fair bit of success, however I sometimes get unexplained resets and sometimes need to cycle the power a few times to get my device to start working.

I think this is down to my simplistic PSU.

I normally throw together a mains transformer, bridge rectifier, linear regulator and a few capacitors.

Does anyone have a circuit diagram of a better more efficient PSU that is easy to build on stripboard and doesn't cost too much?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Have you got a circuit diagram of what you normally do? \$\endgroup\$
    – Dean
    Jan 4, 2011 at 16:41
  • 1
    \$\begingroup\$ Are you sure it's due to your power management and not your software? Infinite loops, illegal memory access, and illegal op-codes can cause resets and other bad behavior. \$\endgroup\$
    – Nick T
    Jan 4, 2011 at 16:45
  • \$\begingroup\$ @Dean, no but I'll draw one later and post it. \$\endgroup\$
    – BG100
    Jan 4, 2011 at 17:09
  • \$\begingroup\$ @Nick, I'm about 95% sure it's not the code. I have done a huge amount of testing by eliminating parts of the code and seeing if it fixes the problem... I know what I'm doing with code as I'm a programmer in my job, but my electronics knowledge is basic... so I'm guessing this is where my problem is. \$\endgroup\$
    – BG100
    Jan 4, 2011 at 17:15
  • \$\begingroup\$ Have you tried using a regulated (lab) PSU or batteries instead of your "normal" PSU on otherwise identical hardware? Divide and conquer. \$\endgroup\$
    – XTL
    Jan 11, 2011 at 15:55

3 Answers 3

7
\$\begingroup\$

What is REALLY important is to have 0.01-1uF ceramic capacitor soldered right on the power pins of every digital IC in your circuit no matter what is the power source.

So I belive even your current PSU will be fine if you add ceramic caps where needed. Linear regulators provide very stable power, so you should be good with what you have now (unless it is oscilating - might happen if ESR of caps does not match regulator requirements - usually happens on LDO regulators rarely).


In my projects I use USB as my main power source. It gives you stable 5v and it does have current limiter.

You can ether get it from your PC(should be careful a little) or from tiny mains adaptors which have USB output.

Then you use your linear regulator if you need less then 5V.

\$\endgroup\$
4
  • \$\begingroup\$ I normally put a 1000uF electolytic before and after the regulator, but not a small ceramic like you suggest. I'll give this a go and see if it helps. Do I solder it between Vdd and Vss? Also, if I have more than one PIC in my circuit, do I need a cap for each one? What does this do to the supply? How does it help? \$\endgroup\$
    – BG100
    Jan 5, 2011 at 0:24
  • 4
    \$\begingroup\$ Yes, you need tiny ceramic cap on each on your PICs. Yes, between Vdd and Vss. Large electrolytic cap far from chip cannot filter high freqency noise from the microcontroller (>1Mhz range). So this tiny cap filters all digital noise from the micro. For better filtering some add 2 caps with different size in parralel (0.01 & 1 uF for example) as single ceramic cap have a resonant frequency. Next improvement is ferite beads on Vdd, but this is usually used only for more complex chips like microprocessors & FPGA's. \$\endgroup\$ Jan 5, 2011 at 0:46
  • 1
    \$\begingroup\$ Be careful with large caps on either side of the regulator. It's safer to put a big cap on the input and a much smaller one at the output. Reason being that when you unplug the transformer, the capacitors will discharge. If the voltage at the output of the regulator is higher than the voltage at the input, a lot of linear regulators will fail due to that reverse bias. An easy way around this is to make sure that the output capacitance is much less than at the input. \$\endgroup\$
    – lyndon
    Jan 5, 2011 at 17:50
  • 2
    \$\begingroup\$ a) Follow the linear regulator's datasheet recommendations for input and output capacitor values. Typically a moderately large value near the input (100uF), and a smaller value on the output (0.1 - 1.0uF) b) Short piece on decoupling capacitors: edn.com/archives/1997/091297/19col.htm c) The input/output capacitors are not the same as the power supply filtering capacitors that are located after the bridge rectifier, where 1000uF is a reasonable value. \$\endgroup\$
    – mctylr
    Jan 13, 2011 at 16:52
8
\$\begingroup\$

It's not on stripboard, but it's simple, cheap and decent.

http://www.ladyada.net/make/bbpsup/

Project files:

http://www.ladyada.net/make/bbpsup/download.html


(source: ladyada.net)

\$\endgroup\$
5
  • \$\begingroup\$ Thanks, but this isn't too far off what I'm already using... Since I posted the question, I've found references on the internet about switched mode power supplies with a feedback circuit that produce a constant current, I can't find a circuit diag though! I'm wondering if this is more like what I need. \$\endgroup\$
    – BG100
    Jan 4, 2011 at 17:18
  • 2
    \$\begingroup\$ You don't want constant current for most things microcontroller, you want constant voltage. (On the other hand, current limit is extremely useful for preventing wiring mistakes from damaging components.) \$\endgroup\$
    – markrages
    Jan 4, 2011 at 17:37
  • \$\begingroup\$ If you are already using a linear regulator then it sounds like you either need more capacitors or you have an issue with your MCLR pull up or any number of other little things. \$\endgroup\$
    – Kellenjb
    Jan 4, 2011 at 17:44
  • \$\begingroup\$ Here's a similar (clone?) item from SeeedStudio. \$\endgroup\$
    – tyblu
    Jan 4, 2011 at 19:44
  • \$\begingroup\$ @BG100, no you do not necessarily need a switch mode power supply. There are more advanced design, which have far more potential for causing problems (namely RFI/EMC). The efficiency improvement won't solve your problems. \$\endgroup\$
    – mctylr
    Jan 13, 2011 at 16:55
2
\$\begingroup\$

How stable is the power supply's output when you connect it a volt-meter (multimeter)? Is it quite close (less than 10% error) to the nominal value? (e.g. 5.06V for a 5V supply is good)

One potential addition source for glitches caused by the power supply, would be if the power transformer's output voltage is too close to the necessary input voltage of the linear regulator. For example the 7805 linear regulator requires an input voltage of 2 volts higher than the output (i.e. 7V input), and I like to add 1V as a margin of tolerance to make it more reliable. Adding the voltage drop of the (diode) bridge rectifier (1.4V), you want 9.4V peak-peak Vac from the power transformer. That works out to around 9.4 / sqrt(2) = 6.6 or 7Vrms AC.

So a 6Vrms rated transformer would work most of the time, but does not have much (sufficient?) margin of tolerance (AC mains may vary by 10% from nominal value, e.g 108-132 for 120Vac) to withstand potential AC main voltage drops.

Ref: Electronic Circuits Design For Beginners - Chapter 1

\$\endgroup\$
1
  • \$\begingroup\$ Ref. link is not working \$\endgroup\$
    – Somanna
    Jan 4 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.