Team
(1)

Description

Inexpensive heaters like the one pictured here are common in southeast Asia. In my country gas pressure fluctuates throughout the day in the hours of peak demand. Every year there are many lives lost to unattended heaters with either Carbon Monoxide poisoning, http://goo.gl/JvEHK7 or gas leak when a momentary decrease in pressure causes the flame to go out, http://goo.gl/Y4JxfJ

Inspiration for the project came one winter night when my daughter's room was too cold but I could not allow the heater to stay ON while she sleept.

When I started designing the project, I thought, If I put a RaspberryPi in there then I can do lot of cool stuff apart from safety. Thats where smartphone connectivity, auto-ignition using motorcycle parts came into picture. There is some good learning along the way like solenoid need current regulation during peak and hold or it will burn.

Details

I don't have a RaspberryPi Zero. In the meanwhile I am prototyping with Arduino Nano.

In most parts of Pakistan, winter is short. The intense cold, that requires the use of space heating only lasts for about 6 weeks. Most households do not have central heating installed. Inexpensive heaters like the one pictured here are used by the middle-class for general space heating during the coldest part of winter. These heaters are simple and robust but have no safety and automation features. To make situation worse, gas pressure fluctuates throughout the day in the hours of peak demand. Every year there are many lives lost with unattended heaters causing:

I live in Lahore Pakistan. First part of the project, is to address the safety issue and assist locals to equip their old gas heaters with modern safety features.

The second part of the project is the ‘fun’ part. I will add climate control and Integrate with the cloud. Notification will be pushed to smart phone. User will be able to turn their heater ON/OFF and change desired room temperature from smart phone.

The third part is the ‘awesome’ part where I will analyze the data collected on the cloud. Based on usage pattern, daily gas pressure fluctuations, predicted time to reach desired temperature (room profile) and user location, suggest to turn the heater ON automatically so that when user gets home, they find their room perfectly warm.

The attached picture is the room heater that I have own for many years and will be retrofitting for this project. I don't have a RaspberryPi Zero. In the meanwhile I am prototyping with Arduino Nano. The other picture are the sensors and actuators that I have already interfaced with an Arduino.

There are several components involved. Below I will detail how I am bringing up each sub system.

For detecting if heater is ON and has not flamed out due to low pressure, this is a video of testing the functionality of flame sensor.

The flame sensor in the video is hooked by a tape because I was experimenting with the proper placement and the value of onboard potentiometer. I will 3D print a mount that will hold both flame sensor and LCD/keypad at front.

In order to programmatically turn ON the heater, I need two things, a solenoid valve and a source of spark. I know there is a specific unit in stove and instant gas geysers but I could not find a spare in my city. As I mentioned, I live in Lahore, Pakistan and Amazon don't deliver here. There are however auto-shops and I sourced an inexpensive ignition coil and spark plug from a 70cc Honda motorbike. I wired it as below:

When working with a Raspberry Pi, the drive pulse will come from a 555 timer circuit which will be activated by the PiZero. STP75NF75 Power MOSFET is used to drive the current in ignition coil. See it in action in below video:

First I wired up the Solenoid directly to a STP75NF75 Power MOSFET connected to Arduino. As shown below, it was getting heat up a lot.

I did some research and learned that in order to properly drive a solenoid valve, I have to provide it with high current in start, when it triggers, then I need to reduce the current so that It stays engaged and does not dissipate excess power and damage itself.

I changed the circuit as follows and the solenoid was happy.

When bottom MOSFET is turned ON, it supplies peak current needed to trigger the solenoid. After 100ms the top MOSFET is turned ON and bottom one turned OFF. The second MOSFET has a power resistor in serial to limit the current to the minimum required holding value.

In order to properly limit the current, I needed a 33 ohm 10 watt resistor. I could not find it in my stash. So I improvised and cut an heating element...

Discussions

Become a member

One more note, and I am done for now. If you go to PWM control to drop the current on the gas control solenoid, you should add a low pass filter to the circuit to smooth the voltage and current through the solenoid. You can use the inductance of the coil as part of the low pass, but it will benefit from parallel capacitor with a low value inline resistance. You can find designs for PWM solenoid control on the web. The values for the parallel capacitor will not be critical, it just needs to be in an appropriate range for the inductance of the solenoid coil. Some designs do not use a series resistance on the capacitor. It depends on the transistor you are using as a driver. Peak current into the capacitor on initial startup can damage the transistor, and a low value series power transistor will limit that peak current. Your transistor choice will determine the design of the filter. The smaller the capacitor, the less the peak current and duration.

The RC snubber approach is good for an AC circuit where you can not use a freewheeling diode. It protects the switch (contact or semiconductor). In a DC or PWM (no polarity reversal) circuit I definitely use a freewheeling diode with the coil inductance as filter alone. Together it works like a step down converter (lower coil voltage and lower input current). The voltage is pulsed, the current slowly decays while it flows through the diode. Solenoids have generally high inductance, so you don't need a very high frequency to stay in continuous conduction mode where the current does not decay to zero. This has less losses than the RC circuit.

