Author Topic: Heater control system - intefacing with a DS18B20 and a Parallax Ping [PHOTOS]  (Read 3591 times)

luisr320

  • Full Member
  • ***
  • Posts: 227
  • Country: pt
After I finished my RFID project (not quite finished yet, but almost) I got inspired to tackle other projects that I wanted to add to my Homeseer home automation system.

The hot water in my house is heated on a diesel burner and I could already turn the heater on or off by using a (expen$ive) Zwave switch. What I could never do was to check if the heater did in fact started, what was the water temperature on its internal tank and the diesel level on the fuel tank. As the heater is on a s small shack outside my house I didn't want to pass cables into the house, so a wireless solution was my best option.

Then I came across the Moteino and my mind started boiling with ideas. And now that I found a very simple way to interface the moteino with my Homeseer automation software trough the com port it was only a question of pulling the breadboard out and starting a new project.

I already had a DS18B20 temp sensor lying around so I looked at the heater manual and found out that the heater had a thermocouple temp prob connected to a very inaccurate analog pointer dial on its control panel just to show the water temperature and another thermocouple sensor to control the set point. Looking closely I found out that the thermocouple probe was inserted in a dry tube that was inside the water tank. I pulled the old probe out of the tube and the new DS18B20 was inserted in its place. The diameter size was a perfect match!

So now I knew I could read the water temperature from a correct position in the core of the water tank which would give me a very accurate measure of the water temp.

Connecting the sensor to the moteino and loading the onewire libraries along with some copy paste programming (my kind of programming ability  ;) ) I managed to get the water temperature show up on my home automation control panel. So now when I turn the heater on, when the water temp gets to 45ºC my system speaks up "Your bath is ready, sir" and no more having the water running to find out when it is hot.
I will post the code used for this part of the project on a latter occasion.

And since I had a moteino with a lot of input/outputs pins available why not trying to measure the level of the diesel fuel tank? This way I can be warned by email or SMS when the level reaches some preset point.
For this purpose I decided to try a Parallax ping sensor I had from some robotics project I wasn't using any more. This sensor is a bit expensive and I could have found a cheaper one on ebay but that one was already paid for so it was recruited for the project.

The ping sensor sends an ultrasound ping and then listens for a echo, thus allowing me to measure the distance with a simple speed/time/distance equation. And it works quite well. The Moteino does the calculation and produces a number, the distance from the top of the tank to the fuel level, that is sent by radio in a data packet along with the temperature from the heater, to the gateway Moteino connected to my home automation system. From there I send it to Xively to make a neat graphic. My home automation deals with the received figure and fires an event that will send me an SMS when the heaters is about to run out of fuel.

The ping sensor is 5 volts and the moteino is 3 volts so I had to make an interface. After some googling around I found exactly what I wanted on the Parallax forum:
http://forums.parallax.com/showthread.php/152308-Ping-Sensor-3.3v-Compatible

The diode lets the Moteino send a pulse to the Ping sensor at 3V, which is good enough for it, but the echo from the sensor generates a 5v pulse that has to go trough a voltage divider before getting back to the same pin now configured as an input.
I just used a normal diode instead of the Schottky diode.

All the Moteino has to do is to measure the time it took between the ping was sent and the echo received, being the speed of sound 29 microseconds per centimeter, and dividing the result by 2, since I only want to know the distance on the way down to the fuel level: [distance = ( speed of sound X time of travel in ms )/2] or [distance = 29 / (time in miliseconds) / 2]





The diesel tank had two caps so I pulled one out and it looked like a perfect match for the ultrasound transducers. All I had to do was to cut some holes in it.




I traced the transducers perimeter on a piece of paper:


Test fitted the drawing to the cup. A perfect match!


I fired up my MACH3 CNC software and fed it with a pocket cutting program:


My CNC machine was setup:


And the holes cut:


The sensor was inserted in the cap:




The cup was inserted in its place on the tank and a cable with a custom connector was built. I had to change the ping pins from horizontal to vertical:




The sensor was then connected to my temperature sensor project that is still in a bredboard, on top of the heater:


Et voilá:


So now I can go to Xively and check on the tank level, as well as the water temperature:


Next I will connect an LDR to a glass eye my heater has that allows me to see if the burner has started. This way I can send a command to the heater to start and have some feedback of the starting process, having my system give some warning if it doesn't start. And I will also replace the Z-Wave controllers with simple relays controlled by the moteino and will use them in other places on the house. Those Fibaro Zwave switches are a bit on the expensive side and only have 2 dry switches I can use. A moteino has a lot. So its a winner.

Thank you Felix for giving making this happen.

I will keep on adding some more photos and code until the project is complete.
« Last Edit: September 18, 2015, 07:21:40 AM by luisr320 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Very nice sir, looking forward to seeing more!