Internet Candle

Flickering Candle

Background

This project used the Aspect Prototype V (Spark Core) to create a simulated candle flickering in the wind. The wind speed is obtained periodically from the web and used to control the flickering intensity.

Design

The emulation of the flame uses a virtual source that randomly moves over the x,y plane. The maximum excursion is set by the wind speed, so a high wind speed has large random excursions and a low wind speed has small ones.

The code uses an illumination model that was derived by considering the total integrated flux on each side due to the virtual source’s position. A future upgrade to the code should consider using the simpler corner illumination model used in the Pomodoro Timer application.

The code uses the Yahoo Weather API and a PHP script running on a server. A GET request to the PHP script returns a JSON formatted wind speed for a fixed location. This offloads processing from the Spark Core to a server (where it belongs).

Touch Sensor

The touch sensor was implemented with capacitive sensing using the Spark micros() and attachInterupt() functions. Details can be found here.

Code

The code is released under GNU Lesser General Public License Version 3.

The code for both the Spark Core and PHP script can be found at the Aspect Github repository.

You also need to include this PHP class: Yahoo-Weather-API-PHP-class in the same server folder as the wind.php script.