Arduino powering dc fan with relay

Hi,

I’m relatively new to Arduino and electronics so please bare with me.
I’ve designed a circuit that runs the ATMega328P chip and two DC fan’s from a 12V DC power supply, it all works fine but every now and then when I switch off the power supply I see a false interrupt occur on the switch pin, like a spike and then it blows the transistor that controls the relay.

I think it’s a very basic circuit, but something is fundamentally wrong here.
Any advice would be greatly appreciated. I’ve included the diagram of the circuit.

Thanks.

basic controller.pdf (33.8 KB)

There is diodes (anode to negative) in parallel with fan-motors?

Hi, looking at your circuit, D3 and D4 in the diagram are the wrong way round, they will not conduct to supply the relays, they are not necessary anyway, D1 and D2 do the protection required.
Place a 10uF capacitor in parallel with C2 at the voltage regulator.
Place a bypass cap across the supply pins of the CPU chip.
What is your 12V supply?
You need to hold RESET pin high with 10K resistor to prevent reseting due to noise.

Tom....... :slight_smile:

Thank for the replies.
My 12V power supply is a AC/DC wall adaptor that provides 12VDC 1.2A.
I will try out all your suggestions and test it

Thanks again.

TomGeorge:
Hi, looking at your circuit, D3 and D4 in the diagram are the wrong way round, they will not conduct to supply the relays, they are not necessary anyway, D1 and D2 do the protection required.
Place a 10uF capacitor in parallel with C2 at the voltage regulator.
Place a bypass cap across the supply pins of the CPU chip.
What is your 12V supply?
You need to hold RESET pin high with 10K resistor to prevent reseting due to noise.

Tom....... :slight_smile:

Thank you for all the suggestions.
I've made the changes as suggested, I've removed D3 & D4, added a 10uF capacitor in parallel to C2, added a 0.1uF capacitor across the supply pins of the uC and added a 10K resistor as a pull-up on the reset pin.

I'm happy to say that the transistor does not blow anymore, but I still get spikes when I switch it off that triggers the interrupt on the switch pin, any idea why that happens?

but I still get spikes when I switch it off that triggers the interrupt on the switch pin, any idea why that happens?

Hi, what switch is it you are talking about? What happens when the interrupt is triggered?

Try 100uF or 1000uF on the 12V to gnd, this will slow down the speed of shutdown at the input of the 5V reg.

Tom..... :slight_smile:

You may have a grounding problem, a picture is nice too see.

Thanks again for all the responses.
Ok so I tried adding a 0.1 & 10 uF capacitor in the schmitt trigger iC and added a 10 and 100uF capacitor on the 12V power supply, but I still see a spike about 1 out of every 10 times I switch it off. The circuit is currently on a bread board, but I’ve attached a PCB image of what it looks like.

When I receive an interrupt on the tactile switch, I change the temperature setting on the controller and it’s saved into the eeprom. So the next time you start the temperate setting is changed.

You are weaving the power traces all over the PCB. Causing an inductance situation.
They will pick up noise.
You need to use a ground/power plane.
Your de-coupling capacitors need too be right next the pins of the I.C.s, one for each power pin.
Thin traces increase resistance.

Hi, a tip with PCB, leave as much copper on the board as possible.
You will then get better conduction with wider tracks, better filtering with ground planes, more for your money (copper that is), less etching (got to be better for the environment).
If possible leave copper all around the edge of the board, and make it ground.

Tom...... :slight_smile:

Thanks for the replies guys, I will redo the layout of the PCB, but as mentioned the setup is currently on a bread board and that is where i"m experiencing the issue.

Hi, if you are still on the breadboard, then your problem could be due to wire length and placement, current running through the breadboard.
Can you post a picture of your project and let us see your layout.
We assumed that you had it on PCB. (Missed the bit in your second last post.)

Tom..... :slight_smile:

TomGeorge:
Hi, if you are still on the breadboard, then your problem could be due to wire length and placement, current running through the breadboard.
Can you post a picture of your project and let us see your layout.
We assumed that you had it on PCB. (Missed the bit in your second last post.)

Tom… :slight_smile:

Ok I’ve included a picture of the breadboard, not sure if you can make out much.

Hi, thanks for the pic, I’d say your problem will go away once you have it on PCB.
For example the long wires you have on the crystal connecting it to the arduino, I’m surprised its working.
So take the advice given by the proceeding messages about PCB design, and enjoy.

Tom… :slight_smile: