I've seen projects on the web about:
- Turning old kindles into internet data weather displays.
- Using RF temperature sensors on a Raspberry Pi and displaying the data on a Pi served web page or simple LCD display.
To explain what the kindle display shows:
- 'House Temperature Sensor' Section:
- Inside temperature as measured by a DHT22 sensor attached to the Pi
- Outside temperature as measured by a remote RF temperature sensor.
Or to put it in a more visio kinda way:
Full tutorials take a lot of time to write, plus it's no fun following cut and paste steps. The real fun of tinkering is reading stuff, trying stuff and adapting it to your own needs. So here are some basic tips and pointers for anyone interested.
Hardware1) Raspberry Pi.
I got a version 3. There is a slight hack to get the Uart pins working the same way as the Pi2 as the slice of radio expects.
sudo nano /boot/config.txt
# Change device tree to enable slice of radio
(Thanks goes to this site )
2) RF receiver (Slice of Radio) and remote temperature sensor
This remote temperature sensor is good as it doesn't require any configuration over serial port (unlike xbee devices). The bad news is that you have to solder the components together yourself. Price is good, you can buy the receiver and sensor as part of one kit.
3) Local temperature sensor.
Any local temperature sensor would work. I got a Adafruit DHT22 but lots of others would do the same thing. You could also buy another RF remote sensor and just use that indoors too.
SQLite databaseThere's tons of tutorials and info and how to create databases and use insert and select statements.
The only things I would add is
use 'detect_types=sqlite3.PARSE_DECLTYPES' in your sqlite3.connect command. This makes python convert the millisecond values directly into python datetime objects.
e.g. "conn = sqlite3.connect('/home/pi/yourDB.sqlite',detect_types=sqlite3.PARSE_DECLTYPES)"
install iceweasel on your pi (which is firefox) and add the addon SQLiteManager. Managing your DB just got a whole lot easier.
Saving sensor data to a SQLite databaseThe adafruit local sensor comes with its own library and examples. Create a cronjob for every 5 minutes to poll the sensor and insert it into the database.
The Slice of Radio works differently in that a bash script needs to be running all the time to capture incoming serial messages. Again use the example code provided with it and modify it to insert the data into the DB.
Setting up the Apache webserver and CGI scriptsThis website is a great resource for CGI scripts, SQLite and Apache.
He also has a excellent full tutorial on reading temperature sensors and displaying this via a google charts webpage. I ended up using flot charts in my project as they have the shading capability which I use to denote night times.
Flot chartsThis site is a great tutorial on logging temperature sensors to a Pi database and then displaying this via a webpage using flot charts. Especially useful is his code to create shaded areas on the graph to denote weekends, I adapted this code to denote nightime areas on my graphs.
Converting the webpage to PNGThe kindle needs a small PNG file to display, it can't show a webpage.
pngcrush will compress the file to a size agreeable with the kindle.
KindleThis site will give you all you need to know about hacking the kindle.
- Install KUAL - this give you a nice menu where you can disable your screensaver and turn on usbnet
- Install USBnet - this allows you to access the kindle over putty. Your read about some kindles not needing this but do it anyway, my kindle technically didn't need it but I had problems running cron without connecting via usbnet.
- setup a cron job to call your bash script every 5 minutes (more on this script below)
Some tutorials out there setup much more (e.g. functionality for enabling/disabling the cron job) but I didn't bother with that.
Weather display script
This site is one of the first internet resources on create a kindle weather display using internet forecast data.
I used his display-weather.sh bash script. This is the file that is executed by the cron job on the kindle. The commands fetches the PNG file served from the Pi and display it on the kindle.Weather Underground provide free access to weather forecast via API calls and JSON responses.