• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

strange circuit behaviour when using wall wart instead of battery


Super Moderator
Most Helpful Member
As has already been suggested, connect a 1000uF capacitor (or larger) to the output of the wall wart and see what happens.
It is a quick test, just do it.



Super Moderator
Most Helpful Member
How do you calculate 100x a second?
Twice the mains frequency. It will be 120 times per second if you have a 60Hz mains supply.

and the 100uF caps for the regulator isn't sufficient then?
No, it is probably no where near sufficient.

Thread starter #23
The 1000uF caps I have are too big for the small space on my board I have to decouple the supply. I'm going to go try a regulated adapter instead of the unregulated one I got on hand. If I can find higher value capacitors locally that are small in size (< 5mm diameter) then I'll look into that as well. I won't be able to run these tests until I can get to the store next week.


Well-Known Member
The wall wart is the problem. It's a non-regulated, poorly filtered unit.

A good place to get wall warts is the thrift store or computer recycler. If you can find a 5 volt cell phone supply, dump the regulator. If you don't want to ditch the regulator, you need a regulated switching wall wart of at least 7 volts. You may be able to find a 9 VDC supply, which would be ideal. But I bet your circuit current draw is nowhere near an amp. More like less than 100 mA. so if you can't find a 9 VDC supply, try a 12 VDC supply. Chances are good that your regulator will be cool to the touch and perfectly happy.


Well-Known Member
Take a look at this article. It may be interesting reading.

AC-DC Power Supplies - Using Wall Warts

I power most of my projects from re-purposed cell phone supplies. I virtually never use a regulator.


1. Measure the output voltage before using the supply. A couple days ago, I used what looked like a regulated 12v supply, and it was putting out almost 17 volts.

2. Verify the polarity of any supply you use. If you cut off the existing connector, don't assume red is the positive lead and black the minus!

If a re-purposed supply was originally a center-negative supply (i.e., the center of the connector was negative), the red wire will often be negative. Since the usual case is a center-positive configuration, cables are built with the red wire to the center contact. For a center-negative supply, the csble is just connected backwards in the supply rather than using a non-standard cable.


Well-Known Member
Most Helpful Member
You said your wall wart produces over 10VDC, but maybe that is without a load. But it is labelled 6V.
The datasheet of a μA7805 says that its recommended minimum input is 7V so yours has dropped out and is not regulating. The wall wart probably has ripple so the minimum of the ripple must be 7V. Your meter measures average voltage, not the minimum of the ripple.

The ripple for full wave rectified 50Hz mains electricity is 100Hz (100 times a second).
Now you measure +4.9V from the output of the 7805 so it and the wall wart are fine. Something else is wrong.


Well-Known Member
Why didn't you show the hole board like how is the battery hooked up
You say it works find on battery you got something wrong with the regulator setup probably some thing backwards.
Thread starter #30
I attached the same connector to the batteries as the wall wart uses to plug into circuits.

Now I tried connecting a 1000uF/25V capacitor at the points where the power enters. (input of regulator and ground) for a total of 1100uF.

When I tried batteries again, things worked again.
I try with wall wart and still I get the same bad results except I noticed that once I unplugged the wart plug from the circuit the LEDs went out semi-slow instead of almost instantly (Probably because of the 1000uF capacitor)

Sadly I won't be able to get a regulated power supply for a week.

But I also read that I could make a PI filter to use between my circuit and the unregulated wart. Is that going to work do you think?
Thread starter #31
The wall wart is the problem. It's a non-regulated, poorly filtered unit...If you don't want to ditch the regulator, you need a regulated switching wall wart of at least 7 volts.
Ok, but I did switch my regulator from the 7805 to an LM2940CT-5 since the datasheet says its max dropout voltage is 0.5 so wouldn't a 6V wart work?

And I'm assuming with the regulated warts, the amps specification is the maximum it can provide to the whole circuit at its specified voltage?


Well-Known Member
You plug in 6 volt battery at red arrow
Yor regulator maybe backward that's why it works with the batteries
if the volts not to much over 5 volts the regulator will output backward i had some from years ago
lm7805 that was output on the left gnd then input they would try to block if voltage was 3 or 4 volls higher

