Holideck – Development and Simulation for Holiday by MooresCloud

home screen for Holideck the Holiday simulator

We want everyone to be able to develop applications for Holiday by MooresCloud; but we’re still about 12 weeks away from shipping our first units.  In order to speed development (both internally and externally) we’ve put together a simulation and development environment which provides a platform that is roughly 99% identical to the code that will be running on the Holiday when it ships.

Holideck is a pure Python simulator for Holiday by MooresCloud, which allows anyone to write apps for the Holiday in two of its three available development environments – HTML5 Web apps using IoTAS, and pure Python.

To install Holideck on your own computer, type the following command into a terminal window (making sure that you’re in the directory where you want holideck installed):

% git clone https://github.com/moorescloud/holideck.git

You should now have a directory named holideck.

If you don’t want to use git, grab the ZIP archive and unzip it wherever you like.

Invocation

% python holideck.py

When holideck launches it opens two ports on the localhost, one for simulator access, the other presenting the web app interface to Holiday.

The HTML5 simulator simpype will try open port 8888; if that port is unavailable, it will increment the port number until it finds a free port.

IoTAS, the Internet of Things Access Server, will try to open port 80 (which is only possible if python has been run with root privleges), or if running as a user program, will try to open port 8080. This port is often occupied by other applications (Apache, Tomcat, etc), so IoTAS will increment the port number until it comes to an available port.

All of which is to say that the simulator could be found on port 8888, but might be at a higher port number, and IoTAS could be found on port 8080, but could easily be at a higher port number.

The port numbers are given in the output generated by holideck as it is initializing.

To quit holideck, simply type a Control-C in the terminal window.

Holideck – specifically IoTAS – currently produces voluminous output for debugging purposes. Eventually, this will be moved to a log.

Using Holideck

Holideck is designed to provide a complete simulation and development environment for Holiday by MooresCloud. It is implemented in pure Python.

Holideck is composed of three pieces:

simpype

Simpype is the HTML5-based simulator for the Holiday. Simpype simulates the 50 individually-addressible 24-bit colour globes on the Holiday.

To use simpype, point a browser to the simulator’s web page – generally that will be http://localhost:8888, with the caveats as given above.

You should see something like this:

simpype in browser

What looks like a dashed-line extending from the Holiday image on the left side of the page is actually the string of globes, with each globe initialized to black.

The Javascript in the page loaded by simpype will poll the simulator at approximately ten updates per second, so you do not need to reload the page to see updates to the simulation.

The simulator can be opened in multiple browsers simultaneously, with the caveat that each browser will poll the simulator at 10 Hz, so many browser windows pointing to a simulator instance will produce quite a bit of load on the simulator.

IoTAS

The Internet of Things Access Server, or IoTAS, provides both the RESTful interface to Holiday by MooresCloud and the web-based application, control and configuration interface for Holiday.

The interface for IoTAS looks best on a mobile device.

After holideck has been launched, point a mobile device to port 8080 (or possibly higher, with the caveats given above) on the computer running holideck.

For example, if the computer running holideck is named iris.local, you should point your mobile browser to http://iris.local:8080. The home screen for Holiday’s HTML5 web app interface should then load:

holiday home screen

To test holideck, tap on the ‘API demo’ icon, flip the switch, and – if the demo is working correctly – you should see a random selection of colors sent to the simulator.

IoTAS defines a detailed RESTful interface to Holiday by MooresCloud.

This will be documented in the holideck wiki.

Holiday web apps

MooresCloud has created a number of demonstration HTML5-based web apps. These can be used and adapted for your own web apps.

A number of these apps, although included within holideck, are not yet fully functional and should not be used.

The apps which are functional include:

Colorwheel – Select a colour from the colorwheel, and the entire string of lights on the simulator will reflect the color change.

API Demo – Generates 50 random colour triplets and sends them to the simulator.

NRL – Prebuilt color patterns for all 16 teams in Australia’s National Rugby League.

AFL – Prebuilt color patterns for all 18 teams in Australia’s Australian Footbal League.

Examples

The examples subdirectory contains two Python applications that illustrate some of the capabilities of Holiday by MooresCloud when connected to a process running either locally on the hardware, or externally on another computer.

