Controlling Furnace with PIC

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Controlling Furnace with PIC

Post by BrennanU »

Good evening all,

I am working on a small home/garage automation project. In the project, I have a Raspberry Pi that communicates to a PIC18F45K22 microcontroller via Serial. The PIC recieves those commands and turns on I/O connected to a relay board. The relays control a number of things including a siren, and an electromagnetic door lock. This portion of the project is working well, however I would like to add the ability to control the furnace so I can schedule the temperature setpoint. I have a couple of DS18B20 temperature sensors, and based on that I am trying to control the relay which closes the contacts on the furnace and turns on the heat.

The issue I am having is that when the electronic ignitor comes on, the PIC resets, which in turn shuts off the relay. It would continue in a cycle of this indefinitely if I don't stop it.

Does anyone have any suggestions how I could prevent this from happening? I attempted placing a a decoupling capacitor of either 4.7uF and 1 uF across the 5V running the PIC, and it doesn't seem to help. Additionally, I tried disabling the /MCLR pin on the PIC in hopes that that was triggering the reset, but I still have the issue.

Thanks,
Brennan

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Controlling Furnace with PIC

Post by adafruit_support_mike »

What power source are you using for the RasPi and the PIC?

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

Right now I am using an old PC power supply for 12V (to power siren, door lock, etc) and then I have a CUI Inc V7805-2000 (http://www.cui.com/product/resource/v78xx-2000.pdf) DC-DC converter to bring the 12V down to 5 for the temperature sensors, PIC and relays. The PI is running on a USB wall-wart for now.

Eventually I would like to purchase a security system power supply with backup battery, and move the Pi to the DC-DC converter.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Controlling Furnace with PIC

Post by adafruit_support_mike »

That's a pretty good setup, but if your supply is connected to the same circuit breaker as the furnace, you might be getting spikes on the wall supply.

Furnace motors are like air conditioners and refrigerators. It takes a fairly large pulse of current to get them started.

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

Any suggestions on how I could filter it? I will try hooking it to a 12V battery sometime to see if it is coming through the AC power, or the control wire. For what it's worth, the PIC seems fine when the igniter fires under the standard thermostat.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Controlling Furnace with PIC

Post by adafruit_support_mike »

Could you post a diagram showing your connections please? It's possible that you're getting something like flyback voltage on the pin that sends signal to the furnace.

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

The pin on the PIC is tied directly to the SainSmart Relay board I purchased. Below is the diagram for a single channel of the relay board from SainSmart. Let me know if it would be helpful to have more information about other PIC connections.
RelayChannel.PNG
RelayChannel.PNG (23.37 KiB) Viewed 913 times

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Controlling Furnace with PIC

Post by adafruit_support_mike »

It looks like that has an optocoupler between the control signal and the relay, so that part of the circuit shouldn't have any effect on the board power.

Try putting a larger capacitor between VCC and GND at the PIC.. at least 100uF, and in the 1000uF range if you have one handy.

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

Mike,

I'm back working on this project again (the weather is cold enough that it has become important again). I purchased a 1000uF cap and installed it across the 5V lines as close to the PIC as possible. This has reduced the frequency of rebooting, however it still happens periodically.

I did study the diagram above a little, and it seems that the optoisolator is not particularly helpful because I had installed the jumper between VCC and JD-VCC. I removed this jumper and provided 5V from a separate wall wart, and it actually seemed to make the situation worse. Since this is a multi relay board, with two of the other relays switching the 12V source power, I am wondering if the noise is jumping to the other relays and getting into the power via the 12V. Unfortunately I don't have access to a scope to verify where I can find the noise.

Any other thoughts?

Thanks!

User avatar
gilshultz
 
Posts: 61
Joined: Tue Dec 29, 2015 11:57 pm

Re: Controlling Furnace with PIC

Post by gilshultz »

Welcome to the wonderful world of EMI. First I would try a power supply designed for your application. Operating the PC supply without a reasonable will cause all types of problems, there is not enough headroom for the regulators etc to operate efficiently. A battery would be a good short term substitute.

My next suggestion is to use the opto coupler and be sure the VCC and JD-VCC are isolated from each other. That should completely isolate the Pi supply, this is necessary. There should not be any connections between the relay loads and your power supply(S).

Then liberally sprinkle the circuit with several cheap ceramic capacitors, they have good high frequency performance.

It sounds like the impedance of your power supply is high at high frequencies. Add all the uF you want it normally will not help but the cheap ceramic caps will. See if you can add a snubber of some type across the igniter, that would help. Be sure the grounds are all connected with a reasonable heavy gauge wire, preferable 18 awg or something like that. Remember to keep the leads as short as possible. Check your clock (crystal) circuit, the leads should be less then 1" total (this is a extremely sensitive area).

Noise will typically not jump but the other devices can generate EMI exacerbating your problem. Be sure the ground is solid. This is a starting point, but I cannot be sure it will solve it although it will go a long way in making the design solid.

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

Thanks for the input. I will definitely try with a different power supply. Do you have any suggestions for what type I should be looking for? I have been considering an industrial ~2A DIN Rail mount supply to reduce space in my cabinet for a while. I could also go with an old wall wort, assuming that it has enough current capacity.

I will also switch back to removing that jumper and add some ceramic caps. If all else fails, I ordered another relay board. I figure that I can move the furnace connections to that board so that there is no chance of interference through the door latch and siren circuits.

User avatar
gilshultz
 
Posts: 61
Joined: Tue Dec 29, 2015 11:57 pm

Re: Controlling Furnace with PIC

Post by gilshultz »

That would work just fine, just be sure you are about 135% or more of the current requirements over temperature. Larger are OK, just cost more money then is needed. I often use wall wart as they are cheap and do not take cabinet space.

Optocoupler are a problem for most designers. We try to use as little power as possible; we even look on the data sheet to confirm this value. Looking at the data sheet is the best thing you can do but look at the max you are allowed to put through the LED. I usually go for about 80% maybe a little more (depending on application) of this value over temperature. With the Arduino stay under 20ma and included the LED voltage drop in your resistor calculation. The reason for the current is the transfer ration, at minimum current you have minimum transfer guess what happens over time?

I do not know what it is today but when I was using them the LED life was about 30 years for a half life. Yes as the LED is powered its light output decreases over time then things start going intermittent. If out of specification this happens faster and faster as it goes more out of spec.

User avatar
BrennanU
 
Posts: 7
Joined: Wed Jan 21, 2015 10:38 pm

Re: Controlling Furnace with PIC

Post by BrennanU »

Well today I went ahead and grabbed an old 12V 2A wall wort to replace the PC power supply and disconnected my other 12V supply lines that were connected to the common terminals for the siren and door strike. I removed the jumper for JD-VCC and hooked JD-VCC to a separate USB 5V charger. To my knowledge this should utilize the optoisolators on the relay board and completely isolate the furnace circuit from the microcontroller. As usual the furnace worked fine for the first startup, however after it shut off, cooled down and went to start back up it reset my PIC.

I guess its back to the drawing board...

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling Furnace with PIC

Post by adafruit_support_bill »

To my knowledge this should utilize the optoisolators on the relay board and completely isolate the furnace circuit from the microcontroller.
Even with optical isolation, it is still possible for voltage spikes from relay actuation to couple inductively with your microcontroller circuitry. Keeping the wiring well separated will help. Shielding and/or twisted pair wiring are helpful too.

User avatar
gilshultz
 
Posts: 61
Joined: Tue Dec 29, 2015 11:57 pm

Re: Controlling Furnace with PIC

Post by gilshultz »

Do you have your micro well bypassed? Extra never hurts and leads hopefully under 1/2" in length.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”