Tuesday, 31 March 2009

Logging temperature

Displaying static pictures on an LCD is quite cool (see my previous post) but it doesn't get you very far, does it?
I always wanted to build my own temperature logger and graph it in a display, so it was now or never! I had a couple of I2C temperature sensors lying around and also a serial EEPROM, so I hooked them all together, and voila voila!!



Time for details now! Sorted from fun to less fun :-)

- The data scrolls one pixel every 5 minutes, the LCD is 128 pixels wide I can display the temperature for the last 10.6 hours.

- The flat part of the graph is during the night, as you can see the thermostat is doing a great job at keeping a constant temperature!

- The non-flat part is during the day the sun enters through the windows and heats up the place. There is a small spike and that is because for while the sun hits directly the sensor.

- For the clock, I used the fact that I can drive one of the AVR's timers using an external oscillator, I used a 32.768MHz crystal this number is exactly 128*256, so you just have to set the timer's prescaler to 128 and you'll get a 8bit timer overflowing once a second. Se the timer to generate an interrupt at that point and that's it. Look at the Atmel's Butterfly source code for reference.

- Drawing the line was quite tricky, because the LCDs' framebuffer is not linear at all and also because I wanted to write up to 8 pixels with the same memory access. It was tricky but I made it, I'll probably post the code in another post.

- The rest is simple stuff, the temperature sensor is a LM75A, and the serial EEPROM is a 128Kb one.. both of them are controlled using and I2C bus, so piece of cake!

And now the full monty:


More details on demand, Thanks for reading!

1 comment:

  1. Excellent,can you help me by supplying your code for KS108 on line graph.
    digirke@gmail.com

    ReplyDelete