I know what you’re thinking.. “not another device that tweets something!” Yup, another device that tweets something. This time it’s a humidor and it tweets that status of it’s relative humidity and temperature levels. For cigar aficionados, this means a lot. In order to keep your cigars “fresh” for any amount of time over a few days, they must be contained in an environment that is controlled with the perfect amount of relative humidity and temperature levels. The purpose of this is so that your cigars don’t dry out or get too moist which would amount to a terrible smoking experience. The Tweetidor uses a digital precision relative humidity and temperature sensor (SHT75) along with the arduino.
I am collecting the data and storing it into a mysql database, as well as “tweeting” it’s status every hour. I’m taking the data collected and creating graphs and gauges using google’s chart api. You can follow the Tweetidor at http://twitter.com/tweetidor. You can also view the graphs and historical stats of the Tweetidor at http://longashes.org/tweetidor. The following article will go into as much detail as possible about how I created the Tweetidor, the problems I faced, and where you can go to make something similar yourself. You can send any questions, comments, etc. on the project by sending an email to firstname.lastname@example.org.
Step 1: Purchasing the hardware
The first step is to understand what to buy and why we are buying it. You will need the arduino hobbyists platform, a sensirion humidity sensor (the SHT15 or SHT75 are the best choices), jumper cables, soldering iron, solder, a USB cable, and possibly a multimeter and bread board for testing purposes. You will also need a PC for the arduino to communicate to and from.
The arduino is an open source hardware platform for hobbyists. You can use it to interface with a large variety of electronics from LEDs to sensors. This is the meat of the project and is what allows the sensor to communicate with the PC. You can learn more about the arduino here: http://arduino.cc/. You can purchase the arduino for about 30 bucks but there are other versions that costs less or more depending on the options you get.
The sensor is what does all of the work, it’s a very complex electronic humidity/temperature sensor based on I2C technology and works similar to a 2 wire solution. The first sensor I bought was the SHT15 breakout board from sparkfun and was really easy to work with due to it’s size. I ended up shorting something out and I’m not sure how; after my buddy helped solder it for me, it no longer worked. I ended up having to buy another one and went with the SHT75 since I thought it would be easier to deal with. I was only able to find it at Newark’s site. It was A LOT smaller than I had first thought and slightly harder to work with than the SHT15. Both sensors are pretty much the same model but with slightly different designs.
The other items are pretty self explanatory: the usb cable is used to connect the PC to the arduino, the jumper cables are used to interface the sensor chip with the arduino, and the breadboard/multimeter are used for testing the interface between the arduino and the sensor chip.
Here are a few good places to get these items from:
Sparkfun This is where I bought my first Sensirion sensor and the rest of my stuff (arduino, breadboard, etc.)
AdaFruit Industries This site is a great resource and store to purchase the arduino and “shields” to attach to it.
Newark This was the only place I found that was selling the SHT75 version of Sensirion’s sensor.
Step 2: The software
The arduino platform has it’s own IDE that works on Windows, Mac OSX, and Linux. You can download these from the arduino.cc site. You will need the arduino software for your OS.
Once you have the ardunio software installed, hook up the arduino to your PC and make sure it connects correctly. After you have verified that the ardunio connects, try uploading one of the test projects that comes with the download to verify some basic functionality of the arduino (LEDs, etc.).
I won’t lie when I say that the majority of the code that pulls the humidity and temperature from the SHT75 for the Tweetidor is actually code written by someone else. There has already been a few people who have interfaced this sensor (mainly the SHT15 but it’s basically the same thing) with the ardunio and other microcontrollers similar to the ardunio, so there is no need to reinvent the wheel. Of course, the cigar related code, graphs, tweeting, etc. was code that I had to write/piece together else where and I’ll go over that a little bit later. You can download/look at this code at a couple of sites. Go ahead and grab the code at these places since you will need it when you start your testing.
Step 3: Initial Testing
There really isn’t much to the overall connections between these devices. The SHT75 has 4 pins. The first is for the serial clock, the second is for power, the third is for ground, and the fourth is for data. There are already a few guides online which describe how to connect the sensor chip to the arduino. Based on how the variables are set in the code you are using, you would connect the serial clock from the SHT75 to the digital pin “11” on the arduino, power (or VCC) from the SHT75 goes to the 5v power pin on the arduino, ground from the SHT75 goes to the ground pin on the arduino, and the data pin on the SHT75 goes to the digital pin “10” on the arduino. For this step we won’t be soldering anything. Simply connect the pins/holes to the arduino using some jumper wire and a breadboard if necessary. Never turn on the power to the arduino until you use a multimeter to test resistance or continuity so you can identify any shorts or cross overs.
Once things are connected and you are sure there are no shorts, etc. you can now upload the code to the arduino that you downloaded from the earlier step. If you are using the SHT75 as opposed to the SHT15 you must enable the arduino’s pull up resistors, you can find out how to do this on the main arduino site (basically set the data pin to HIGH on input). If you connected everything correctly and the code is properly updated, you should be retrieving the humidity and temperature levels now!!
Step 4: Connecting things together
Once you are done with your initial testing and you are satisfied with your end results you will want to connect the wires permanently to the sensor chip. You should use solder to do this. I will first go into what I did with the SHT75 and then briefly talk about the SHT15. I unfortunately broke the pins off accidentally because I have shaky hands and I’m very impatient so I had to solder the cables to the actual pads where the pins used to be connected. I don’t suggest breaking the pins off like me, learn from my mistakes. :) There are also 4 tiny holes above the pins that will pick up electric current as well. I don’t suggest using these either, unless you have to (ie. one of the pads breaks off while soldering a cable to it).
Once you have the pins/cables soldered, you will want to test everything again before making the connections more solid. When you have tested them again, making sure you still retrieve the humidity and temperature, I suggest wrapping each individual pin with heat shrink wrap, hot gluing the connections, then wrapping the overall connections with another piece of heat shrink wrap. During each of these steps I stopped before I got too much further and tested out the program again. You don’t want to end up with solder, glue, and heat shrink wrap and then find out that it doesn’t work since you probably won’t be able to tell which step caused an issue. I also put color coded heat shrink wrap around each individual wire so I knew which cable went to the corresponding pins on the sensor.
The SHT15 is a lot easier to work with and you have a couple of options there as long as you buy it in the breakout board from sparkfun.com. The breakout board from sparkfun.com makes it really easy to get access to the pins by use of four holes. You could solder some pins on these holes and leave it connected to a bread board, solder some pins on and then solder some wires to it, or solder some wires directly to the holes. Anyway you do it, would be a tad easier than the SHT75. The SHT75 is a little cheaper and the relative humdity on the SHT75 is a tad bit more accurate, so these are the plus/negatives to each sensor (the SHT15 is 2% accurate whereas the SHT75 is 1.8% accurate).
Now you are on your way to placing your Tweetidor into your humidor! The next steps will focus on presentation and what I used to display the graphs, etc.
Step 5: Presentation
Now that we have everything together, we could technically just sit the arduino in the humidor and be done with it but a few problems arise from this. For one, it doesn’t look very appealing. Other problems also arise including, how are you going to get the usb cable or wires inside the humidor and be able to close it, and also you run a risk of distilled water being spilt on the arduino, someone crushing it, or the wires coming lose. I came up with a few hokey ways to prevent these from happening (I’m not a very good handyman, I’m a computer geek) but you could probably devise your own methods.
The first step is to figure out if the arduino will sit outside of the humidor or in it. I put it in there so I didn’t have it sitting out and running the risk of it getting knocked over or grabbed at (I have 4 kids, 3 of which are 3 years of age and under). I found out that the arduino fits perfectly inside a marlboro cigarette box (not the soft pack) so I decided to use this as my “case”. I may paint it later or upgrade to something more durable but this definitely gets the job done. I poked a hole where the USB port is, and a hole on the top so the sensor sticks out. This also allows me to stack cigars on top of this too. I really need to get a larger humidor for this project but I’m poor, homeless and addicted to crack so I can’t afford one (ok I lied about all of those but I do have 4 kids like I mentioned earlier so money is pretty tight).
Since the USB cable is pretty thick, it won’t shut in the humidor correctly. At first I tried cutting a tiny notch on the side of the humidor but that wasn’t good enough. I ended up deciding to drill a hole in the back of the humidor, stick the USB cable through that, then I used weather caulking around the cable to seal up the hole to keep my precious humidity at an acceptable level (it seems to stay at 67% right now which is pretty good).
Overall, this method worked out the best and from the outside of the humidor you just see one cable coming out from the back and going to my PC which has a wireless card in it to connect to the internet. The caulking job isn’t the best (again, I’m not a handyman) but still looks pretty decent. You can pretty much do a million different things here to set it up, the arduino also has tiny holes so it can mounted to something inside the humidor too and I might do that once I get a larger humidor. My next project may be to call upon my father in law to build my own cabinet humidor.
Step 6: Connecting the Tweetidor to the web
You can actually tackle this several different ways but the one thing you will definitely need is an interface to communicate to the serial console that the arduino is interfaced on. I used a perl library I found online which worked out nicely. My Tweetidor’s PC is an old 500 mhz with 256 megs of ram, a 10 gig hard drive, and running Ubuntu 9.04 server edition. I used code similar to this: code.
Once you have the arduino talking to the PC using some sort of serial console library like the perl one above, you can output that data to a text file and manipulate it however you’d like. You could set up a cron job or schedule to mail you, tweet you, or collect the data into a database and graph it out like I did. If you want to create graphs and gauges from a database, the easiest and most visually appealing (in my opinion) is the google chart api which is what I used. It’s pretty easy to create and manipulate to what you need it for. For the database, I used mysql for the database and the php twitter api for twitter. I set the Tweetidor to update my database and twitter every hour. If it gets below 60% humidity it alerts me with a “wife alert” saying the humidor has been opened and it also alerts me if the temp/humidity gets too high. I’m probably going to set twitter to update every two hours instead so it doesn’t bother me as much.
So there you have it. Pretty simple once you understand the basics and it’s not entirely too expensive to do. I’ve heard of someone else buying something like this premade and they payed over 700 dollars for it!! Again, you can email me at email@example.com with any questions or comments. If you are feeling sorry for how slow I am or you think the project is cool, you can also donate money if you’d like. :) You can donate by clicking here: Donate!
You can transform your old school hygrometer into a new advanced digital precision hygrometer in no time! Thanks for your time.