The approach with a secondary shut of MOSFET is good. You can do this with a capacitive coupling (like a charge pump) of the solenoid drive signal to it's drive stage. So its is driven only while the arduino produces a valid dynamic (PWM) signal. Or you drive it with an external watchdog which must be triggered by the arduino in regular intervals (several 10ms). If the program gets stuck, the WD times out and the gas valve gets forced shut (power off).

One other thought, the gas heater that I owned had a thermocouple in the gas line that prevented the gas from flowing unless 1) the standing pilot was lit or 2) the burner was lit. There was an override button that you had to hold down until one of those two states existed.

I like the idea of replacing the large resister by using PWM control from the Arduino, as mentioned by Martin. I also agree that you should stick with Arduino for this type of embedded design, just from a stability point of view.

Adding a couple other thoughts, if you cycle the gas off after it has been running for some time, you will have to continue monitoring the flame sensor for a while, because those ceramic blocks will signal that the flame is lit for some time after the gas has turned off, because they glow so hot. I used to have one of these heaters, so I am familiar with how they work.

If you don't wait, you could turn the gas back on and think that the panel was burning, when you are just registering the hot panel. So don't allow the gas to flow again until the panel has cooled enough to see the flame sensor return to a negative state.

I may have missed it in the description, but are you running the spark all the time? Or just until you get a positive indication from the flame sensor?

In any case, for safety reasons, you should add a main MOSFET control on your gas valve that is not controlled by the Arduino, but is driven directly from a buffered output from the flame sensor and also from a filtered output of the coil driver. On the low side of the coil, you can run a diode with an inline current limit resistor to a small capacitor driving a buffer stage. The buffered output from the flame sensor and the buffered output from the filtered coil driver can be run through an OR gate to drive the MOSFET in the gas valve driver. In that way, the gas valve cannot open in any case unless either the spark ignition is on and running, or the flame sensor detects flame. With this as just transistor logic outside the Arduino, you get an extra level of safety to protect against coding or microprocessor errors. So even if the Arduino fails with the gas valve driven open, a loss of flame, or the spark turning off, will also shut the gas valve.

If the flame sensor really "sees" the hot panel, than I would try to change it's position. Normally theses sensors should be UV detectors, not IR (heat). If it is not selective enough then Doug's strategy with waiting for cool down is necessary. Then I would think about a longer time out of several minutes to limit the rate of thermal cycles of this heater.

But basically it's true: If you do not expect the flame to burn, then the correctly working sensor has to deliver a negative (no flame) signal. Otherwise something is wrong. Which means stop this after one or two retrys give an error message and do not continue without manual user interaction. The primary goal is to reduce danger.

that's not so good, it WILL see the bright glowing heating element very good. Better than your cell phone (or most other digital) camera. Because these normally have a IR blocking filter to reduce (not eliminate) IR sensitivity.

So you have to test for the sensor not seeing a flame, before starting the next igintition and heating cycle.

Please view the first video embedded in this project page with title "Keyes flame sensor with Arduino" It is a good demonstration on how fast the sensor reacts when fire is started and then turned off.

OK, this is really very quick, so no real issue. Still I would do a check for "no flame" before ignition and "flame" after ignition. If there is no flame 5s or 10s after ignition then shut down to avoid possible accumulation of flamable gas in the room.

your spark plug ground should connect directly to the negative terminal of the ignition coil. the way it's shown in the diagram, once the pulse is removed the voltage will build up on the primary and secondary as the magnetic field collapses, and the voltage spike will probably travel through your +12v rail to get back to your power supply ground and to the spark plug, since the primary coil is the path of least resistance and the negative of your coil is now isolated since the mosfet is off. also, you might want to add a flyback diode to your coil if you run into any problems with burning out mosfets. weakens the spark somewhat though.

You should use a HV capacitor across the primary and a a MOSFET with a rating of several 100V. Similar to old style contact point ignition. With a flyback diode the spark can be very weak. The induced voltage in the primary adds up to the transformed secondary voltage. If you limit it by a diode you severely limit the secondary voltage. Ensure also good supply decoupling (electrolytic from 12V to Gnd.

You use an arduino. This has PWM outputs. So there is no reason to waste so much power in your current limiting resistor. Just drive the solenoid valve with a 100 to 200Hz PWM signal and you can regulate the current to any value you desire. You need just one MOSFET instead of two. Only one thing: don't forget the freewheeling diode!

So you can give it a punch to kick in for - lets say - 30ms and reduce the current as low as possible for reliable holding. As the solenoid has inductance there will be recirculating current through the diode. This saves even more power. You can measure it once and determine the correct PWM duty cycle. If you want you can even compensate for varying supply (battery?) voltage if necessary. You can easily measure the voltage with the arduino's ADC inputs: You need a voltage divider with an impedance of 5 to 20 kOhm and a filter capacitor (around 100nF to 1µF).

It would also be more easy to drive the solenoid with a NMOS FET in the low side line. You would not need any level shifting. WHICH I MISS ANYWAY in your drawing. If you connect the arduino to the PMOS FETs like you draw, then the FET will probably never shut off. The arduino's output signal varies between 0 and 5V and the gate source voltage of the FET varies between 7V and 12V, both is way above the threshold.

Your solenoid valve looks like it is made for water (which cools it also). is it also rated for gas?

The same I have to say about your use of a 555 timer circuit: use a timer output of your micro controller!