Raspberry Pi Hot Tub Temperature Probe Project.

Ok it's not a hot tub time machine but I'm hoping it saves some time and money. I have a 2004 Garden Leisure Spa (Desert Rose) that was in storage from 2005 until 2015. I hooked it up at my new home and it worked for a week and then the controller (photo below) broke. It seemed to start doing whatever it wanted without even touching it, turning on pumps, probably heating the water, shutting off pumps and turning on the light. Probably was costing me some dollars.

control

I managed to replace the controller very easily as they are readily available online for about $100. Sure beat having a spa tech come out and tell me the controller was bad and then probably telling me the main board was bad too.

Anyway this created the need to wonder what that stupid spa was doing at any given time so i can not worry about it running all the pumps 24/7 while I'm on a business trip and costing me a ton of money.

So it seems I always go back to the Raspberry Pi for solutions to problems. Sure enough a cursory google shows about a million people hooking waterproof temperature probes up to Raspberry Pi's. Here's a list of stuff you need to pull this off.

- Raspberry Pi - $47. I recommend an old Raspberry Pi B for this for two reasons. One is you don't need the power of the new Raspberry Pi 2 and 2nd reason is the Cobbler kit (listed below) is for a 26 pin serial cable. The old B Pi's had 26 pin headers and the new ones have 40 pin headers and the serial cable in the Cobbler kit DOESN'T FIT on the 40 pin header. Get this one here and you get the SD card AND it comes preloaded with NOOBS which can easily help you install the operating system you need.
- SD or micro SD card. 8 GB should do it. $12 maybe.
- Phone charger with MicroUSB. Get one with at least 1 amp output. You probably already have one in a drawer from an old phone.
- Pi Cobbler with Serial Cable $6 from Amazon here
- DS18B20 waterproof temperature probe $5 Get it here
- Breadboard or breadboard kit with wires. At Radio Shack $8 here Or get this kit with wires.
- A 4.7K ohm resistor carbon film. Pack of 4 from Radio Shack $1.19 here

That's pretty much it. And I'm sure you can buy everything from Amazon including the Raspberry Pi if you want to do one stop shopping. I was just lucky there was a Radio Shack still open in the town I live in.

Now the only hard part is this…..building the board. But again it is pretty easy if you learn a few basics.

0000164_half-size-solderless-breadboard

Now here's a shot of what you are going to do. It's actually very simple. Notice my Pi Cobbler is mounted off the board a little. I only did that because the wires in the Radio Shack kit were pre cut and bent and it looked prettier with nice straight wires. Had I taken 4 seconds to trim wires I could have scooted the Cobbler up a couple rows. And NOTE: THAT THE WIRES IN THE BREADBOARD KIT ARE NOT NOT NOT COLOR CODED. Color coded wires would have been nice.

breadboard2

Now here's the plan:

- We want to hook the red wire of the temp probe to 3.3volts of power.

- The yellow temp probe wire goes to GPIO 7 pin and is basically a signal wire.

- The black wire is a ground wire.

NOTE: This is the GPIO layout of the Pi B model. If you have a Raspberry Pi 2 the first 26 pins are still the same.

p1header

Now lets mount the cobbler and wire. Push the Cobbler in but just barely so you can count the pins still. Hook a short wire to pin 1 and hook a longer wire to the 4th pin back.

pins cobbler

Now the other side. Hook a short wire to the 3rd pin back.

pins cobbler2

MAKE SURE NONE OF THE THREE WIRES YOU HOOKED UP ARE ON THE SAME VERTICAL ABC ROW. KABOOM! BANG! POP! SMOKE! FIRE! GOT IT? But you'll notice I did. See the wide gap in the board under where the pi cobbler is mounted? That is a break in the electrical connection. Yer Good to Go!

Now do this.

breadboard2

Now hook the serial cable to the Raspberry Pi like so.

pi_serial

Now one must assume you have Raspian Operating System installed on your Raspberry Pi. If you don't know how to do that I defer you to here.

Once you have Raspian installed or Raspian installed from NOOBS then boot up and follow these directions.

Your log in user name for the Pi is

user = pi
password = raspberry

Uhhhhh you probably should change these at some point but for now lets just carry on.

All of the directions come from this page This is NOT my doing. Someone else did this. This is the beauty of open source software.

Open your terminal program and type.

sudo modprobe w1-gpio

then this

sudo modprobe w1-therm

then this

cd /sys/bus/w1/devices/

then this

ls

If that shows nothing then follow these directions: (Again I ripped these off from his great web page)

Note:
09/02/2015 - The recent move to kernel 3.18 that supports Raspberry Pi 2 has caused a number of issues, one of which affects the working on the one wire interface used by this sensor. If you see an empty directory after the above ls command then you need to edit the boot config file and insert some lines, and then re-boot your Rpi.

Type:


sudo nano /boot/config.txt 


Page down to the bottom of the file and paste or type in these two lines


# 1-wire settings

dtoverlay=w1-gpio,gpiopin=4

Press CTRL-X Y ENTER to save exit. 


Reboot your Pi


Repeat steps above this red section.


You will see a listing of the current directory. There should be a directory that is the serial number of your temperature gauge. The serial number of my thermometer 28-0000040be5b6, but every one will be unique. Make a note of yours as you will need it later in step 4. If you have multiple sensors there will be multiple directories listed.
 
If you don't see a directory with lots of numbers and letters like the one above then:
  • Check your circuit wiring.
  • Make sure you have the correct resistor (this is very important - yellow, violet, red, gold).
  • Feel the temperature gauge with your finger. If it feels hot then you have it wired back to front.
If you do see the directory then type cd followed by the directory name:
 
cd 28-0000040be5b6
cat w1_slave
 
You will now see a dump of the w1_slave file that contains the temperature data in celcius (refer Figure 3). 20812 is 20.812 degrees celcius. The dashboard does support a Fahrenheit setting that we will cover later if that is your preference.

temptest

This means it is working. Congratulations, you did it.

Now follow the directions here to go to PrivateEyePi and set up your device to report. You'll have to have an ethernet or wifi connection on the pi to pull this off. If your pi is plugged into the router at your boot up this is going to just work. If you buy a small wifi dongle such as this one you can set it up easily under Raspian when hooked to a monitor and mouse. If you have a Pi B with only 2 USB ports you'll need either a USB hub (for the time being) or hot swap the keyboard and mouse).

One note……..The PrivateEyePi webste kind of confused me as they also support input/output devices and alarms and the instructions kind of lead you down that path. All you need to do is set GPIO, Location, Zone, Zonelink, and Config pages as I have done below. All the other directions are sound. Once you create an account at PrivateEyePi just set things up as in my screen grabs below.


 Screenshot 2015-03-22 08.58.33

GPIO Page



Screenshot 2015-03-22 08.58.49

Location Page

Screenshot 2015-03-22 08.59.05

Zone Page

Screenshot 2015-03-22 08.59.18

ZoneLink Page (ties it all together)


Screenshot 2015-03-22 08.59.32

Config Page

Once you follow their instructions to install software on your pi and create this account you are golden.

You should see this:

Screenshot 2015-03-21 13.13.14

Next lesson will be how to run this program so it starts on boot. Later with that. Coffee and Spa time.