Continue to Site

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.

  • 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.

Microcontroller Noise - PLEASE HELP

Status
Not open for further replies.

ahonda55

New Member
Hello, first of all I know that my problem has been discussed a lot before, but for me I am living with it for years without any solution.
Simply, I have built a circuit to open specific port when another port pulled down, everything works great, but the drama starts when I connect the long wire to the switch, it works also, but, open or close the flourescent lamp, and with every click, the microcontroller misbehave.
I am using 100nF and bigger and smaller capacitors everywhere, also I am using a PC power supply, 10k or 1k pull-up resistors everywhere, tried a BC547 and BC327 before the port, worked but again, when I connect the long wire I get noise a lot, tried CD40106, the same.
PLEASE help me to eliminate this problem, years a go I have built a lot of circuits with the same problem, noise from flourescent lamps and other electromagnetic noise sources.
!! PLEASE HELP !!

Thanks a lot :)
 
Hi,

Do you have control over the program such that you can change it?

Also, are you using the 'on change' feature or just polling the port that has the switch?

Did you try a cap across the port with a resistor in series with the switch?
 
Thanks for your reply, yes I have written the program, it is very simple, port x1=1 when port y1=0 and so on.
I am using "if" statement, so when port y1=0 port x1=1, that simple. And I have to connect a long wire to the port, ends with a pushbutton, the wire is about 10m long, everything works great without the long wire.
I will try the cap with a resistor, can you give me some numbers?? the resistor and the cap.
Thanks a lot :)
 
By the way, when I connect the long wire, the noise affects the microcontroller like I pushed the switch even if i didn't touch it.
 
I can't believe this, I have put a 10nF across the input port, and a 1k resistor in series with the swich, the problem decreased drastically!!
Now when I put the wires inside a wall, it may get beside the electric lines, I hope nothing will happen.
I am just stunned, how a simple RC connection makes such a diference.
Thanks a million MrAl :) you really helped me to start fighting that bad dream :)
 
If you have access to the source code and the intended switching is slowish, you can debounce the input in software.

i.e. only change the other port only if the input port is active after say 1 second.

You may also want to protect the input port electrically as the spikes maybe lifting the input and therefore the power supply and causing further problems.
 
If you still have a problem you could try using thin coaxial cable for your long wires. Connect the shield to ground.
 
I can't believe this, I have put a 10nF across the input port, and a 1k resistor in series with the swich, the problem decreased drastically!!
Now when I put the wires inside a wall, it may get beside the electric lines, I hope nothing will happen.
I am just stunned, how a simple RC connection makes such a diference.
Thanks a million MrAl :) you really helped me to start fighting that bad dream :)


Hi again,


Hey you're welcome.

Note the cap should be close to the chip as well as the resistor. You can increase the cap if you have to. The switch time will increase as the cap increases, so keep an eye on that too. A good way to select the cap value is to find a value where it still fails, but fails only once in a while, then increase that cap value by 10 times (or more if time permits).

The idea in software is to look for a logic state that exists for a more lengthy time period. If the pin goes low, check it several times to see that it did not go high too soon. If it did then reject the (invalid) switch closure and wait for a short time period, if it doesnt accept it. That's basic switch debouncing.

And i wish you the best of luck with it.
 
Last edited:
Thanks a lot my friends :)
I am already added the "hystersis" to the code, and the problem was not solved, but, the capacitor-resistor connection solved it, later I knew it is a "Low pass RC filter" which I did not expect to get all that effect from such a simple addition.
By trial and error, a 1K ohm and 100nF RC values, the circuit became extremely immune to noise, that problem made me mad for years, every single circuit I have made was affected by any noise caused by a relay or any capacitance or inductance sources of noise, now I really can't believe the problem is gone :)
I really want to thank MrAl and all of you, the world is beautiful with people like you.

Greetings and thanks a million :)
 
Hi,

Yeah i know these problems can be a pain sometimes. Im happy you got it working finally. Nice right :)
 
Status
Not open for further replies.

Latest threads

Back
Top