Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] AC switch resets the microcontroller

Status
Not open for further replies.

mamech

Full Member level 3
Full Member level 3
Joined
Nov 9, 2010
Messages
176
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
3,135
Hello

I made a circuit that can light a lamp either by a computer command (through a micro) or can light it using 3 way switch. The interface between the micro and the lamp is done using moc3063 optocoupler and two triacs.

The circuit works well if I turn the lamp on and off using micro and triacs, but when I use the 3 way switch, sometimes I found the micro resets !!!

This very weird because the AC supply from 3 way switch to the lamp is completely isolated from micro circuit. The only common thing that both are supplied from the same power terminal.

I suppose that that may happen because of the fact that I turn on the 3 way switch in random point during the half cycle, so that may cause harmonics for example and may be these harmonics goes to the supply of micro circuit and cause severe noise, while that does not happen when I turn on from micro, because it starts only in zero point, because the optocoupler has ZCD.

I am just concluding , but I do not know if my conclusion is right or not.
Also, if my conclusion is right, what should I do to protect micro circuit? I tried to place 1uf cap between the vcc and ground of the main supply of micro circuit, but the problem still exists.



Thanks
 

Strong interferences injected by the power supply have to be considered in electronic design. Electronic products are required to be hardened against it by EMI regulations. For hobby designs, it's more a matter of your personal demand. But it's surely possible to make a hobby circuit behave like a professional product.

Besides power supply bypassing (a single 1 uF capacitor may be not enough), it's mainly a question how your ground net is wired. Is it a bread board or vero board setup? Also uP pins wired to the outer world may need series resistors as transient protection and possibly overvoltage absorbing means.
 

Besides power supply bypassing (a single 1 uF capacitor may be not enough)absorbing means.

What is the value that I should use ? 0.01 uF for example?

Is it a bread board or vero board setup? Also uP pins wired to the outer world may need series resistors as transient protection and possibly overvoltage absorbing means.

Currently I am testing this on a bread board, then I should draw it and make a pcb circuit.
 

What is the value that I should use ? 0.01 uF for example?
1 uF can be expected better than 0.01 uF. "A single 1 uF capacitor is not enough" rather refers to the need of more and other supply filtering.

For the time being, you can assume that the bread board setup is causing the problems. If the final PCB design is fixing it, depends on. We would need to discuss the implemented filter means and the layout details.
 

sorry to ask again. But does the EMI has a relation with the harmonics caused by turning on the switch at a random point in the half cycle?

I think the main reason of that is that the 2 plugs -of both of the pure Ac source (for powering lamp) and the rectified AC (for micro circuit)- are very close to each other. I have made an experiment to test if the circuit will reset when I switch the lamp of my room (supposed to be relatively far from rectified AC source feeding micro, but I was still in the same room) on and off, but the circuit did not reset, although the case here is somewhat similar to the above mentioned.
 
Last edited:

Did you try powering your micro supply from a rather far AC source while leaving everything in place? (only the AC cable needs to be made longer)
If the uC resets again then you will be sure that the interference doesn't come from the AC source.
 

But does the EMI has a relation with the harmonics caused by turning on the switch at a random point in the half cycle?
The EMI is caused by contact arcing. Obviously a mechanical switch will operate unrelated to grid phase, you simply have to take these interferences.

Distance of the arcing contact matters of course, also existing coupling pathes. If your circuit is near to the switch contact, even an "antenna wire" connected to the ground of your breadboard circuit can create sufficient succeptibility. RC snubbers or varistors accross the contact can reduce the arcing. But because it's impossible to provide it for any arcing contact in the vicinity, you should rather try to achieve better interference immunity of your electronics.
 

I tried to supply micro circuit from outside my room, and tried to make the switch somewhat far from the bread board. But both ways did not solve the problem, but they made it worse
 

But both ways did not solve the problem, but they made it worse
Which seems to validate the statement, that the problem is brought up by the bread board design.
 

As a last try, do you think that an RC snubber may make things better ?
 

I am not sure if this may help but perhaps a general view (pic or pics) of your installation (bread board and its wiring) could show some weak points in front of an external EMI.

Meanwhile let us try another test to check a possible weak point. It is about the MCU reset pin. While the MCU is running properly let us try to add a suitable resistor between the reset pin and ground (or Vcc, this depends on the MCU type, for example the reset of AT89C2051 should be grounded to keep the MCU running). Perhaps a wire jumper can be used instead (please note that as long we don't have a clear idea with what you are working... nothing is for sure). In any case, the main idea is to force the reset pin to keep its logic level as it is, so that any interference cannot change it. If after doing this the MCU resets because of the switch... then we will go to the next one :smile:
 
  • Like
Reactions: mamech

    mamech

    Points: 2
    Helpful Answer Positive Rating
Thanks, Thanks, manyyyyyyyyyyyyyyy thanks :)

It was the resistance on mclr as you said, it was higher than required.

sorry for late reply.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top