Maker Pro
Maker Pro

Parasit effect at the input port of a microcontroller

Emam

Jul 7, 2014
63
Joined
Jul 7, 2014
Messages
63
Dear all,
I have a problem with my microcontroller.

My mircocontroller should perform certain job when the satuts of an input port (lets say PORTB.RB1) is set to 1.

So if (PORTB.RB1==)
{
// do the job
}

My problem: sometimes I receive paraist effect on the port. In other words sometimes there is electronic noise at this input.
So the job is done even if PORTB.RB1==0 !!

For long time I tried to understand. Then I understood that the problem could be related to my laptop near to my microcontroller. Every time I connect my laptop to power, suddenly there is anoise generated on my microcontroller port.
Even I have another electronic devcie close to my microcontroller. When I connect it to power, I receive this noise.

Can you please tell me how can I avoid this problem? can I put a capacitor at the input port of my microcontroller to filter it ?

Thank you and bests regards,
 

AnalogKid

Jun 10, 2015
2,893
Joined
Jun 10, 2015
Messages
2,893
That is a start, but to be sure we need a schematic of the circuit generating the normal signal into the port. For almost any electronic device or circuit, there is a current surge, called inrush current, when it is attached to a power source. Depending on how fast the surge starts, it can radiate high frequency interference. Since you can't modify the laptop's internal power supply design to add or increase its "soft-start" capability, you are limited to dealing with the interference at its destination rather than at its source. Shielded wire and series lowpass filters are options, depending on the signal.

ak
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,724
Joined
Nov 17, 2011
Messages
13,724
In addition to AK's request for a schematic diagram: you can try a software solution called debouncing. It is primarily designed to cleanly detect pushbutton action, but can generally be employed to reduce sensitivity to any kind of noise on a digital input port.

Harald
 
Top