Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SDETERS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dimmer

Status
Not open for further replies.

Moonwalker031

Electrical
Jun 5, 2010
33
I have disigned a dimmer circuit using Pic12F629. It works fine but with a little electrical noise the pic is resetting. I have added L1 and L2 inductors (see circuit) and some capacitors across the supply but did not solve it completely.

Any idea how to make Pic completely immune to mains noise?
 
 http://files.engineering.com/getfile.aspx?folder=41768d64-bf3c-4ac3-8a83-ba3b81f45943&file=dimmer.jpg
Replies continue below

Recommended for you

What does your supply voltage look like, i.e., how do you know its electrical noise? If that chip series supports it, did you turn on the brown-out detector/reset circuit?

Dan - Owner
Footwell%20Animation%20Tiny.gif
 
The circuit works fine until I switch some fluorescent lights or a driller. Even the motor of a freezer turning on/off was making the Pic to reset. I have captured the noise on the supply line with the scope which goes down to about 2V (ns) and so the BOR kicks in. I always leave the BOR turned ON in my projects - would not like a semi reset and not knowing the state of the micro.
After adding inductors and capacitors (10nF, 100nF , 1uF, 10uF all ceramic in parallel near the Pic) I noticed a little improvement but not as much as desired.
 
A quick look at the PIC part you're using indicates that GP3 can be configured as a reset. All of the pins have multiple functionality, so debugging how the noise is upsetting your processor gets complex. NOTE - I'm not familiar with all of the PICs available, and the last time I did software was, well - - - the previous century.

People sometime try to kill noise with larger capacitors. Actually, a lot of noise issues can be stopped with a very small capacitor applied to the right spot with SHORT LEADS. Long leads on capacitors can negate their effectiveness.

You have I/O ports that are unused - ground them if they're inputs, or at least put a pull-up or pull-down on them even if you're not using them (you might have them active in your code without realizing it, and a long noise burst causing multiple interrupts and quickly put a uP into confusion and into reset. Put a 1nF or 10nF cap on the other inputs. You appear to have plenty of capacitance and filtering on your power supply - enough to power it for a few seconds with power removed. And don't forget the simple tricks - aluminum foil if you suspect a radiated path and not a conducted noise path.
 
If the supply line is dropping too low, you need more capacitance to take up the slack. You can't squeeze blood from a turnip... if the power isn't available, nothing short of a power reserve is going to save you.

Dan - Owner
Footwell%20Animation%20Tiny.gif
 
If it's an EMI issue, then the cause might not show up on the schematic. It might be a board layout and/or wiring arrangement issue.

How much power is being switched by the TRIAC?

If you use a little 7w light bulb as the load, does it still malfunction?

(This is just another possibility for the list...)
 
When I said the supply dropping I meant with noise and not due to not enough capacitance.

I will design another PCB with more shielding and see if it works better.

My last trick would be to save the state in eeprom and read it on reset but that's a little dirty :)
 
EMI design in a nutshell:

You know antennas? Do the opposite.

Good luck.
 
My last trick would be to save the state in eeprom and read it on reset but that's a little dirty :)

Yeah.. That will get you in trouble because you really don't know how many times it's going to happen. You can very quickly burn out the EEPROM. Been there.

Keith Cress
kcress -
 
Noise works from a baseline... if you're losing power to the PIC, your baseline is too low. You can't have a solid 10V coming into your '05 and have a "noise" spike lower the output voltage to <2V.

Include a screenshot of the scope so we can see what you mean by "noise"...

Dan - Owner
Footwell%20Animation%20Tiny.gif
 
At the moment the unit is at the client cos he needed it so he took it as it is.
I will re-design the pcb and test again and post back - maybe nest week.

Thanks for all the tips suggested.
 
Likely the only PCB issue would be to have the high voltage and potentially high current up at one end, and the processor at the other. The wire dressing within the case would be equally important.

Did you investigate if it had any relationship to the current in the load? The 7w light bulb test?

Good luck.


 
Is the turning on or turning off of the triac causing the noise? You might want to try a snubber across the triac. You may also want to drive it with an optoisolator.
 
@Brian - Yes the Triac turn off was cousing some noise but the Pic was reset from external noise. It is driven with an opto already.
@VE1BLL - I was testing with a small bulb about 25W - dont think a 7W would make much difference.
@MacG - Actually I have another unit ordered and I need to add some things and since the components were through hole I want to change to SMD now. I wish I have more free time but this is partly a hobby for me :)

I am attaching the old PCB design maybe someone can spot any problems. PS - the Inductors and not shown as they were added afterwards.
 
 http://files.engineering.com/getfile.aspx?folder=7f6108e9-0c8e-4bdc-bc10-4d7f0bf25384&file=dimmerpcb.jpg
I think that you should make a new PCB.

The one you show has so many issues that I'm surprised it works at all.

There's no ground plane. Your ground meanders around the board from P2-2 to S1-2 like a Monza Circuit. Pour copper for a proper ground plane instead. That is, as I see it, your first and main problem with the design.

There are quite a few more. If this is going to be a commercial product, it will never survive in the market. Too expensive. Too many components. An example of a succesful commercial design is shown below. One of the simplest PICs ever, no A/D. No transformer and still does timing temperature control and humidity control.

We designed that sixteen years ago and the product has now been replaced with a smarter one. So esign is free. It works off a 230 V 50 Hz grid and we had a few problems during beta testing. Adding a ground plane solved those problems.

XXX_kretsschema_temp_fukt_timer_etc_1_w_comments_ewxrfp.png


Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
I know the ground track runs a little around but adding the inductors and capacitors near the Pic should have solved the noise issue.
Anyway I designed that some time ago and tried to use only 1 layer. I will change to smd now and add proper ground plane.

But I still prefer to use a transformer in my projects instead of the RC circuit.
 
In addition to adding the close coupled capacitors on the inputs (as mentioned above) you might try dropping the value of the 10k pull-up resistors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor