[Raphael Baron] needed a better way to control his office’s air conditioning units. Sure, they have remotes, but that’s too easy. [Raphael] came up with a solution that uses an ESP8266, a computer, IR LEDs, and a bot that runs on Slack.
[Raphael] built a prototype of the ESP8266 hardware on protoboard and used it to read and record the IR signals from the remote. Once he’d figured out the issues he was having with the IR library he was using, he could use it to send the IR commands to the AC unit. Since their office has two AC units, [Raphael] built a second prototype which had two IR LEDs but didn’t have the IR receiver. Using this he could turn both AC units on and off and set their temperatures.
For the server, [Raphael] turned to Clojure, a dialect of Lisp, which provides easy access to the Java Framework, mainly to get practice working with the language. The server’s main responsibility is to use Slack’s real-time API to listen for messages from a Slack bot and forward them to the ESP. In this way, a user talking to the Slack bot can send it messages which the server forwards to the microcontroller which, in turn, parses the messages and send IR commands to the AC units.
[Raphael] admits that this isn’t the most advanced, professional stuff, but it doesn’t matter. The schematics for the ESP8266 board and the code for both the ESP board and the server are available on GitHub. There seems to be a lot of hacks using Slack, such as this NERF Turret controlled by a Slack bot. Or this jukebox that users can interact with by talking to a Slack bot.
[Stian] thought it would be nice if his coworkers could be electronically notified when the latest batch of coffee is ready. He ended up building an inexpensive coffee alarm system to do exactly that. When the coffee is done, the brewer can press a giant button to notify the rest of the office that it’s time for a cuppa joe.
[Stian’s] first project requirement was to activate the system using a big physical button. He chose a button from Sparkfun, although he ended up modifying it to better suit his needs. The original button came with a single LED built-in. This wasn’t enough for [Stian], so he added two more LEDs. All three LEDs are driven by a ULN2003A NPN transistor array. Now he can flash them in sequence to make a simple animation.
This momentary push button supplies power to a ESP8266 microcontroller using a soft latch power switch. When the momentary switch is pressed, it supplies power to the latch. The latch then powers up the main circuit and continues supplying power even when the push button is released. The reason for this power trickery is to conserve power from the 18650 li-on battery.
The core functionality of the alarm uses a combination of physical hardware and two cloud-based services. The ESP8266 was chosen because it includes a built-in WiFi chip and it only costs five dollars. The microcontroller is configured to connect to the WiFi network with the push of a button. The device also monitors the giant alarm button.
When the button is pressed, it sends an HTTP request to a custom clojure app running on a cloud service called Heroku. The clojure app then stores brewing information in a database and sends a notification to the Slack cloud service. Slack is a sort of project management app that allows multiple users to work on projects and communicate easier over the internet. [Stian] has tapped into it in order to send the actual text notification to his coworkers to let them know that the coffee is ready. Be sure to watch the demo video below. Continue reading “Alarm Notifies The Office When The Coffee Is Ready” →
At this point, the banana piano is a pretty classic hack. The banana becomes a cheap, colorful touch sensor, which looks sort of like a piano key. The Arduino sets the pin as a low-level output, then sets the pin as an input with a pull up resistor. The time it takes for the pin to flip from a 0 to a 1 determines if the sensor is touched.
[Stian] took a new approach to the banana piano by hooking it up to Clojure and Overtone. Clojure is a dialect of Lisp which runs in the Java Virtual Machine. Overtone is a Clojure library that provides tons of utilities for music making.
Overtone acts as a client to the Supercollider synthesis server. Supercollider has been around since 1996, and provides a wide array of sound synthesis functions. Overtone simply tells Supercollider what to do, letting you easily program sounds in Clojure.
The banana piano acts as an input to a Clojure program. This program maps the banana to a musical note, then triggers a note on Overtone’s built-in piano sampler. The result is a nice piano sound played with fruit. Of course, since Overtone and Supercollider are very flexible, this could be used for something much more complex.
After the break, a video of the banana piano playing some “Swedish Jazz.”
Continue reading “Making Music With Clojure And Bananas” →