YodaVonBeck
Posts: 35
Joined: Wed Mar 16, 2016 10:03 am

Easy project

Wed Mar 16, 2016 3:37 pm

So as another start project I was think of making a water proof temperature gauge for brewing beer.

So, I was thinking of using this : http://www.reuk.co.uk/DS18B20-Temperatu ... rry-Pi.htm
But with a waterproof sensor like this : http://www.etotal.dk/product/temperatur ... ire-1m-92/
And setup like this : https://learn.adafruit.com/adafruits-ra ... g/hardware

Would that work do you think?

scotty101
Posts: 3711
Joined: Fri Jun 08, 2012 6:03 pm

Re: Easy project

Wed Mar 16, 2016 4:39 pm

Yes. It would work.

Good luck.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

YodaVonBeck
Posts: 35
Joined: Wed Mar 16, 2016 10:03 am

Re: Easy project

Wed Mar 16, 2016 9:56 pm

OK, so I tried to find the different components in Denmark, but the PI Cobbler and cable is not available.

How would this setup look with that and simply "just" the breadboard and wires and components? (I can get those)

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Easy project

Thu Mar 17, 2016 8:45 am

YodaVonBeck wrote:OK, so I tried to find the different components in Denmark, but the PI Cobbler and cable is not available.

How would this setup look with that and simply "just" the breadboard and wires and components? (I can get those)
The Pi Cobbler helps everything look tidier while prototyping, it's not in any way essential.

A bunch of Female to male Dupont cables would do the job, they tend to come still connected as a ribbon so you should be able to keep your project reasonably tidy.
Doug.
Building Management Systems Engineer.

YodaVonBeck
Posts: 35
Joined: Wed Mar 16, 2016 10:03 am

Re: Easy project

Fri Apr 01, 2016 8:51 am

OK, so I got it all setup. The Pi can see the deviced and I can read data from it, but in the code example I used, it comes up with this error:
Traceback (most recent call last):
File "temperature3.py", line 7, in <module>
tempdata = thetext.split("/n")[1].split(" ")[9]
IndexError: list index out of range

This is code being run:
http://www.reuk.co.uk/DS18B20-Temperatu ... rry-Pi.htm

Any idea of what the problem is?

saltydog
Posts: 39
Joined: Mon Dec 24, 2012 10:40 am

Re: Easy project

Fri Apr 01, 2016 9:18 am

adding print lines is a great way to debug.

Just before line 7 in the file temperature3.py
tempdata = thetext.split("/n")[1].split(" ")[9]

can you add a line:

print(thetext)

YodaVonBeck
Posts: 35
Joined: Wed Mar 16, 2016 10:03 am

Re: Easy project

Fri Apr 01, 2016 10:00 am

Thanks - good idea.
It gave me this text, so it does contain data, but I am not sure where the code then breaks as I am not familiar with the "split" function

[email protected]:~/MyCode $ sudo python temperature3.py
6c 01 4b 46 7f ff 04 10 5d : crc=5d YES
6c 01 4b 46 7f ff 04 10 5d t=22750

Traceback (most recent call last):
File "temperature3.py", line 8, in <module>
tempdata = thetext.split("/n")[1].split(" ")[9]
IndexError: list index out of range

saltydog
Posts: 39
Joined: Mon Dec 24, 2012 10:40 am

Re: Easy project

Fri Apr 01, 2016 10:09 am

try changing
tempdata = thetext.split("/n")[1].split(" ")[9]
to:
tempdata = thetext.split("\n")[1].split(" ")[9]

YodaVonBeck
Posts: 35
Joined: Wed Mar 16, 2016 10:03 am

Re: Easy project

Fri Apr 01, 2016 10:19 am

That worked!

Thanks - I must have missed that in the review of the code :(

So now I can pull data and write it.
I already have the code to act differently within certain temperatures and I just need to add the GPIO code to make the LEDs light up:

import time

while 1:
tempfile = open("/sys/bus/w1/devices/28-0000065657f0/w1_slave")
thetext = tempfile.read()
tempfile.close()
tempdata = thetext.split("\n")[1].split(" ")[9]
temperature = float(tempdata[2:])
temperature = temperature/1000
# Temp 61.0-63.0 GREEN
# Temp 59.9-60.9 RED & GREEN
# Temp < 58.9 RED
# Temp 63.1-65.0 RED & GREEN
# Temp > 65.1

print temperature

if (temperature>=61.0 and temperature<=63):
print "GREEN"
if (temperature>63 and temperature<=65):
print "GREEN & RED HIGH"
if (temperature>65):
print "RED HIGH"
if (temperature<61 and temperature>60):
print "GREEN & RED LOW"
if (temperature<=60):
print "RED LOW"

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Easy project

Tue Feb 28, 2017 1:45 pm

I have used 1 wire temp sensors for industrial and immersion applications for years. Mostly I pot the sensor in a length of rigid tubing (glass, polycarb, copper, S/S) in all cases the tube has one end properly sealed, a good blob of heat shrink compound on the sensor before you shove it into the tube. Use a low viscosity potting compound (good old 2 part slow cure epoxy works well. If you can then put it in a vacuum pot to suck out the air bubbles, then great but not essential.

Put a knot in the lead which is trapped by the potting agent to act as a strain relief.

Test your wiring, soldering well before potting. Insulate all the leads well with HS tube before potting.
..the only thing worse than a stupid question is a question not asked.

Return to “Automation, sensing and robotics”