Blog  |  Publications  |  Puzzles
Fun & Games  |  About

Wireless Carillon Project

November 4th, 2014

For the past few days, I’ve been preparing a wireless carillon that will hang on our Christmas tree this year. The carillon is a set of 9 brass bells, which can play different tunes. It is connected to an Arduino micro-controller that controls the bells. The Arduino receives messages from my desktop computer via an XBee radio. The desktop computer can trigger the bells in a variety of ways.

I’ve programmed my carillon to chime the quarter hours, like a grandfather clock, and to play a collection of different short tunes to tell me about the state of the world, and the Internet. The bells play “We’re in the money” when I get notified of an electronic payment, “Baby it’s cold outside” when the thermostat gets turned down (or up?), and “Home on the Range” when we come back from an outing. I can easily create more interesting triggers using IFTTT. Once the tree is set up, I’ll be able to play the bells directly from my cell phone.

As a long-time programmer with virtually no electronics experience, this is my first Arduino project that involves more than lighting a few LEDs, and I’m very happy with the way it is turning out.

The project started last Christmas when I visited my friend Beatrice, and she showed me a mass-market set of caroling christmas bells on her Christmas tree. Apparently these things have been around since 1989, but I had never seen one before. I immediately bought a set on EBay for twenty bucks, so it could be hacked.

The built-in micro-controller plays a never-ending stream of Christmas carols, which is cool/annoying, but I wanted to be able to control it myself, which is even more cool/annoying. It seemed like a natural for an Arduino project. One of the cool things about these bells is that the solenoids are already built-in to each bell, which greatly reduces the amount of work needed to make them ring. When the voltage is raised, a clapper on a flexible wire strikes the bell, and then springs back to a natural resting position, which prevents accidentally damping the bell by leaving the voltage high too long. Since there are only 9 bells, that’s enough to be played by an Arduino Uno while leaving a few pins left over for serial communication or other needs.

In March, I took these bells to SpecWork, a local Hack-a-thon, with the intent of using them to provide live sound effects for a video game. My electronics hacking skills are not that great, but CStone (Brandon Creighton) was on hand to help out. We opened the case that contains the bell controller and found that the bells were connected via individual wires to a mysterious custom IC that was dated 1989. My intent was to replace that IC with an Arduino.

CStone measured the line triggering a bell on his oscilloscope, which showed a 17v trigger. We decided to try a 9v battery to trigger them, and it worked! CStone disconnected the two bunches of wires, and connected them to the Arduino, with an individual N-Channel mosfet for each bell. The 9v worked okay, but I was having trouble getting a couple of the bells to ring consistently. I found out later that using the 12v power supply that came with the bells fixed this problem.

Below is a video of the bells ringing while I’m playing the game 2048. For the 2048 project, I used the Firmata driver on the Arduino, and wrote a node.js backend that could talk to the Arduino via Firmata, so I could chime individual bells via a REST API. I then modified a local copy of the 2048 game to ring the bells via this API (this amounted to inserting a couple lines of code in the 2048 game). In the video, you can also hear some additional digital sounds I added to add ambience to the game.

Ultimately, though, I wanted to use the bells to do more interesting things than playing that one game, and I didn’t want to have to keep a computer adjacent to my Christmas tree.

I moved the project to a larger breadboard, added a socket for the 12v power supply that comes with the bells. I also added some resisters to reduce spurious rings when I power on, although I don’t think they are a necessity for this project.

I then swapped in a different Arduino clone (a RedBoard from SparkFun), and picked up a couple of XBee radios. One radio sits on an XBee Shield on it, mounted on the RedBoard, and the other sits on an XBee Explorer Dongle hooked up to my desktop computer via USB. Now I can control the bells by sending messages to the Arduino via radio. The total cost of the project, including radios, is about $140. However, if you don’t use the radios, it’s about $50. Jamie Robertson and Joe Hager helped me figure what was needed here, and the book “Building Wireless Sensor Networks” by Robert Faludi was also helpful.

Programming the Arduino to use the radios is almost identical to programming it to use a serial connection. The main difference is that you can’t send entire strings and expect the radios to handle it — I found I had to insert little delays (around 10 milliseconds) between each character as I send a string.

When I googled “Firmata XBee” I saw that I might run into some issues using Firmata with XBee. Also, since I was using radios, I wanted to have a little more local control over rhythm, so in place of Firmata, I wrote a short Arduino script that chimes the bells according to a simple serial protocol. The protocol is intended for music: it allows different tempi to be specified, and for chords to be played. Here are the first few notes of the “Star Wars” theme:

    Bf1--5--4328--5--4328--5--4342

The letters in the beginning are used to set the tempo of each note, and the numbers indicate note numbers. The hyphens are delays (used to extend notes), and ampersands (not shown) are used to indicate chords.

