Search Results for "label/coupon codes"

Homemade waterproof digital thermometer

057

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.

image

052

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.

053

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.

055

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.

056

Step 6: Again apply a liberal amount of silicone to seal the top paying special attention to the area around the wires

058

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.

image

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

How to make a grow box controller

IMG_3777
While my existing system was working I decided to make an upgrade to the electronics on my old system for several reasons: 

  • I needed to add more automated external controls (heater, fans, water pump) with my existing design this was entirely possible though was starting to get a little clunky. 
  • The existing controller (PS2 Controller, parallel port with various wires to control relays) worked but was not exactly compact. 
  • Wanted a modular design so if I needed to debug some issue I could simply unplug the USB and power and bring it out of the box in the garage for needed work
  • Ability for others to create so I can share my software without forcing people to hack PS2 controllers to get to work
  • Ability to use components like 1Wire temperature sensors (others to come) and Arduino
  • Just for the fun of it

Read More …

Twittering computer grow box

image

Well this is pretty much clichéd nerdiness but given it only required a couple of lines of C# I couldn’t resist.  I have updated my grow box software to “tweet” some sort of semi-humorous and not really witty comment appropriate to its current state and share its current temperature and moisture content every 2.5 hours.

For those who want to do something similar, this is how I did it.  I one of the many twitter C# libraries and for no specific reason I chose tweetsharp and after adding a reference to their DLL and just the few lines of code (below) you can be programmatically making updates via twitter.

private void UpdateStatus(string message)
{
    IFluentTwitter twitter = FluentTwitter.CreateRequest();
    twitter.AuthenticateAs("user_name", "password");
    twitter.Statuses().Update(message);
    twitter.AsUrl();
 
    string response = twitter.Request();
}

If you want to see it in action go to http://twitter.com/computergrowbox

Right now I only have a handful of not so witty comments, so if you have some good zingers add them to the comments and if I like them I will add them to the list.

UPDATE: Grow box shares its own pictures

I get busy these days and sometimes can’t make it out to keep a close eye on my plants in the grow box.  Given I have everything automated the box basically takes care of them, though I thought it would be nice if I could see how they are doing so added photo sharing to the grow box’s twittering software.

I already have the software taking pictures every so often so all I really needed to do what send out the most recent file to twitter.  After a little looking I found that tweetsharp already supported this so yet again this was just a few lines of code to implement.

First I needed the logic to determine the last photo I have taken, fortunately I was carefully about my naming using a timestamp based name similar to “Photo_2008_10_01_090130.jpg”, so alphabetical sorting would work just fine.  I removed the error handling to keep things brief but here is the code to complete this logic:

string[] files = Directory.GetFiles(photoDirectory, "*.jpg");
Array.Sort<string>(files);
string fileToUpload = files[files.Length - 1];

Now you have your photo to upload just signup for one of the photo TwitPic using your twitter account and run the following code using your credentials.

IFluentTwitter twitter = FluentTwitter.CreateRequest();
twitter.AuthenticateAs("user_name", "password");
twitter.Photos().PostPhoto(fileToUpload,
                      SendPhotoServiceProvider.TwitPic);
twitter.Statuses().Update("My Picture").AsJson().Request();

Hopefully this, you too can make you own grow box (or other inanimate object) share its feelings on twitter.

Control two 120v electrical outlets with your computer


Here is one more component for "Project Everbearing" which requires the ability to toggle a 120V power source using my PC. Now there are a few interesting applications for this, home automation, music synced Christmas display, or just the nerd factor of being able to say I can turn on my coffee maker from your web enabled phone. Whatever your need, hopefully with these instructions you can do this yourself.

If we had lawyers, they probably would want us to say this:
WARNING: I am not an electrician and do not pretend to be one.  I do not know the specific building electrical codes of your area, so please be sure your wiring is completed under the proper safety code for your area. As always, using high voltage electricity can result in self-electrocution or burn down your house if not done safely so if you are not comfortable doing this wiring please contact a qualified professional.

Materials:

  • 2 – 20 amp solid state relays (got off eBay for $4.00 each)
  • 1 – Outlet box (Home Depot for $2.00)
  • 2 – 20 amp outlets (Home Depot for $1.25 each)
  • 1 – 2 outlet switch plate (Home Depot for $0.50 each)
  • 1 – PC power cable
  • 2 – LEDs (optional)

The outlet I am plugging this into is 15 amps, though my use for this project will be considerable under this but best to place for worst case scenario and I would rather trip a circuit breaker than who knows what happens when solid state relays or outlet exceeds their limits. I could have saved a couple dollars and gone with cheaper mechanical relays but solid state will last much longer even with frequent toggling on/off.

Now for the build, this was actually surprisingly easy and took less than an hour from start to finish. I first fed the power cable through and three stands of low voltage wire through access in back. I cut about 6 inches of wire off the end of the power cable. Using the continuity feature of my voltmeter I verified the hot, neutral, and ground, then checked one more time. I attached the neutral and ground in parallel to both outlets. I then connected the hot from the power cord to left side of both SSRs. I then used the 6 inches of wire I cut off to connect from left side of SSR on both and connected a wire from the left side to the corresponding outlet.

Now to add the ability to turn the things off/on using low voltage. I hooked up the wires fed through the back (which will later be hooked up to computer’s parallel port) green to positive SSR #1, red to SSR #2, and black to both grounds. Now with 3-12 volts of power to these connections will activate the SSR and provide power to the outlet. For a little added effect and easy confirmation everything is working (even with the unit unplugged) I also attached corresponding red/green LEDs that match the wires (I am getting old color coding helps) I was doing this hack indoors though first thought was to use my soldering iron to burn a nice little hole into the outlet plate but didn’t want to stink up the house, so risked using a drill instead. As you can see from the pictures I should have gone outside. With a little solder and hot glue everything seemed to be staying together.

With all the wiring completed, I carefully packed everything into the outlet box. The SSR were already pretty snug but I added little but of hot glue in case they feel like shifting around after everything was put back together. Being careful that wires are staying secure and no shorts are being created carefully screw the outlets to the outlet box. Finish it up with a (cracked) outlet plate and the assembly is complete.

Now the scariest part still remains, which is testing, first part is plugging this monster in. If you plug it into the wall and no sparks occur you are in pretty good shape but not in the clear yet. Plug something like a nightlight into your switchable outlet box, should be off now. Using a 9-volt battery connect black to (-) and red to (+) if you didn’t cross your wires anywhere the red LED should come on and appliance plugged in should get power. Now switching to the other side do the same with the green wire and appliance comes on with sparks or fires looks like a successful build.