Before I get into the build details, here's what the final result looks like:Goals
The overall goal of this project was to create several dashboards to display helpful, interesting information for team members at work.
This information includes things like:
- Business KPIs
- Date & time
- Integration with our ping pong ranking system
- Scores for our favorite teams
- Current traffic in the area
- Traffic cameras for major highways (not shown)
- Server alerts (not shown)
There was simply too much information to show, so the dashboard needed to split into multiple dashboards. A controller was therefore required in order to switch between the dashes.Architecture
The dashboard was built using the Ruby-based Dashing framework. It runs directly on a Raspberry Pi 3 which is tucked behind the TV.
The dashboard control box is powered by an Arduino Nano rev 3. This connects to the Pi via USB - this provides both power and communication (via USB serial). This controller has three functions:
- Switch dashboards when the 4 different buttons are pressed.
- Use the PIR sensor to detect people in the room. If someone is present, wiggle the mouse to wake the screen saver (or prevent it from sleeping).
- Show the status on an RGB LED.
The controller sends these single-byte commands via serial:
- "1" - Button 1 was pressed
- "2" - Button 2 was pressed
- "3" - Button 3 was pressed
- "4" - Button 4 was pressed
- "M" - Motion was detected
- "E" - The previously-detected motion has ended
These are sent from the Arduino via the USB serial connection to a simple Python daemon running on the Pi. The daemon has a few responsibilities:
- Launch the dashboard in Iceweasel if it's not actively running.
- Tell Iceweasel to load X URL whenever Y button is pressed.
- Use xdotool to wiggle the mouse when a motion event comes in.
Iceweasel was chosen because it's fairly light-weight, supports the latest standards, and has this handy plugin for sending browser commands over a TCP socket. The Python daemon uses this to change the URLs (and thereby switch between dashboards).Building the Dashboard
Building the dashboard was fairly straight-forward - just install Ruby and Dashing. Some of the widgets are third-party and others (like the Top Pong Players and NHL scores) were built custom.
Once that was in place, I worked on building the Python daemon which was pretty straightforward.Designing the Controller Circuit
This was the most-challenging yet most-rewarding part of the project.
Here's a photo of the original circuit I designed:
The green LED was later swapped out with an RGB LED, allowing multiple states to be shown by changing colors:
Designing the Controller Enclosure
Once I got the circuit working, it was time to design the enclosure! I fired up Tinkercad and spent several hours modeling the parts and designing the enclosure:
Here's the final design:
The top-right piece is the back panel. Two rectangular strips were carved out so it could be mounted flush to the wall with 3M strips.
The bottom-left piece shows the front of the controller. The large round hole is for the PIR sensor. In the middle I've carved out another rectangular strip so the 1x4 membrane keypad can sit flush. A smaller hole for the LED was also cut out on the right.
Here's a look at the other side:
I wanted to screw the back panel on, so I created posts for that purpose. If you look carefully at the back panel's edge, you'll that it won't fit perfectly due to those circles on the rounded corners. These were trimmed with a Dremel after printing.Assembling the Controller
I don't have a 3D printer, so I used 3dhubs.com to find a local maker who could print the case for me. Once the case was printed I began installing the components:
Several layers of hot glue later...
I'm really happy with how this came out! Especially since I had never worked with Arduino, 3D printing, and Ruby before. It was a huge hit at work too!