Inductive Emf from desk fan causing issues with my embedded project

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
Fan 220v when switched from speed 2 to speed 1 toggles an input pin on my micro controller.

Simple circuit Micro has 1 input pin which is used with a pull up configuration, with a 500ms delay toggles an output pin high or low.
Micro is powered from a built in USB socket in a seperate wall outlet.

HELP. What can I do to restict this issue. I've tried putting a series diode to the 5V supply to the micro with several different capacitors.

Utilising a DC battery is not viable
 

spinnaker

Joined Oct 29, 2009
7,830
Move the fan or move the MCU or turn off the fan. ;)


Seriously, is this just a small little fun project? If so sometimes the simple answers are the best.
 

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
I have indeed got 100nF caps on there too @MrChips wondering if adding the bypass capacitor to the input pin of MCU would help ... Since ultimately that is what's toggling.

It's a bedside lamp control circuit hence the fan cannot be moved since that's also used beside the bed. . . @spinnakerw
 

philba

Joined Aug 17, 2017
959
There are a lot of ways that emi can get into a circuit. You need to take a systematic approach to tracking it down.

You don't give much detail. Need more to possibly help. Post your schematic and pictures of your circuit.

How is your circuit built - PCB, solderless breadboard, hand wired point to point?
What is the input to the pin that toggles when the fan is on? Touch sensor?

You mentioned battery, did you try that? Worth a try to determine if the emi is coming in via the USB cable.
 

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
There are a lot of ways that emi can get into a circuit. You need to take a systematic approach to tracking it down.

You don't give much detail. Need more to possibly help. Post your schematic and pictures of your circuit.

How is your circuit built - PCB, solderless breadboard, hand wired point to point?
What is the input to the pin that toggles when the fan is on? Touch sensor?

You mentioned battery, did you try that? Worth a try to determine if the emi is coming in via the USB cable.

Sorry about the lack of detail, powering the mcu from a power bank eliminates the issue.

The circuit is point to point soldered since contains very few components.

The sensor is just a simple membrane button.

I'll get back to you shortly with a schematic.

Issue resides in the AC spike on the USB power
 

MaxHeadRoom

Joined Jul 18, 2013
30,654
Is the fan frame earth grounded? Many are not.
It may help to ensure the fan frame is earthed and also earth ground the common of the Micro circuit.
Max.
 

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
The outlets are earthed, please see photo of plug where the 5V is coming from.

Unfortunately I could only draw a crude drawing of the circuit, but this is all there is to it.

Powering from USB power bank eliminates the issue.
 

Attachments

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
Do you have a EMF diode across the relay coil, what about using a zero cross Triac and Triac opto MOC316x etc.
Max.
Yes the diode is in place, also that issue would also have been visible if powered form powerbank.

I wish to remain with the relay set up and identify the root cause.

I have the various bits of equipment to analyse the voltage: Oscilloscope, DVM etc. This post is to gauge how to tackle the issue, ofter people just say put the oscilloscope on it, but that's obviously not going to fix anything other than show the inductive noise.
 

MaxHeadRoom

Joined Jul 18, 2013
30,654
The outlets are earthed, please see photo of plug where the 5V is coming from.
The outlets may be earthed, but is the fan frame earth grounded?
Did you try the 5v common to earth?
A USB outlet from a PC has the common grounded, but not necessarily on a wall wart version.
Max.
 

philba

Joined Aug 17, 2017
959
I've never seen a USB power adapter with a ground pin. Not saying they don't exist but they certainly aren't common.

The USB cable is probably acting as an antenna. Try a cable with a ferrite choke or add one. A lot of USB devices have a ferrite bead on the inputs. Btw, your 1N4002 is doing nothing other than dropping the voltage by about .7V.

[edit] it's also possible that your cable is retransmitting the EMI to your switch. Maybe try a stronger pull-up - say 10K or 4.7K. If you are using the internal pullups of the MCU, that may not be enough. [/edit]
 
Last edited:

Thread Starter

aqibi2000

Joined Mar 2, 2016
8
The outlets may be earthed, but is the fan frame earth grounded?
Did you try the 5v common to earth?
A USB outlet from a PC has the common grounded, but not necessarily on a wall wart version.
Max.
I'm not too comfortable doing that, Earthing the 0VDC would mean you loose your galvanic insulation. I know this is the case for ATX power supplies in PC however the SMPS used in the socket may be unconventional.

I'll add a Ferrite chock next
 
Top