Erratic circuit behavior upon touch

Hello everyone,

I am in the process of putting together my universal NiMh charger circuit, right now I solve one problem only to end up in another. I don’t have a proper schematic of the circuit so apologies for that, I plan on including it in my blog and completing a write up on it once everything functions with no issues.

The weakest link of my design is the SMPS half bridge power supply mainly because I am not good at power electronics but yet I desire a bulky transformer free design to feed controlled power to the battery in order to charge it.

I have attached a picture of the circuit to give you an idea about my layout and the strange problem I am experiencing and I hope maybe someone can enlighten me about the cause.

Ok so as I start up everything works normally, I start a charging process and nothing abnormal happens but as soon as I bring my hand closer to the microcontroller circuit board(as shown in the picture) my LCD becomes blank the relay that I have mounted on the controller board starts clicking fast and only after a reset things become normal again, so the erratic behavior is not the controller resetting but it malfunctions, atleast that is what it seems during this erratic behavior the LCD might or might not display random garbage characters.

Anyway the capacitor shown in the picture is a 2200uF output filter capacitor of the power supply, whenever I touch this capacitor by my finger and then try to bring my hand closer to the controller board in hopes to cause a malfunction, absolutely nothing happens, as if the problem wasn’t even there while my hand is close to the controller board and I lift my finger off the capacitor the controller board malfunctions instantly!, here I would like to mention that the SMPS only shares a common ground with the controller board and the controller board is powered off a small transformer and a rectifier setup feeding an 7805 regulator.

In order to further move in on the problem I touched one end of a wire on the top of the capacitor and touched the other exposed end of the wire with my finger and then brought my hand closer to the controller board and as expected everything worked correctly and the controller did not malfunction.

Later on I disconnected the SMPS and turned on the controller only and tested by putting my hand closer to the controller board and everything worked OK, so the problem IS the SMPS and its output noise, if I may call it, is being coupled to the microcontroller board via the supply wires ( as disconnecting them took away the problem).

Another important thing to mention is that while I touched the capacitor I was sitting on a chair and lift my feet off the ground to makes sure this isn’t some sort of an earthing issue, if that makes sense? so as long as I am touching the cap everything works fine.

If someone has faced such a problem before it would be great to have any input on this matter.

Many thanks

This is a common problem. It is caused by a floating input, that is an input not connected to anything. Solve it by connecting all your inputs, if you can't find what input is not connected, as quite frankly your layout is a mess, then enable the internal pull up resistors in all the inputs.
It can also be caused by not having a common ground on every sub circuit.

You draw a schematic before you build anything because without a schematic you do not know where to connect things. If you think you do then you are wrong and will never learn anything in electronics.

Thanks Mike, that sounds like a plan, I have used external pull ups and pull downs on all the inputs that I am using however I believe since the unused ones default to inputs for an arduino and have nothing connected to them so they can, like you said be causing this, so I am going to enable internal pull ups on all my unused pins now.

Again apologies for the terrible layout and no schematic to show you, I know without this it doesn't make sense to ask for help, I am in a rush to finish this prototype and I am currently working with four schematics as I divided this project in phases, anyway I must put all these schematics together as one.

Thanks again!

Just quickly made a list of all my inputs either used or unused ones and turns out I only have two unused inputs, enabled internal pull up on it and and the problem still doesn't go away, the rest of the inputs have pull down connected to them.

Ok, I am pretty sure the problem is coming, as soon as I bring my hand closer to the area where the crystal oscillator (16Mhz) is installed, I am using the recommended 22pF caps with the crystal. Need to probe into this.

I didn't mean unused inputs, I meant used inputs. You might like to check the wiring on your circuit. You might have a ine that you think is ground or +5 but it is not connected to the ground or +5 of the rest of the circuit. Been there, done that, myself.

Thanks again Mike, will double check all the pull ups now.

I see. So you are saying.... no issues at all when your systems are not being powered with your switch mode power supply, right?

I see. So you are saying… no issues at all when your systems are not being powered with your switch mode power supply, right?