I was like whats going on power not right i figured what the heck un soldered it switched it around bang it worked never tried batteries tho but 4 AA i bet would pass if the draw not to high I do no they will if the load not that much. And voltage close to the dropout
Last edited:
Thread starter #33
You plug in 6 volt battery at red arrow
That I am already doing.

Your regulator maybe backward that's why it works with the batteries
I double-checked all connections and they are correct. In fact, I go so paranoid that I sometimes use a utility knife to scrape off random green non-conductive material that sits between the tracks. this is because I dont want to see VCC and ground connected together by a tiny track that wasn't part of the PCB diagram.

if the volts not to much over 5 volts the regulator will output backward i had some from years ago
lm7805 that was output on the left gnd then input they would try to block if voltage was 3 or 4 volls higher...
I read the datasheet to determine how to connect it. I don't want to gamble by flipping it and again, I'm using the LM2940-CT regulator, not the 7805.


Well-Known Member
Most Helpful Member
I think the regulator is right. Not backwards.

Back when I used mechanical voltage meters, -5V was very different than +5V. (meter went to the left/right)
Now I have to look very closely. -5.03 looks much like 5.03. Some times I read it wrong.
I also have a problem that 5.03 (volts) looks much like 5.03 (mV). and 5.03 (kV)

Maybe this kind of errors only happen at my house.


Well-Known Member
Have you checked the ground pin and the VCC pin with the power off test its resistance.
It should be high kohm not in the ohm scale.
Lot's of wall warts will try to shut down on short or a big voltage drop.
Batteries don't till there dead
Thread starter #36
Ok I seemed to have fixed it.

My micro to micro setup of sharing a crystal is like the following (except I use at89C4051 for the micros). Initially I had C1 as 33pF, nothing for C2 and the crystal as 22.1184Mhz. C2 was nothing because I was depending on the PCB itself to produce capacitance. I did however make the tracks at least 50 mils thick (yes I do alot of things thick since today's printers are $**%.) for the crystal so the board won't heat when the signals go through.

Now I put two 10pF capacitors in parallel (to make 20pF for C2) and things worked both for battery AND the unregulated wall wart and this was tested without the need of the additional 1000uF that someone suggested as the fix.

Thread starter #37
question is tho... is 20pF 100% acceptable or should I change the value? I deliberately made it lower than 33pF because I heard that capacitance increases where xtal1 and C2 meet up because more micros are connected and each pin has capacitance? but I don't know the math, but at least the addition of the 20pF was a help.


Well-Known Member
Firstly, make sure you have Xtal2 (pin 4) of the master oscillator connected to Xtal1 (pin 5) of the slave oscillator. The capacitors are on the master oscilator and Xtal2 is not connected on the slave oscillator.

What are the specifications of the crystal? Load capacitance, package shape etc. How far apart are the two microcontrollers?

The capacitors are there to provide stable operating conditions for the crystal. C1 provides load so that current can flow in the crystal and C2 helps to smooth the fast edges of the inverter switching. Without suitable conditions the crystal won't oscillate. In your case I suspect that noise from the power supply caused unwanted oscillation which prevented the crystal oscillator from starting. The capacitor reduces the noise and allows the oscillator to work normally.

The crystal will take up to about 1 ms to start up. At start-up, wide-band noise is being amplified by the oscillator amplifier, and the crystal only allows through the correct frequency, which gains amplitude until the amplifier saturates. If you look at Xtal1 or Xtal2, with an oscilloscope, there will be no visible signal for more than half of the start-up time, before the signal amplitude increases exponentially. During the early part of start-up, the circuit is very sensitive to noise.

This shows a typical crystal oscillator start-up:-

You can get an unwanted oscillation that starts up much faster and prevents normal crystal operation. You can even get the situation where if you touch the crystal connections with a 'scope lead, the oscillator starts and is then stable with the scope lead removed.

The correct value for the capacitors is whatever gives the most stable operation.

Changing the capacitor value will also change the frequency a bit. If you are not worried about 0.1% or smaller frequency errors, you can ignore that. If you are, then you may need to adjust the capacitor values to give the correct frequency, and it will probably not affect the operation noticeably. If it does, you need to buy a crystal with a different load capacitance, or change the circuit design.

Latest threads

EE World Online Articles