Monday, April 28, 2014

Flame Sensor Update

This is a follow up to the post on Automated Home Brewing.  There were several good ideas in the comments to that post about how to create a flame sensor.  Some require an analog input, which I describe in this post.  I have experimented now with a few methods for detecting a flame and here is what I found.

Plasma Conductance

Cool Fact - flame is a plasma and will conduct current.  I tried using two wires stuck into the flame.  The flame has a fair amount of resistance.  One of the wires was connected to 5V.  The other was connected to a voltmeter.  There were dozens of mV present when the flame was on and zero when it was not.
I think this could be used with an analog input as a flame sensor.

Thermocouple 

Thermocouple
I got a type K thermocouple and tested that directly with a voltmeter.  It only show a couple of mV with a flame on the tip.  I added a simple 100X amplification circuit and connected that to the analog input.  Now I see a range around 300-400mV and see a clear increase when the flame is on it.  One problem I saw is that the sensor has a fair amount of mass, mostly stainless steel.  Once it heats up, it takes a while for it to cool off.  As long as there is a distinct increase when the flame comes on, this could also be used for the flame sensor.
100X Amplification Circuit for Thermocouple

Digital IR Flame Detector

IR Flame Detector

Sensors are available that detect the IR signature of a flame.  Most of these provide analog output only, but I found some that also include a digital output.  This is provided by a built in level compare circuit with an adjustable level.  Because this method is so simple to interface with, this is what I decided to use.  One big problem quickly became apparent - the sensor is triggered by incandescent lights and sunlight.   It worked fine under florescent lights.




I was successful in using this configuration for brewing.  The IR sensor works, but has the false trigger problem.  It works for me but won't work in many environments.  My plan is to rebuild the brewing interface with analog input capability and try one of the other methods.

IR sensor mounted on a small block of wood and placed under the flame.




Friday, April 25, 2014

Interface to the Internet of Things with SkyNet

The Internet of Things (IoT) refers to the many servers that store data uploaded from various devices (things) connected to the Internet, which can range from weather stations, to home appliances, or a farm animal with a biochip transponder.  Even dancing robotic quad choppers.

There are many services that provide IoT support.  After experimenting with some, I settled on the SkyNet.im IoT server.  It provides several simple ways to allow machine to machine communications, including MQTT, REST, and WebSockets.  There are Python and JavaScript libraries to support it.  The API for SkyNet is fairly simple, as is using the REST protocol.  With the curl utility, you can interface to SkyNet from shell commands.

First you need to install the curl program and since I will also be calling this from a C program, I also need the development support.

sudo apt-get install curl libcurl4-gnutls-dev

To create a new device on Skynet, issue the following command (changing the parameters as you see fit)

curl -X POST -d "type=raspberry-pi-example&myvariable=12345" http://skynet.im/devices

SkyNet returns a UUID and a security token.  Save this info.  The device id is used to identify the new device and the security token allows a little security so that only someone with the token can update the data for this device.  If you really need to maintain security for the device, be sure to always update it using HTTPS.  If you use HTTP, then the session is not encrypted and someone could intercept the token and use it themselves.  Also, be aware that anyone can read your data.

To update the data for the device, issue this command.  (All one line.)

curl -X PUT -d "token=PUT-YOUR-TOKEN-HERE&myvariable=5678online=true" http://skynet.im/devices/PUT-YOUR-UUID-HERE

To view the data for a device, issue this command.

curl –X GET http://skynet.im/devices/PUT-YOUR-UUID-HERE

The function listed below provides a simple interface to SkyNet, in C, using libcurl.




Friday, April 4, 2014

Schematic for Analog Interface

A commenter asked for the schematic of the analog interface I made using an MPC3008.  I seldom include schematics with my posts for several reasons.  I don’t expect anyone to duplicate exactly what I have done, so if I post anything, it is just partial drawings of the most important concepts.  But the biggest reason is that I almost never create true schematics and I am too busy to do it just for the blog.  Something that I do frequently do is a simple drawing that helps me lay out the components onto the perf board.  Then I use that as my guide when I build the device.  These are seldom complete enough to be useful to others.  In this case, however, the entire circuit is shown.


This is what I created for the analog interface.  The 7-pin header connects to my main circuit board where I have two SPI ports – one with CE0 connected and the other with CE1.  The 3-pin header allows me to select the reference voltage for the MCP3008.  The blocks along the bottom are screw terminals.  See the post Analog Interface for a picture of how this looked when built.

I will probably be pulling this old board out again to experiment with a thermocouple that I just received.  I need it for the flame detection on my Home Brewing Automation setup.