I replaced the node.js backend with a Python/Flask backend, based on a very flexible Flask framework by my colleague Ray Scanlon, which I’m going to call “FlaskRack” since he hasn’t given it a name. This framework allows you to make a set of modular services, each running in its own thread, and each of which has a publish/subscribe hook. It’s really good for making Kiosks that involve talking to diverse bits of hardware. I made a few different Flask modules using FlaskRack:

* “Chime” talks to the Arduino via an XBee Explorer that is connected to a local serial port. I can publish to this module via a REST API to send melodies to the bells from a web browser.

* “Transcribe” has a catalog of carols/songs that can be requested by name – it talks to “Chime”. You can publish to this module to request songs by name.

* “Clock” chimes the quarter hours, like a Westminster-style grandfather clock – it talks to “Chime”.

* “PushBullet” subscribes to the PushBullet API/service, which works nicely with IFTTT, and enables me to create a wide variety of interesting triggers to ring the bells. For example, I can trigger melodies when my Nest Thermostat detects motion, or that the temperature has dropped. This module talks to both “Transcribe” and “Chime” depending on which kind of trigger is used.

I’ll be using the Chime and Transcribe APIs to control the bells from my cell phone.

You’ll find the Flask backend and the Arduino scripts on Github.

More info available upon request.

Thanks to CStone, Matt Pinner, David Guttman, Jamie Robertson, Joe Hager and Ray Scanlon for advice, soldering, code and general expertise.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Everything is Orange

August 20th, 2014

An article about my work with Flickr photographs — in which I noticed that blended digital photos make orange — appeared on The Atlantic website today.

If you’re interested in reading my paper on the subject, “Emergent Orange”, you’ll find it in the publications section of this website.

For the record, I am a bit more than “slightly” bald, however I do indeed imagine myself as a little bird.

Enjoy!

UPDATE Aug-21-2014: A few folks have asked for sample code. Here is a Python/PIL script, amalgamTest, that will average together a folder full of images, creating test images like frames in the movie above – I usually work with a folder of about 10,000 uncorrelated images, although the effect can be observed by combining as few as 25 of them. I usually work with the little 100×100 thumbnail images that Flickr provides. I’ve also include two other scripts in that archive. “getRandomPhotos” is a script you can use to retrieve lots of random Flickr thumbnails, and “getHighestFlickrID” searches for the highest flickr ID number, a number which you can plug into the getRandomPhotos script.

Finally, the Atlantic article omits an important step, which is described in my paper: To see the orange, you have to ‘normalize’ the average, which cranks up the contrast and the saturation. Otherwise, you tend to get a dirt-brown color — the hue is the same, but the saturation is low. My script does this normalization step by default, although it can be turned off via the -n option.

UPDATE Aug-22-2014: Here’s another article on the topic. This one on the Fast Company design website.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Balance Quest Puzzles

August 4th, 2014

Whit McMahon, a puzzle constructor, wrote to me recently to share a new kind of puzzle he created last year called Balance Quest®.

In these numeric logic puzzles, you fill in blanks so that the sum of each box is made by adding the numbers in the adjoining half-height boxes. Note that some of these numbers are negative, and may produce negative sums. Eventually you reach the center, in which the final sum is zero, representing a kind of equilibrium — you have achieved your quest for balance.

Whit has kindly provided two sets of printable puzzles, small and large, which contain more detailed instructions, a fistful of puzzles, and their answers. Here are the two sample sets:

9 Small Balance Quest Puzzles (pdf)

6 Large Balance Quest Puzzles (pdf)

If the symmetry of Galaxy puzzles pleases you, I suspect you may also like these, even though they are quite different. If you find you like ‘em, visit the Balance Quest website for more.

Enjoy!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

About that Mac & Cheese maze

July 18th, 2014

So, as I reported recently on my blog, I discovered recently that a maze that appeared on the back of packages of Kraft SpongeBob Macaroni & Cheese was based on one of my designs. When I notified @kraftfoods of this, via twitter, they put me in touch with Design Partners, an agency in Racine Wisconsin that was responsible for the packaging design. It is perhaps worth pointing out that Kraft (like most companies that outsource their design work) is indemnified against this kind of thing – any legal repercussions would fall on the agency responsible, not on Kraft.

Susan, the HR director at the agency contacted me with a very nice letter, apologizing sincerely for the mistake. She asked me how I would like to “resolve the matter”. I asked the agency to make cash donations to two food banks – $2,000 to their local food bank, the Racine County Food Bank, and $2,000 to my local food bank, the Los Angeles Food Bank. They were very happy to do so, and the donations were made Thursday morning.

