Penny for your thoughts?

I've been using my spare time lately to build something that's even more trivial and silly than usual. Behold, the advice machine!

Operation is pretty straightforward. You insert whatever quantity of coins you see fit, then request some advice from the machine. The quality of the advice you get reflects the value of the coins you put in - more or less. More money typically results in more in-depth fortunes, and more interesting ones such as quotations, while a small amount gets you platitudes or terrible jokes.

Here's a video of it in action:

More photos can be found here.

All in all, the project was relatively straightforward, after a couple of false starts. The coin acceptor is a standard item commonly found on ebay - this one has model number CH-926 - for around about $20-$30. The device has a moderately complex setup procedure whereby you 'train' it on a set of sample coins, and tell it how many pulses to output for each coin. After that, it will recognize coins similar to the ones it was trained on, outputting the appropriate number of pulses on one of its pins when each is detected.

The LCD is a standard 16x2 character display, with an I2C backpack from Jeelabs. The thermal printer is the same Sparkfun item that has inspired so many (mostly twitter based) hacks.

The whole setup is controlled by a Raspberry Pi. A simple DIY breakout board separates out the various pins - GPIOs for the buttons and the coin acceptor, I2C for the display, and UART serial for the printer. A simple Python program scans the GPIOs for activity (using polling, unfortunately) and drives the display and printer.

Advice is sourced from the Unix fortunes databases, with certain databases corresponding to different amounts, with a bit of fuzz added for extra fun, and semi-random allocation of 'bonus' fortunes. I've categorized some of the databases by perceived value, so $0.05 is more likely to give you a platitude, while $1-$2 might get you a quote from the Tao. This is pretty rough, though, and all up I think it's the weakest part of the build. If anyone has ideas for a better source of advice, or a better way to categorize it, I'm all ears.

Now that it's built, I'm planning on offering it to the local Hackspace as a substitute donation box.

Many thanks to Gavin Smith of the Sydney Hackspace for the original idea.

Comments

blog comments powered by Disqus