Difference between revisions of "Light Brigade IR Badge Board and Soldering Workshop"

From BuildBrighton
Jump to: navigation, search
Line 17: Line 17:
  
 
[http://github.com/mikepea/white-night-kit/ The final version of the software for the workshop is available on Github]
 
[http://github.com/mikepea/white-night-kit/ The final version of the software for the workshop is available on Github]
 +
 +
Update: [http://github.com/mikepea/buildbrighton-ir-badge Here's the latest version of the badge code], for a Tiny45 - which we used for the follow-up Science Festival 2011 workshops. [[https://github.com/mikepea/buildbrighton-mcu-programming-workshop There's also an MCU programming workshop]] around the same code and badge platform.
  
 
At the moment the code reflects the rules in the [[Media:BB Badge rules.png |rules diagram]]
 
At the moment the code reflects the rules in the [[Media:BB Badge rules.png |rules diagram]]

Revision as of 04:09, 26 May 2011


We were approached by the organisers of the White Night 2010 celebrations to run a workshop for the event - Light Brigade. The theme for 2010 is 'Illumination', so we figured some kind of light-displaying kit would be ideal. It would need to be a small and easy to put together kit, for any level of ability, and cost very little money to produce.

We've all previously seen and played with the Trippy RGB kit from Mitch Altman's Cornfield Electronics, which uses a combination of an IR sensor and IR LED to reset a pattern of colours sent on an RGB LED, and thought that would make an excellent base to start the project with.

We wanted to take it a step further though, and have actual data sent over IR from device to devie, and see what kind of game could be made if that were possible.

Matt created a board design for the project pretty early on, and got that shipped to PCBcart for production. Previous workshops have taught us that whilst its possible to etch custom boards for these events, the quality of them makes it difficult for folk to solder, and there's a much higher risk of shorts and track lifting.

The board does differ from the Trippy RGB board, in particular as we wanted the PCB to be worn as a badge, it has been made single sided with a front-mounted battery holder. We also changed the pin-out, which in retrospect was not a great idea - though the code can be translated it did mean that we had a reasonable amount of effort translating the prototype (on a cornfield board) to our new design - and now we need to provide two versions of the code. Hey ho, live and learn.

Thankfully, our board works too! (And are available for purchase from The Shop :)

Soldering instructions for the kit are here: Media:BuildBrighton badge instructions-web.pdf

The final version of the software for the workshop is available on Github

Update: Here's the latest version of the badge code, for a Tiny45 - which we used for the follow-up Science Festival 2011 workshops. [There's also an MCU programming workshop] around the same code and badge platform.

At the moment the code reflects the rules in the rules diagram

Software-wise, most of the effort was spent porting the NECrcv and IRremote Arduino libraries to the ATtiny25. This was quite a learning experience, getting to grips with how Timers and Interrupts work, plus the register-based programming of the ATtiny25, in avr-gcc. Joy.

IRremote was originally chosen so that we could potentially support more than one protocol (though we had selected NEC-IR early on, as it has error checking built into the protocol). However, we realised a little late in the day that the ATtiny25 has significantly less memory than a ATmega168, and the decoding routines of the IRremote lib were not going to work. 128 bytes of RAM is not a lot to play with.

Fortunately for us, NECIRrcv (that IRremote was based on), does not use as much memory, since it decodes the IR on the fly. Phew.

Ken's pages on IR protocols and Arduino PWM proved invaluable in the porting effort too. Thanks Ken!


What did we do right?

We finished it, with 5 minutes to spare!

Printed instructions for the kit, made by User:Toby Toby on the day, were absolutely essential - we'd have been spread way too thinly to manage 20 folk without these.

We got 500 boards made, so we've got a usable platform for ATtiny* programming.

What did we do wrong?

Diverging from the Trippy RGB schematic was not really a sensible idea. We were lucky to find that our board, whilst having the IR LED on a different pin, still had a suitable PWM mode available on the ATtiny25. The timer was completely different though, so needed a bit of a recode. And now anything written for the TrippyRGB will need porting to work on our Badge Board.

We left everything to the last minute, again. I guess this is just the best way to work for some projects, but jeez - finishing the code 5 mins before the first workshop was a bit of a stress. As having to order emergency parts two days before, because the Tayda order from China hadn't turned up. It did btw, on the Friday before the workshop.

Hindshite is a funny thing, but if we could do it again I think we should have gone for ATtiny45's at least. Double the memory, EEPROM, and Flash at that level is quite significant, and ultimately we needed to remove a chunk of functionality to fit the code on the ATtiny25. I have a feeling if we'd specd 45's though, we'd be saying the same thing about getting 85's next time ;)