I am personally very pleased with how this turned out. I’m aware that some of you (including one or two eager attorneys) were hoping I would try to get a substantially larger settlement. In my mind, this would not have been just. It would have been a reverse form of theft, taking advantage of one person’s mistake for my personal gain. While it’s tempting to blame the “big corporation” for this kind of thing, ultimately these kinds of mistakes are made by people who are prone to the same kinds of errors that you and I make every day. Also, my house is too cluttered with broken pencil sharpeners and cat toys, and I don’t know where I would fit a lifetime supply of mac & cheese.

So, I hope you like the way I resolved this. I feel I’ve turned lemons into actual lemonade. Or spilt milk into unspilt milk? I dunno, you figure it out.

If you are in the US, and you’d like to learn more about your local food bank, I suggest visiting the following directory:

Feeding America.

A big thank you to Josh Masur for advice and encouragement.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Hmm, this maze looks familiar

July 13th, 2014

While grocery shopping this evening, I happened to notice a box of Kraft Mac & Cheese that was turned around, with a familiar looking maze on the back.

While this maze may look generic to you, it looks quite recognizable to me, because I spent quite a bit of time writing software that produces mazes in this style. If you look closely, you may notice the vertices form a fibonacci spiral. It’s a pretty unique design, but, just to be sure, I bought a box, took it home, and started looking through the collection of mazes on my website. These mazes are free for you to download, but definitely not free for you to reuse, unless I grant you permission.

Looking at my website, I found the original pretty quickly. The artist took Maze #1 from Book #1 (published in 2010) of my Intermediate Mazes, and turned it 90 degrees clockwise, and altered it in a handful of spots. Despite the addition and removal of about 7 line segments, the majority of the puzzle is identical to the original. Alas, he or she forgot to ask permission to use my design! They also failed to notice my copyright notice. I can only assume that they figured I wasn’t a consumer of Kraft Macaroni & cheese, or that I would never touch the SpongeBob variety that this maze appeared on (true – I prefer the classic elbow variety, which is getting increasingly hard to find for some reason). I admit I’m not terribly proud of my biannual craving for classic Kraft Mac, but sometimes, I like to pretend I’m 8 years old again.

Here’s the two mazes side by side, just in case there was any doubt:

A helpful note to the good folks at Kraft Foods, or any other multinational conglomerates that wish to use my content without my permission: If you’re gonna steal a maze, you might want to try stealing from maze book #47, and do a horizontal swap on it before you rotate it 90 degrees. That’ll slow me down some…

UPDATE: I’ve worked things out. The story continues…

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Euclid the Game

June 23rd, 2014

euclidthegameFor the past several days I’ve been enjoying solving successive levels of Euclid the Game, an online set of puzzles based on Euclid’s Elements.

You are initially given the equivalent of a stick, a straight edge and a compass (tools for drawing points, lines and circles), and are asked to construct an equilateral triangle. Once you’ve solved that, you now have a new tool that draws equilateral triangles, which you use to help solve the next problem. As you solve successive problems, you build up a collection of increasingly sophisticated tools, and solve increasingly difficult problems.



I’m currently on level 20. Not sure how far this goes, but let me know if you get stuck.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Benjamin Franklin “Holograph”

May 11th, 2014

This is a new demonstration I’ve prepared of my Mirror Morph technique, discussed previously. It’s a simple 2D trick that can make still images look three dimensional.

Here’s a GIF version.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Masyu puzzles are here!

May 9th, 2014

I occasionally get requests to add new puzzle varieties to the collection. I have to ignore a lot of these, because there are 24 hours in a day. However, the last request I received, for Masyu puzzles, was hard to ignore, since I’ve enjoyed solving these myself for the past few years, and I’d love to have access to a larger collection of them. So what the heck! I made a bunch.

Masyu puzzles are closely related to Slitherlink and other spatial reasoning puzzles. Like Slitherlink, the end result is a loop which is constructed from straight line segments.

Unlike Slitherlink, Masyu puzzles don’t use numbered clues. Instead, the clues are black and white circles, which I am told resemble pearls (although I think they resemble the stones in the board game Go). This gives the puzzles an elegant simplicity which is perhaps only rivaled by Galaxy puzzles, another great Nikoli-style puzzle.

Masyu puzzles use the following rules:

  • Black circles indicate corners.
  • White circles indicate straights.
  • Black circles must be turned upon, but the loop must travel straight through the next and previous cells in its path.
  • White circles must be traveled straight through, but the loop must turn in the previous and/or next cell in its path.

If you’d like to learn more about how to solve the puzzles, I’ve written a (hopefully) helpful tutorial, which you’ll find here. If you find the tutorial less-than-helpful, let me know, so I can work to improve it.

If you’re ready to try your hand at these puzzles, check ‘em out!.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

BaffleDazzle – an interesting kickstarter for puzzle people

April 24th, 2014

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter

Cool music visualizer with flames

April 18th, 2014

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Design Float
  • E-mail this story to a friend!
  • HackerNews
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Twitter