Make Your Office Smarter
DIY with Raspberry Pi & Slack
The popularity of Wifi-enabled home devices and Internet of Things (IoT) is on the rise. You can lock your home with August, control your house temperature with Nest, and talk to Amazon Echo to change the color of a lightbulb. In the meantime, your work life is being transformed by integrating your business tools and services into Slack.
So, how about combining both: operating your home and office with Slack?
As a hardware hobbyist myself, I love hacking with microcontrollers like Arduino and Raspberry Pi, and have written an article about building a Pi robot with Watson brain. I am eager to find out how other hardware aficionados have improved their physical spaces using Slack.
To find out, I interviewed software engineers Tetsunoshin “Tetsu” Anzai, Keiji “Futoase” Matsuzaki, Yoshikatsu “Teitei” Higa, and Sosuke “Aniki” Sekiguchi on their office DIY hack that connects their office’s bike garage to Slack.
They work for Freee K.K., a prominent Tokyo-based cloud accounting and HR software company (which recently released a new app that enables employees to track their expense approval process within Slack).
Thanks to their work, Freee’s employees can access to the garage from their mobile phones to safely park their bikes in the garage.
This is pretty cool! How does it work? Tell me how the hardware integrates with Slack!
Tetsu: We have a Slack private channel for bike commuters who have the access to the garage. The messages on the channel are monitored remotely by a Raspberry Pi from inside the garage, and whenever somebody uses a certain keyword in Slack, the message triggers the Raspberry Pi to control a servo motor and open the garage door.
We have already adopted multiple internal integrations within our organization, and we are used to sending commands to bots to take action, so it was pretty natural for us to make this interaction in the same way. The biggest advantage of using Slack is that every employee has access.
The garage bot has an admin feature which allows us to decide who can access the garage door, it keeps a record of who entered the garage and when.
Wow, nice! Why did you decide to build the system?
Aniki: Parking bikes in the garage used to be quite troublesome because the garage couldn’t open from the outside. Every morning when we got to the office, we had to leave our bike outside first, then enter the office building to open the garage from inside. This process might have taken only a minute or two, but it was quite stressful. Some of us even quit commuting by bike because of this.
Futoase: A few minutes in the morning is crucial, you know! We even tried to install a keypad outside; however, the estimate cost was as high as a few hundreds of thousand yen [a few thousand US dollars], so we decided to build the system ourselves.
How did the building process go?
Futoase: Unlike our daily software development, we faced a lot of troubles physically with hardware — especially because some parts worked in the office but not in the garage where the temperature was much cooler! We ended up buying an oscilloscope to troubleshoot.
The app has been running for two years, and we have to replace the servo motors occasionally because these parts just don’t last long!
For the software part, how did you connect the hardware system to Slack?
Teitei: For the physical movement, we use a Raspberry Pi. We run a simple resident process and servo control (that hits the garage door switch) using Adafruit libraries in Python.
Tetsu: We developed the messaging protocol initially through MQTT because the band limit of the mobile network we had at the garage was quite small. However, we ended up building something smaller and easier to debug with a cloud data logging tool.
I was most careful with the error handling to prevent these fancy bikes from getting stolen if a network error were accidentally to leave the garage door open.
Teitei: Later we realized that the free cloud service we relied on was pretty unstable and not robust enough. So we ended up refactoring the architecture by moving the system over to AWS Lambda and SQS, and now we are no longer pained by network errors.
In future, how would you like to improve / update the system?
Futoase: Currently, it only allows us to open the door automatically, so I’d like to make it close the door too.
Have you done any other Slack integrations for your team?
Tetsu: Yes! We built a bot that posts data from Netatmo Weather Station on Slack periodically. The data shows CO2 concentration, temperature, humidity, and noise level from the Netatmo sensor from each floor where a sensor is located.
We figured out that whenever we felt dizzy or sleepy, the CO2 level was as high as 2000 ppm. To keep us healthy and productive, we now use Slack to monitor the CO2 levels. If it’s above a certain level, whoever noticed ventilates the office space! I love that Slack brings business and our work life together with human-machine interactions.
The bot can also chat with humans, show us our conference room maps, and a weather radar to show rain clouds. The bot has been working tirelessly for us!
Yes the bot look really useful! Now I want this bot at Slack office too! Thank you so much for showing your amazing works!
If you are interested in finding out more about the projects, Tetsu has written the details:
- How we built a bike garage Slack bot (in Japanese)
- Measuring office CO2-level and sending the data to Slack (in Japanese)
As you know, Slack is where work happens, and you can make magic happen with Slack integrations! If you have built an interesting hardware hack for Slack, let us know.
Make Your Office Smarter! DIY with Raspberry Pi & Slack was originally published in Slack Platform Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.
Gurupriyan is a Software Engineer and a technology enthusiast, he’s been working on the field for the last 6 years. Currently focusing on mobile app development and IoT.