You read that right Southpark, upon touching the main filter cap no matter what I do to the circuit a malfunction won’t be caused. as soon as I remove the finger from the filter cap a malfunction occurs, now either I can do something to the SMPS which ofcourse is the source of the noise OR I can make the controller immune to noise as it is being suggested by MIke, either way, as long as its a fix I will take it.

What do you suggest? I am frankly stuck as I don’t know a great deal about SMPS or power electronics in general, I have high frequency noise on my SMPS output which I am sure is being caused as my output rectifiers are conducting (I can say this because probing with a scope tells me high frequency spikes at the output is present in phase when the output rectifiers are getting forward and reversed biased, if that makes any sense.

I am attaching a few pictures of the scope measurements I took, the blue wave is the output from the SMPS and the yellow graph is the output from the output rectifiers just before the CLC filter.

In the other picture the yellow square wave is the transformer output which seems fine and I have installed snubbers at it achieve this result, while the blue graph remains the output.

I have read many times that output caps should have low ESR’s as this is a requirement for a clean output but then again components aren’t that easy to find here, right now I am also thinking about making up a capacitor bank of 10 parallel 220uF capacitors to decrease the effective ESR and see where that takes me.

I can easily replace the SMPS with a linear power supply and call it a day but I really want to learn to make and use SMPS in my design.


Got much decoupling in the system?

Great write up Mike! very informative to say the least, I think I have enough de-coupling with a main 100uF for the whole board and 0.1uF ceramic caps soldered directly on to the ATMega328p between Vcc and GND, and AVcc and GND, however the inductor decoupling method is surely worth a shot, after reading the article I am starting to wonder if the big electrolytic capacitor that I am using at the output of my SMPS is doing enough to filter high undesired frequencies? I do also have a ceramic 0.1uF cap in parallel to it but may be thats not enough, may be paralleling up smaller caps will do good to filter out the the noise?

apologies for so many questions, I know I havent provided a schematic and I must get to that first.

I think I have enough de-coupling with a main 100uF for the whole board

Sounds a bit small, try 470uF or 1000uF.

470uF doesn't seem to be making any difference I will get 1000uF tomorrow and try those

I am dealing with a noisy environment thats for sure and I noticed as soon as I put my hand close to the 16Mhz external oscillator the problem starts to occur, I have been doing some reading and it appears the arduino uses low power crystal oscillator burned in the fuse bits as default while full swing oscillator although consumes more power but offers better noise immunity, could this make a difference? I am not sure though how I can do this.

Keep your hand away.
Or change the fuses. Which board type do you have the processor set up like?
Uno settings, from boards.txt in IDE 1.8.1:

uno.bootloader.low_fuses=0xFF << lower four bits here select the clock source



Device Clocking Option CKSEL[3:0]

Low Power Crystal Oscillator 1111 - 1000

Full Swing Crystal Oscillator 0111 - 0110 << so change 0xFF above to 0xF7 and reburn the bootloader using a Programmer.

Thanks CrossRoads,

Well, I can't, there are buttons I needs to press to program the charger before a charge cycle begins and the main controller board just happens to be mounted close by, yes, I can try to be extra careful and all but it will still be a problem waiting to pop up anytime I am a bit careless.

I have the board setup as an arduino uno, I have a chipless board that I put in the atmega328p every time I need to program it.

I can locate the uno.bootloader.low_fuses=0xFF in the board.txt files, I think I must try to change it and try burning the bootloader again to the chip like you said.

Thank you very much CrossRoads for giving me exactly which fuse bit to change, I am happy to report that I have just finished making some tests and I can say that this has resolved the issue, I poked right at the cyrstal oscillator touching the body which used to almost instantly cause the freeze up but now with the changed fuse bits its solid as a rock! Took the whole day but in the end I am glad things worked out.

Many thanks Mike for sharing some amazing information with me regarding decoupling caps, your article has given me a whole new perspective regarding decoupling and these guidelines shall forever stay with me, I can't thank you enough.

I hope this was the last issue which I had to face with this project!

Best wishes to you both.

Best wishes to you both.

And to you for getting back with your solution. That is a new one on me I will remember it.

And to you for getting back with your solution. That is a new one on me I will remember it.

Any idea what the issue was? Changing fuse is a 'firmware/internal settings' issue?

It was using an oscillator that was incompatible with the fuse setting in the chip.