Dean's series on his beloved light sensor pet project.
Cool Tricks with Animations Using requestAnimationFrame
If you've been following my never-ending adventures with light sensors (see here and here and here), you'll see that I have yet to make any cool things subscribe to my Websocket server. This post will be less about having the browser communicate with Websockets, and even less about light sensors, and more about some tricks that helped me when using the low(er)-level animation API requestAnimationFrame as I was writing a web-browser subscriber for a Proof-of-Concept.
Establishing a Websocket PUBSUB server with Redis and Asyncio
Motivation If you've been following my never-ending quest for a light-sensor setup as detailed first in this post (set up a Raspberry Pi with Python 3.5) and then in this other post (make a light sensor with an Arduino and Raspberry Pi), you would know that I've only set up the data-collection half of this project. The other half will involve getting the data to make hardware do stuff in the real world. This post in particular covers how to leverage a PUBSUB (publish-subscribe) Redis server and websockets to this purpose.
Setting Up a Light Sensor with an Arduino and a Raspberry Pi
Motivation: About three to six times a day, the sun decides to make life in our trendy, skylit San Francisco office ever so slightly painful for at least one of my colleagues, forcing them to get up and use a long metal rod to slide the fashionable skylight drapes shut. In my never-ending quest to make something in the IoT (Internet of Things) sphere that would remedy this perennial obstacle to productivity, I began with the data collection side of things. Sensors. I bought a fairly cheap Arduino-for-babies kit, grabbed the closest Raspberry Pi I could reach, and got started.
Set Up a Raspberry Pi with Raspbian, running Python 3.5
Motivation The Python Foundation has really been amping up the real-time capabilities of Python with the new asyncio library. Asyncio enables Pythonistas to write code that is asynchronous, allowing for a more event-driven approach to writing software. What platform would benefit more from this new tech than microcomputers like the Raspberry Pi, which are finding new life as lightweight, yet powerful IoT (Internet of Things) devices? In my never-ending quest to set up a feedback system in my office where light levels can be communicated to an automated shade setup, I figured this would be the very first step to get there.