Monday, September 3, 2012

Machine 00: Frankenphaser

Inspiration

At the beginning 2012 I started messing pointlessly but with more vigor than I had the year before in the world of ASICs and Arduino. They're cool, cheap and talk to the world in which we live. Obviously, art works like Machine 06 are more my scale and speed, but I thought a few simple things first would be fun. They allow one to build one's confidence and get the brain back into hardware troubleshooting.

I read an interesting little instructible type thing from the good folks over at the PublicLaboratory.org for a thermal flashlight. The idea being a device that you shine on an object which simultaneously measures the surface temperature in its field of view. The device constantly adjusts the colour based on temperature. 

The short version is this, point it at something cold it shines blue, at something hot you get red. As far as application, there are a lot of poorly insulated houses in Tassie. Erin and my place is no different. I loved the idea of sweeping something over a wall in a darkened room and getting an idea of where the insulation isn't!

The diagram and code was as simple as it gets and a visit to LittleBird & Jaycar sorted me out with bits I didn't already have for $40 or so. The heat sensor making up three quarters of that bill.


Now, I did something different on the LED front than the Public Lab lass by using WS2801 rather than pulse width modulation of the LED as shown above. I've modded code to suit, sing out dear reader and I'll throw the code online should you need it. 

How Well Did it Work?

Um not very effective but still awesome. 

As it was originally coded, the device needs to know the range of temperatures to expect in advance. My RGB LED was too weak and this version had not enough lasers. Anywho, I finished breadboarding it and wrote something up to do auto ranging back in January, which I'll explain later. My plan was to build it into a cool case add a laser site and use it in both household and automotive tuning applications. 

The Plan? Bigger... More...

Having bowled over the main challenge it languished in a draw while I focused on other projects. Until last weekend when the sun came out and I set up in the back yard with a drink, some stuff and some time. I'd like to finish this during September. There will be more posts to follow and I'll upload the finished code when it is a little less alpha.

The Specification

  • Fits in the Light Phaser Case, so using an Arduino Leo
  • Add a laser and add high current switching for it
    An exercise in good practice rather than need
  • Fit a Bluetooth shield so I can make a temperature readout as a separate display
    More on this later too :)
  • Enbrighten the colour shone with bigger and more LEDs.
    As bright as possible without melting the plastic.
  • Add switches for power and ranging modes
  • Add logic to turn the laser on and off based on trigger conditions
  • Open source the code


Initial Build (part 1 of 2)

Gutted Light Phaser: I had to drill out the screws ,25 years of habit was unbreakable an other way. First small win though, the original sensor board is as close as makes no nervermind to the Arduino Leo. That is the proto shield sitting on top.

Another Win: A bracket and centre hole was already provided for the sensor. By drilling it out I could mount the laser nice and squarely. Some hot glue and bam!

The Heat Sensor: It is pushed up hard against the lens housing. I added a little bit of pressure while it dried to get a goodish match for the laser direction. Precision is not too critical. Of note if you follow me in a similar build, the sensor is a bit painful. Solder the wires to the Melexis first, add hot glue to separate the pins, let it cool then glue it in place as a wired unit.


Wired Unit: As installed the sensor does not interrupt the beam path.

A fully wired unit: I had drilled two holes in the bulkhead to take the wires for sensor and LEDs.  I've left them long for integration testing.

Taxi!!!! Beer was then spilled everywhere! Ruining one breadboard.

Zippy? The original microswitch trigger was not, as I had suspected, a momentary action. This simplifies the code when the time comes. 

Lastly I drilled some holes for the switches at the back of the device. Here I made a small mistake but I'll be able to land it and look like I meant it. More on this in part two.

Whatho, Mack


Tuesday, August 7, 2012

Machine 6: Wall-o-Tetris updating 2500 pixels via SPI

I'll update my earlier post at the end of this week. But we're progressing and I thought I'd add a little something.

Challenge #1


Take SPI addressable RGB LEDs like those in the video below and update a wall comprised of 2500 of the little sods quickly enough that it looks okay. The design goal I've set is to get to 25 frames per second, much like TV.  This is not such a big deal for Tetris, but for other animations a fast frame rate such as this is important.

A few dozen to a few hundred pixels is easily updatable from an Arduino  using a single SPI line and a cascade (think daisy chain) of WS2801s. But it doesn't scale well to 2500 pixels at 125mm dot pitch.
2500 x 125 / 1000 = 312.5 metres of daisy chained lights. Two obvious problems surface with this.
  • SPI in this application is good to 2Mhz
  • There is voltage drop over 300 metres and 5v (easily fixable)
  • Besides 2Mhz being the ceiling of device, the WS2801 spec has this to say on long runs...
