Homemade waterproof digital thermometer
Jan 13, 2010 Uncategorized, arduino, electronics, thermometer, waterproof
Now I am playing with hydroponics in my grow box I want to monitor the temperature of my nutrient tank. This is important too hot it can bread disease too cold it can shock your plants. I also want to use the data to identify how ebb/flow cycles affect ambient and solution temperature (for my own nerd curiosity)
I have been thoroughly impressed with the Dallas DS18S20 temperature sensor so decided this would be a great component to use for this project and this is how you can make your own.
Materials:
- DS18S20 temperature sensor
- 1/2 inch plastic tubing (could go smaller but had some lying around)
- Aquarium/food grade silicone
- 18 gauge solid core wire (long enough to get from arduino to what you want to measure)
- Glue gun with glue
- Soldering iron with solder
Construction
Step 1: Solder the two wires to pins 1 and 2 of the DS18S20 and apply a little dab of hot glue to all of the exposed metal. This is not entirely necessary but a small safety precaution so you don’t discover you shorted the connection during assembly.
Step 2: Cut approximately 1 inch length of plastic tubing using a utility knife
Step 3: Apply liberal amount of silicone to one end of the tubing cut in step 2.
Step 4: Allow silicone to set for 15 minutes and do a visual inspection for leaks. You may also try blowing very gently into the tube to check for leaks, though not too hard to create a hole in the process.
Step 5: Attach the DS18S20 to the tube using a drop of hot glue. This is not entirely necessary but when trying to get a perfect watertight seal the less moving parts the better.
Step 6: Again apply a liberal amount of silicone to seal the top paying special attention to the area around the wires
Step 7: Give the silicone at least 24 hours to completely set.
Step 8: Testing. First off the sensor may be buoyant, if this is the case carefully attach a 1/2 hose clamp or something else to help tether it down. Next suspend in a glass of water (preferably clear) and watch for a few minutes for leaks and or bubbles. If you see bubbles try to get an much water as you can out and apply a more silicone and let set for another 24 hours
Hooking it up
This part is pretty straightforward. Pin 1 is your ground and pin 2 is your DQ which for most people doesn’t make much sense but it is a combination power source and bus output. To get this to work you hook up your ground (black wire) to your ground on your arduino and the red wire to digital in and 5v with 4.7K resistor between. Sure that is very confusing so hopefully the breadboard visual below is much more helpful.
Writing the Code
Since I am planning on using this with my grow box controller, I will show how to use this with arduino to get some numbers. You could look at my arduino code in the grow box controller post to get the values but in my case I need to get values from two DS18S20 temperature sensors so I found a great OneWire library which helps make your arduino code very simply. Simple extract the two folders in the zip archive to [ArduinoPath]\hardware\libraries and enter the following code into the arduino UI:
#include <OneWire.h> #include <DallasTemperature.h> OneWire oneWire(8); // on pin 8 DallasTemperature sensors(&oneWire); void setup() { Serial.begin(9600); // Initialize sensors sensors.begin(); } void loop() { sensors.requestTemperatures(); Serial.print(“Sensor #0: “); Serial.println(sensors.getTempCByIndex(0)); Serial.print(“Sensor #1: “); Serial.println(sensors.getTempCByIndex(1)) delay(100); // wait a little time }
If all goes well you should see output similar to the following (values in Celsius):
Sensor #0: 20.3 Sensor #1: 30.4 Sensor #0: 20.3 Sensor #1: 30.4 Sensor #0: 20.3 Sensor #1: 30.4
For people like me who are used to Fahrenheit you can simply use the following equation to convert Celsius to Fahrenheit:
°F = °C x 9/5 + 32
Though I am using this for my grow box controller there are many other uses you could use this for:
- Aquarium temperature monitoring
- Brewing temperature monitoring
- Weather station
- Soil thermometer
Tags: grow box components
How to use Vegetronix soil moisture sensor (VG400) on Arduino
Aug 28, 2009 arduino, moisture sensor
With the summer starting to come to a close it has been time for me to start thinking back to the computerized grow box. I have been doing some considerable work on the electronics and software over the summer. Better to break stuff while the plants are outside and not while killing them inside.
Though I have been happy with my homemade gypsum soil sensors I decided to try out a commercial option hoping for better accuracy and longer life. This is important with my current plans to include automatic watering to the latest version of my grow box. Don’t want to wake up to a flood in the garage due to a broken sensor. After some looking I came across the Vegetronix VG400 which measures the dielectric constant of the soil using transmission line techniques. Which I have no idea what that means but sounds impressive.
The hookup couldn’t be simpler, red wire to 3V, bare wire to ground, and black wire to an analog input. As you can see below in my completely not to scale diagram below.
From here it all comes down to some simple code to write on the Arduino to get some values.
| void setup() { // Setup serial Serial.begin(9600); }void loop() { Serial.println(analogRead(0)); � delay(200); // wait 200 milliseconds } |
Upload the code to the Arduino and now I can get a moisture value from the analog input between 0 and 614 (0-3 volts) depending on the degree of water saturation.
Though not as hacky as my PS2 controller moisture sensor solution definitely more elegant and reliable. Stay tuned for more details of other improvements to the computer controlled grow box.