Twug-of-War

Twug of War creates an animated Twitter tug-of-war between two competing hashtags.

It’s invoked as follows:

% python tow.py hashtag1 hashtag2

The first time the program is run, it will attempt to authorize itself with Twitter. A browser window should open, ask for your Twitter credentials if you’re not logged in (a Twitter account is a prerequisite for Twug-of-War), and, once logged in, will ask you to authorize the app. Once the app has been authorized, Twitter will provide a code that must be entered at the terminal prompt. Once authorized, Twug-of-War will be able to register a stream listener on Twitter.

The string will initialize to half green, and half blue, with a yellow counter in the middle of the string. As matching hashtags are seen in the Twitter ‘firehose’, the counter will move one directon or another. When the string is completely one colour, the program will terminate.

Soundlevel

Soundlevel turns the Holiday by MooresCloud into a real-time sound level monitor.

It requires some prerequisites to be installed, specifically PortAudio library and the PyAudio module. Consult the documentation at those websites for more details. (Ubuntu/Debian users can probably install both with sudo apt-get install python-pyaudio, but for OSX and Windows it’s considerably more involved.)

It’s invoked as follows:

% python soundlevel.py

In general the application will correctly detect and use the microphone input on the computer running Soundlevel, but that may not alway be the case.

Many thanks to Josh Deprez for Soundlevel.

More Caveats

Holideck has been tested on Linux (Ubuntu & Mint), OSX 10.7 & 10.8, and Windows 7/8.

This is a first release; there are bound to be numerous problems. We apologize in advance for this.

If you have any serious problems, please leave a message on this thread.

All of this code is released under the MIT License.

Holiday Hardware is Open Source

