When I'm not in my office, I like for people to know where to find me. Am I teaching a class? Working from home? In the manufacturing area?
So I thought it'd be cool to build a little device that I could put in my office window that shows where I'm at and when I'll be back...
On the window side:
On the window side, the parts were pretty easy. I'm using:
- An Arduino Pro Mini 3.3V ($9.95, or much cheaper on ebay) - I would have loved to use an arduino nano here, but the 3.3V logic levels are easy to talk to the radio.
- NRF24L01 2.4 GHz radio ($0.67) - The price is right on these radios. I got the idea to use them from a cool DIY home-automation website, but there are better bits of example code here. If you're just getting started with these radios, start with this wiring diagram, and then this code, which i've modified here.
- NHD 3.12" Yellow OLED ($33.25) - I found one of these laying around in a parts bin downstairs at work. I love the crispness of the OLED, and the nice black and gold colors.
The Arduino waits for a radio message, separated by null characters (\0) to differentiate between the Descriptive text, Location, and End time. It's pretty straightforward. One of the trickiest things is assigning the radio "pipes" and setting the payload size (Note: The max payload is 32 bytes!!). Playing with the OLED was also a bit challenging, although I got it to display how I wanted.
The Brainy Side
The real crux maneuver is getting a device that can talk to the internet and pull google calendar information. I looked into doing this with an Arduino, but in the end decided a Raspberry Pi would be better. I'm using a B+, although I think any revision should work just fine. You'll notice I'm also using an Arduino Nano between the raspberry pi and the the radio. In theory, the Raspberry Pi should be able to talk to the RF24 Radio, although after sinking a couple of late nights into it to no avail, I decided to use the Arduino Nano as a bandaid and take serial input from the Pi and send it out over the Radio.
Here's the Python code on the Raspberry Pi. It asks your calendar for a current event, and then parses out the summary text, location info, and end time. It then sends the text via a 2-wire serial connection to the Arduino to be relayed over to the radio. You'll have to sign up for your own account under the Google Developers API, and enter your credentials into the google_calendar.py bit of code.
While I've made the project sound pretty simple, I learned a Whole Lot doing it and was pretty proud of the result. The project still gets bugged out sometimes but a power cycle usually works out the kinks. I think with a little refinement, This could be a really cool way to schedule community conference rooms or collaborative spaces.
Questions? ask away in the comments section!