DS18B20 based temperature sensor/logging device. - Page 1
Forum section: electronics / projects

author: XOIIO
author_rank: Super Contributor
timestamp: March 24, 2016, 04:33:14 am
content: Hello all, this is a project I made a year and a half or so ago, possibly two years, because I didn't have a thermocouple for my multimeter at the time, and didn't know about the cheap ones on ebay.I checked around, and using a K type thermocouple with an arduino would be difficult, because of how you actually get the temperature information, and you can't easily solder to resistive ones, they also have less accuracy from what I saw in general, and while they are much faster, I figured accuracy over speed would be better.So, I found the dallas instruments one wire temperature sensors, which also have an arduino library set up, and went with that, ordering several, with the rest of the parts at hand. The whole thing is enclosed in the case from a lapel mic, which was a nice small size but fairly roomy, and had a bit of a square section that would help me get the LCD in fairly accurately. I set it up to display the temperature in Celsius and Fahrenheit on the screen simultaneously, so that I wouldn't need to bother with the conversion if I needed Fahrenheit for some reason.I also got some black hot glue, to make it look a little bit better, and block out stray light from the built in lights on the arduino pro mini. It's actually quite expensive compared to regular hot glue, and not very common, it seems like it is used for hair extensions or something, but works just as well, although isn't quite as rubbery. Close though.It also has a green LED facing front side that lights up when the temperature has stabilized, (not changing more than x amount within the last x seconds), and turns off when the temperature shifts. I had originally wanted it to do this over a period of 20 seconds, but while upgrading this noticed that again, and apparently I did something wrong, but it actually works really nicely, as the temperature climb slows down, the LED turns on and off, and once it's stable it stays lit.Now, fast forward to the past couple days, I wanted to add functionality to it, namely, data logging. I had also thought about a remote unit using some RF modules, and the antenna from when it was a wireless mic, but there wasn't much room, and I didn't have a good enclosure to put a second unit in (basically it could change between the built in sensor or the remote wireless one).So, datalogging it was, and I upgraded it with a full sized SD adapter, and have it mostly working now, there is an extra red light on the top that flashes once every 5 seconds, as it writes data to the SD card, which indicates when it is logging.I am still working on the code, but the push button on the top will be for selecting datalogging mode, right now it is automatic, but I want to be able to turn it on and off. Being a momentary button it's a bit tricky, and the state change examples aren't working, so I need to figure that out (or find a latching push button in this size but I don't think they exist).I may also wire the LCD backlight to the arduino to make it so that when you start logging, it turns the backlight off to save power, however this thing draws very little power, it was a long time ago (I'll re-check when it's convenient), but I believe it should last around 10 hours on a 9 volt battery.You can see the code here, and if you have and feedback, suggestions, or tips on getting state change to work that would be a bit helphttps://www.dropbox.com/s/0hcz09ba433h80j/Temp%20sensor%20device.txt?dl=0Hole for the SD could be better, but I didn't have much aside from drill bits, an exacto knife and a much to large file, so it's not too bad considering.The terribly messy interior.These mini xlr jacks are actually really, really nice, four connections, though I have the sensor in paraside mode so I'm only using two, they are nice and secure, and look pretty good too, I'm going to order several and keep them for future projects.Here is the datalog file output so far, I measured the ramp up of the lighting on my server rack over 30 minutes, and it graphed out pretty well. (You need to just find/replace all "c"'s with nothing). I am going to either have it make sequential numbered log files if possible, or simply put a line stating that it is a new log, but that would be less ideal.I likely could have put the SD board further in so it was a bit more flush with the case, but I figured lining it up would be a bit of an issue. If I get some thin metal scrap that I can cut to make a "guide" that will also help the sd card slide in properly, I might change it up, but it's actually not too bad, and for some reason I kind of like it sticking out, maybe just because I've wanted to do this for ages but never bothered, but it does make it feel a bit more, home made.

author: XOIIO
author_rank: Super Contributor
timestamp: March 25, 2016, 07:16:18 am
content: Alright, mini update, everything hardware side is complete, asifr from possibly cleaning up the positive and negative buses, I didn't actually need to re-wire it, but I'm glad I did, it looks much better, and I got to use some funky old school ribbon cable. I also changed out the momentary for a toggle, it's just a lot less hassle that way, and it also turns off the LCD backlight to save a bit of power.All that's left is the programming on the SD card, and maybe tweaking things here and there.

author: XOIIO
author_rank: Super Contributor
timestamp: March 25, 2016, 02:47:57 pm
content: Moved the SD card further in and then measured the current consumption, at the lowest it draws 34 or so miliamps, the highest is 55, so it has between an 18-25 hour life depending on if you are logging or not.I'm going to adjust the code and disable the lcd output entirely when it's in datalogging mode and see if that reduces the power by any, I doubt it though, I'd likely need a microcurrent, but I could disable the temperature stability LED if I wanted, and that would keep it at 34 mililamps.