The Holiday controller is an open source hardware design, originally inspired by the Olimex OlinuXino (https://www.olimex.com/Products/OLinuXino/iMX233/) – a Freescale iMX233 based embedded linux development board.

Holiday-PCB-panel

We used the OlinuXino iMX233 Maxi and Micro boards during development and testing of both the Light and Holiday, before designing our own custom PCB layout to suit the form factor and specific requirements.  The Holiday also incorporates an ATmega328 (running the “Arduino” environment) that communicates with the Linux environment for handling control during Linux boot-up and providing the tight timing requirements of sending data to the WS2812 LEDs.

Holiday-PCB-front

Shown above and below are our revision 1 prototypes in a CNC’d plastic enclosure made specifically for use at PyCon Australia 2013.  The picture below also shows a 3 pin serial debug connected (at the centre top).

Holiday-PCB-rear

The revision 2 hardware design is in Altium Designer (v13) format, and the Altium files along with the BOM, PDF, and gerber outputs are now available under the Creative Commons Attribution Share-Alike license (http://creativecommons.org/licenses/by-sa/2.0/au/).

See the MooresCloud holiday-hardware github repo for the files.

Footnote by Kean 18Sep2013: Due to supply issues with the 16MHz crystal we included in the BOM, the production Holiday will actually use a 20MHz crystal for Y2 (the ATmega328 “Holidayduino”).  This leads to some special set up for compiling your own code in the Arduino environment.  I’ll be documenting this soon.

Holiday hardware at a glance

controller

We’ve just announced Holiday by MooresCloud, our casual lighting solution for the Christmas Tree or anywhere else you want some fun, beautiful, connected, programmable lights — with a full REST API!

Holiday hardware features (incomplete list – minor edits 4/12/13):

  • 7 metre string of 50 ‘globes’ in opalescent diffusing shell
  • 1 meter runner, 6 meters of lights with 120mm spacings
  • Globes are full 24-bit color capable
  • Globes are individually addressable
  • Globes are removable and replaceable in case of failures! (hopefully in a future release)
  • iMX233 CPU running Arch Linux @ 454 Mhz
  • 64 MB DDR RAM
  • 2 GB 4 GB microSD – easily accessible & replaceable. 
  • Atmel ATmega328 microcontroller (drives the globes)
  • 3 buttons (mode / plus / minus)
  • USB with 802.11n WiFi adapter
  • Controller board is fully open hardware
  • 3A 5 VDC switching power supply (internationally compatible)

That’s very brief I know.  We’ll go into full details – and schematics and PCB layouts for the open hardware components. Because you know us – we love to share.

More soon.

globe

Prototype hardware design files published

On the Schematics page, we’ve just published the hardware design files for the latest prototype, along with some additional details.  Keep in mind this is a work in progress.

And although this means you can now build a Light for yourself, if you add up the cost of sourcing small quantities of the individual components, and getting a small batch of PCBs made, you are easily up for several hundred dollars.  And you would still need to fabricate a nice semi-transparent enclosure – probably another few hundred dollars (at least), and unlikely to be as cool as our final industrial design.

Better just to back our Kickstarter and let us make one for you!  :-)

Why not Arduino?

photo – equinoxefr

This is something we hear a lot. People don’t understand why we’ve opted for such a powerful computer at the core of the Light.

Right at the very beginning, after my first meeting with Kean Maizels – who has since become our genius hardware designer – I was asked why I wanted such a powerful computer at the heart of the Light, when a simple microcontroller – a la Arduino – would be cheaper and easier to implement.

Here’s my response:

One of my guiding maxims in my work is a line from William Gibson: “The street finds its own use for things, uses the manufacturers never intended.”

The Light  is a general purpose computing device.  That is the reason the company is named MooresCloud.

It is intelligence: raw, unfiltered, capable of anything it puts its mind to.

That doesn’t mean there aren’t constraints.  There always are.

But the Light is perhaps best thought of as general purpose computing device with a very low-resolution display.

A ‘smart’ appliance isn’t smart enough.  A ‘smart’ appliance has a microcontroller capable of some pre-programmed tricks.  The Light should be capable of anything thrown at it, up to the limits of its CPU and memory.  Because we are creating a platform, we simply do not know, can not predict, and do not want to artificially limit the kinds of wild ideas people will implement on it. Uses the manufacturer never intended.

Creativity must be channeled, this is very true, and that means strong developer guidelines & resources, app review policies, and all of the subtle control-freakery that both Nintendo and Apple are famous for – without the underlying humourlessness.  Creativity is handmaiden to chaos, no doubt about it, and people will want devices that ‘just work’. This creates a natural and fertile tension both in the design of the device and in its use.

I would like us to pick our points of compromise carefully.  And the points upon which we will not compromise, because in them the whole of the design is reflected.  I believe this is one of those points.

That what I thought in the beginning of September, at the very start of this whole process.  I continue to believe it. Now, on the other side of the design process, I have some numbers to back it up. The difference in the Bill of Materials between an Arduino sophisticated enough to handle WiFi and a few basic REST commands, and our fully-fledged Linux ‘Lamp with a LAMP stack’?

Less than seven dollars.

Given this tiny differential in costs, the enormous gains in power and interiority – having a device that can think for itself, rather than just enact commands delivered by other devices – more than justify the increased component cost. This is the kind of feature creep we value in our design, because it multiplies potential disproportionately.

Website Git Repo

Since we launched the website for the Light by Moore‘sCloud, we’ve received a great deal of positive feedback. Thank you! As we say on the website, “every aspect of our work is being released under open source licenses”, an in that spirit of openness and transparency we’re putting the source code for the website out there.

As all web designers and developers know, it’s a simple matter to view the source code behind a website, and if you want to get at the underlying HTML, CSS and JavaScript files, then you can. That said, nothing can beat the simplicity and sheer good manners of cloning a Git repository. So if you please, you can find the repo for our website right here https://github.com/moorescloud/light.

Welcome!

Welcome to the development blog for the Light by MooresCloud.  This is where we’ll share all of our schematics, code, tutorials, and anything else that can help you have more fun developing for and using the Light.

There’s not a lot here yet – we’re sorry about that!  We’ve been so busy getting the Light ready for launch we haven’t had an opportunity to add much content here.  Over the next weeks you’ll see us fill these pages with everything we’ve learned.

The Light by MooresCloud is an open source product – all of our hardware is being released under Creative Commons licenses, and all of our software under the MIT License.  You are free to use our work in any way you want – no limits.  We believe in sharing, and we hope you’ll join us as we explore the possibilities!