More Particle Internet Button Projects

I posted a few months ago about the Particle Internet Button I’m playing with (link). I’ve created another 2 projects in the mean time.

Adjustable Timer

The first is an adjustable timer. The lights on the Internet Button are used to indicate 30s steps, ranging from 30s to 5min. When it turns on you specify the length of time you want to run it for by either increasing or decreasing the steps. When running the 30s that are currently active flashes. At the end of the time, the Internet Button beeps and flashes red. It can be easily adjusted and reset.

particle timer

Left: select length of time
Right: Timer running

I made this back in November, but actually had a problem with it that I couldn’t figure out. I had intended to post to the Particle forums for help but never got round to it. I had in the mean time uploaded the offending code to Github. I recently reinvestigated the code with the intention of this post, and found that someone else had found my code, and solved my problem, so thanks to Github user mseneshen. Working code can be found here: source

Dice

The second project was a set of dice. Playing Catan and having people complain about how there were no 3s rolled in a game gets old, so why not create a set of dice that keep track of this and tell you facts. Apps are available for this, but then the screen turns off and it becomes a hassle. So I wrote some code to mimic a set of dice.

particle dice

Left: Dice being rolled
Right: Dice have been rolled

To roll the dice you gently shake the Internet Button sideways. The code randomly generates two numbers between 1 and 6, adds them, and outputs them by lighting up the appropriate number of LEDs. To make it easier to read, LEDs are colour coded in groups of 3. The Internet Button only has 11 LEDs, so I if a 12 is rolled, the 11th LED changes colour. Because a 1 is never rolled, I could have used that LED, but it seemed less intuitive. Also, because we play Catan, if a 7 is rolled, all the lights go red.

The whole time the dice are running, a tally is kept of how many times each number is rolled. At any time you can click a button and a distribution is published to the console. I might update this later to automatically graph the data and tweet it, but haven’t tried that yet.

When I first tested the code, I was getting reproducible random numbers, so I introduced a seed from one of the analogue pins which appears to have solved that problem. Because it uses an accelerometer to trigger a throw, when it is on it’s side, gravity is enough to trigger a throw and allows me to get thousands of throws without destroying my wrists.

Some plotted results can be seen here, with actual roll percentage (bars) vs statistical roll percentage (dots).

Code is available here: source

Temperature and Altitude

I recently bought an Adafruit BMP180 that I’m trying to get running with the Internet Button. Will post details once it’s active.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.