Last week in Part 3 we used ezCoreChart software to program our eLab6 temperature alarm. We showed you how to program it so that a buzzer sounded when the temperature rose above a preset level, and also showed how the software could be easily altered to allow the buzzer to sound when the temperature went below the level.
This week we’re going to add a pot to allow easy external adjustment of the temperature, and then do some really tricky things with two temperature sensors. As with last week’s project, you’ll need the eLab6 EZ Starter Kit plus an eLab6. This lot costs AUD$44.50 + GST.
Note: this story assumes that you have read and understood the previous parts in this series. If you haven’t done this, it’s unlikely you will achieve success with the following projects!
|
Externally Adjustable Temperature Alarm
The temperature alarm that we developed in earlier parts in this series works very well. However, the temperature trip-point can be adjusted only by altering the value in the software. Wouldn’t it be good if we could just use an external pot (an electronic device with an adjustable knob) to alter the temperature at which the buzzer goes off?
Before getting started, let’s think about how the original temp alarm worked.
This diagram shows the flowchart idea behind the software. The temp sensor is monitored by the software, then this value is compared with an internal set-point. If the temp is above the set-point, the buzzer is turned on.
To make the set point adjustable by a pot, we monitor two inputs – the temp sensor and the pot. The voltage reading from the temp sensor is then compared with the voltage reading from the pot. If the temp reading is above the pot reading, the buzzer turns on.
OK, let’s build the project.
This shows ezCircuit Designer with the connections we used in last week’s project. There’s a temp sensor connected to ‘0’ and a buzzer to ‘2’. To get to this stage you can either use last week’s ezCircuit Designer file or do a new one – either way, it takes only seconds!
Now we select a pot from the pictures of components...
...and wire it to Connector 1.
We then rename it, calling it Pot.
The pot uses the same wiring colour coding we examined earlier. So the white wire goes to Connector 1, the red wire to (+) and the black wire to (-).
We now open ezCoreChart from ezCircuit Designer (press the arrowed button to do this), exporting our connections (and the names we’ve given them) to the software writing program.
We then write exactly the same program as we did last week – the input from the temperature sensor, comparing that result against an internal value, switching on a buzzer if it’s above that value, and looping around to the beginning, making sure that the buzzer gets switched off each time it does the loop.
(You might want to go back to Part 3 to look again closely.)
You can even use this software to program the eLab6 and check that it works as last week’s project did. (So at this stage the pot won’t do a thing!)
Now let’s go and add the extra programming boxes that will allow the pot to work. The first step is to add in another AnalogConv box, as shown here by the arrow. Remember, the AnalogConv box allows the program to accept a voltage signal. One voltage signal is already coming from the temp sensor, and now another one will be coming from the pot.
Set the Source to Pot (so it looks at the pot for its signal) and then...
... change the Destination to Adjust. (Just delete what is there and type in Adjust.) So we now have the software recognising that there is a pot input and that the signal is called Adjust.
Previously, we compared the temperature input (that we called Result) with an internal number. To make the pot functional, we now need to compare the temp Result not with a number but with Adjust – the value coming from the pot. That sounds hard but it isn’t – we can do it in one easy step!
Double click on the Compare icon and then change the ‘Compare with’ box from a number to Adjust, as is available on the drop down menu.
Save the program and then send it to the eLab6 via the Programmer.
Important note: before programming the eLab6, always turn any connected pots to their central position. If you don’t do this, you’ll probably not program the eLab6 successfully, indicated by error messages on screen.
Testing
You should now be able to adjust the pot until the buzzer comes on. Set the pot so that the buzzer has just turned off, and then warm the sensor with your fingers. The buzzer should switch on. Remove your fingers. The buzzer should sound for a short time and then turn off again as the sensor cools. (If room temp is close to your temp, use something like a soldering iron to heat the sensor.)
The buzzer is working but you might notice something. Especially when the sensor is only slowly cooling, the buzzer can chatter on and off – it’s not sure whether it should be on or off. To fix this, open the Compare box and adjust the Hysteresis slider along to 5 per cent. This means that the switch-off point is 5 per cent lower than the switch-on point, making the on/off transition cleaner.
See the end of the article for the two External Pot Alarm software downloads - one for ezCircuit Designer and the other for ezCoreChart.
|
Two Temperature Inputs
Let’s now build a more complex temperature alarm. This one will not only will have external pot adjustment of the switch-on point, but it will compare two temperatures and turn on the alarm only when the difference in temps is greater than an amount you’ve set.
So why would you need this sort of device? Here are some uses:
-
Monitor turbo car intercooler inlet and outlet temps, and warn when the intercooler is no longer working efficiently (eg because of heat soak) – also a good time to switch on an intercooler water spray
-
Monitor the inlet and outlet temps of a solar water heater and turn on a pump when the water at the top of the heater is hotter than the water at the bottom (in this example, the buzzer is replaced by a solid-state relay that drives the pump)
-
Monitor the temp at the top and bottom of a greenhouse to indicate when vents should be opened
Rather than build on the programs we’ve done, we’ll start a new one – that will make it easier to mentally organise.
Open ezCircuit Designer and add:
-
Temp1 to Pin 0
-
Temp2 to Pin 1
-
Pot to Pin 2
-
Buzzer to Pin 5
Make sure you name each of the components as has been done above – check this pic.
Now wire the components to the module, remembering that all black wires go to (-) and all red wires to (+). Because so many wires need to go into the (-) and (+) terminals, be careful that they’re all fully home before tightening the screws.
Now open ezCoreChart from ezCircuit Designer. The first step after deleting Buzzer Test is to insert three AnalogConv boxes.
Double click on each in turn and then make the selections as shown below:
First AnalogConv: Source = Temp1, Destination = TempInput1
Second AnalogConv: Source = Temp2, Destination = TempInput2
Third AnalogConv: Source: Pot, Destination = Adjust
The screen grab above shows just the final AnalogConv being set.
OK so we’ve now got the program recognizing the three inputs and then handling them as TempInput1, TempInput2 and Adjust. Because we want to know what the difference is between the two temperatures, we need to subtract one from the other.
Select Subtract from under Numbers and put the Subtract box next in the program. Select TempInput1 as the first Source, TempInput2 as the second Source and then label the Destination as Difference.
No we need to compare Difference with Adjust (Adjust is the signal coming from the pot). Place a Compare box next in the program and double click on it. Set ‘Source’ to Difference and ‘Compare With’ to Adjust. Also tick the ‘Above’ box.
As we’ve done with previous programs, we now need to turn on the buzzer if the comparison is yes, and then loop the program around to the beginning, not forgetting to put in an ‘Off’ command for the buzzer.
Now go through the program, checking the function of each programming box and ensuring you understand what is going on.
Send the program to the eLab6 (remember that you must set the external pot to a mid-position first) and then adjust the pot until the buzzer just goes off. Heating Temp1 (the sensor that connects to ‘0’) should cause the buzzer to sound. The buzzer should also sound if you cool Temp2 (the sensor that connects to ‘1’). Remember that if the buzzer doesn’t cleanly switch, you can adjust the hysteresis upwards.
See the end of the article for the two Dual Temp Input External Pot Alarm software downloads - one for ezCircuit Designer and the other for ezCoreChart.
|
Conclusion
In this story we’ve programmed the eLab6 module to act as a standalone, externally adjustable temperature alarm. In the project we triggered a buzzer, but the buzzer could easily be replaced by a LED or a solid state relay.
We then developed a temperature alarm that looks at the difference between two temperatures and turns on the alarm when the difference is greater than the amount set by the pot.
So we’ve now used three analog inputs, subtracted one input from another, compared that value with an input provided by an external pot, and then triggered an output. We’ve also got software-adjustable hysteresis. Hmmm – try being a beginner and doing all that in a few minutes using any other electronic system!
Contacts
Contact: www.elabtronics.com
ezCircuit Designer - http://www.elabtronics.com/products_cat_ezCircuit.htm
ezCoreChart - http://www.elabtronics.com/products_cat_CoreChart.htm