The Connection and Driving of Cascading Operation The transmit of data over long distance by cascading, the WS2801 integrates push-pull output stage with strong driving capability.  This enables the data and clock to be transmitted up to 6 meters at 2MHz clock frequency. To prevent the reflection, it is necessary to connect a 50Ω resistor at the data input or output port for impedance match. So 6 metres is it, regardless of how many LEDs... I think the phrase rhymes with 'clucking bell'.
So I'm planning 32 SPI buses to keep close to or under that 6 meter ceiling.

There are a few options to achieve this:

  1. Use the Arduino's stack of digital IO pins and some serious bit banginging to emulate in software lots of SPI buses across those pins.
    The chip in the Arduino is not quick enough to do this well.

    Or
  2. Ask good old Sean to come up with a much better plan. By using the fast hardware SPI port on the  chip  (an Atmega 2560) to run at 2Mhz and multiplex that signal with a CPLD.
    The dev board has been ordered, the VDHL has been written and over a couple beers explained to me slowly. No emulation and bit twiddling required. Ace 
Assuming option two works, how many pixels can we push through SPI at 2Mhz? 
  • Each pixel drinks 24 bits, 8 each for Red, Green and Blue.
  • 2 Mhz is 2 million cycles per second. (2,000,000 / 24 bits)  / 25 frames = 3333 pixels!
  • A nice margin over 2500 right? In fact 1.5 Mhz will probably do us just fine. 
Whatho,
Mackintosh

Monday, July 30, 2012

Machine 6: Westend Pumphouse Wall-o-Tetris

So Westend Pumphouse has a very interesting little wall made of recycled milk bottles and rio. The siren song of its clean yet messy lines is calling me. To serve my drinking and nerding needs I'll be attending games night Wednesdays, turning this wall into a big blocky screen. You'll find my progress on this blog tagged with 'Machine 6'.

The idea is simple; turn the wall-o-milk into a display. Initially, this will be used for Tetris and then a kinetic sculpture encouraging patrons to interact with it. My goal is to do this as cheaply as possible without impacting the look of the thing.


What on earth am I talking about? 

Aricibo Space Message rendered all colourful
This kind of thing


Played on this thing

Nerdly Details

An installed video wall this size would be well over $12k and would still suck at certain jobs. Some details on the wall-o-milk as it sits:
  • The wall forms a rather dishy matrix of 86x30 squares
  • Each square is about 12.5mm per side
  • Total number of pixels is a little over 2500
  • Overall size is 10ish by 3ish metres

Ideas

  1. Tetris, because Al can't build me a giant Tetris screen and just use it as a wall
  2. Add control via Wiimote
  3. Add control via Kinect 
  4. Facebook integration, if you check in to facebook @ the Pumphouse it throws your name in blocky text, up in lights
  5. Competitive Kinect controlled Tetris
  6. Gif/Retro slideshow
  7. Etch-a-sketch using an old Wacom tablet I have somewhere
  8. DMX Integration (good for gigs)
  9. Maybe throw in a Breakout type game

Plan of Attack

What follows in my braindump of what needs doing. Probably limited interest to anyone that is not me. 
  1. Get permission
    Yep, Al is excited
  2. Trial SMD 5050 in the base of a few bottle to see if it will work.
    Done, it does
  3. Settle upon type of WS2801 based RGB LED
    Ordered a few different types to trial. Waiting
  4. Order enough for a matrix big enough to get Tetris up and running
    Main game board is 10*20 with a second display, for next block et al of, say, 16*7 (312, but will  order 350)
    Order will be 14th of August with setup early in September
  5. Get the Simple Tetris Clone compiling and understood.
    1st of August
  6. Code an SPI emulator in Python. 
  7. I don't want to do the uglier bits of prototyping in the Pumphouse if I can avoid it. An SPI emulator would be bloody useful for heaps of things.
    8th of August
  8. Port to the Arduino
    15th of August
  9. Etch-a-sketch with results posted through to Facebook (upon request)
    5th of September
  10. Breakout clone coding
    End of September
  11. Build out wall so the whole thing can be lit
    Depends a bit on funding, but hopefully ordering in September
  12. Kinect control and two player mode
    Will start on the code towards the end of August, I have no experience with this device, but looking at the SDK most of the heavy lifting has already been done. 
  13. DMX integration
    Prior to December
I discovered an interesting site while I was looking up a reference for SPI. The acronym may refer to 'sock puppet investigations', which is a hilarious name for a fairly serious thing.

Whato, Mackintosh