Difference between revisions of "Progromino"

From i3Detroit
Jump to: navigation, search
(Added source code)
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 
We don't need no stinking 555 timers!  We have an AVR in the same form-factor!
 
We don't need no stinking 555 timers!  We have an AVR in the same form-factor!
 +
 +
Origin of the name: Programmable Domino = Progromino (pro-graa'-min-o)
  
 
The goal of this project is to design an electronic domino using a small AVR chip and minimal components, but at the same time provide a huge amount of flexibility and capability.  Here's the 555 version:
 
The goal of this project is to design an electronic domino using a small AVR chip and minimal components, but at the same time provide a huge amount of flexibility and capability.  Here's the 555 version:
Line 15: Line 17:
 
2. For the initial version, was not able to incorporate the switch (too expensive for switch and PCB space). Need to come up with a suitable H/W and S/W solution.  Springy wire?  Using ATTiny44A provided a complete SPI interface and one extra unused pin!
 
2. For the initial version, was not able to incorporate the switch (too expensive for switch and PCB space). Need to come up with a suitable H/W and S/W solution.  Springy wire?  Using ATTiny44A provided a complete SPI interface and one extra unused pin!
  
3. Update schematic.  The LEDs used for sensing the light input are upside down!
+
3. Write some more demo programs.  Ideas:
 +
* Add a delay of about 1/2 second between inputs and outputs
 +
* Switch colors from input to output (e.g., red input turns on green output)
 +
* Demo mode where outputs are turned on in different sequences
 +
* Use an averaging algorithm to adjust to ambient light conditions
 +
 
 +
 
 +
 
 +
==Design==
 +
This design uses LEDs as inputs.  The LEDs are chosen to minimize crosstalk between colors by taking advantage of the fact that LEDs respond to wavelengths shorter than those they emit.  Hence the blue sense LED is a slightly longer wavelength than the blue LED output.  The green sense LED is more yellow, so it will respond to green light (and blue light, but not red).  The red sense LED responds to all of the colors, unfortunately.  Still there is some separation, and if you line up a series of Progrominos, you'll find that the directionality as well as this separation by wavelength is pretty effective.
 +
 
 +
Here's the latest source code and programming file for the basic operation.  This new version uses an averaging algorithm to determine when the light level on each LED has increased, rather than using the input voltage level directly.  It also implements a way to flush the sample and hold cap internal to the processor, so that the input from one LED does not bleed over to the next sample for the next LED.  This is accomplished by setting the inputs to outputs and setting them to low.  This discharges the S&H capacitance.  Then the pins are set back to inputs and the input buffers are disconnected, allowing the S&H to charge before the ADC takes the next sample.  Timer 1 is used to set the charge time.
 +
 
 +
[[File:ProgrominoDelta.asm]]
 +
 
 +
[[File:ProgrominoDelta.hex]]
 +
 
 +
Why all this gyration?  As it turns out, although LEDs output a voltage that's related to the input light level, they don't generate much current.  The S&H for the ADC on the microcontroller is designed for an input impedance of about 10K.  This provides enough current to charge the internal capacitor quickly (the S&H has a capacitor that holds the voltage level while the conversion takes place).  LEDs look like a much higher impedance and thus require a longer time to charge the S&H.  So instead of micro seconds to sample the LED light level, it takes milliseconds.  Experiments with an Arduino indicate that something along the lines of 250 ms is good, but shorter times can be adequate if you're just looking for some amount of change and not an accurate measurement of light level.
  
[[File:progromino.asm|100px|thumb|Assembly language source file]]
+
==What to do With Them==
 +
The bill of material ended up being fairly expensive to have a whole bunch of these lined up, though it would look very cool.  To reduce the cost of having a large light show, the Progrominoes can be combined with a bunch of cheaper Le Dominoux in an arrangement like a model railroad track, where the Progrominoes act as switches between tracks of Le Dominoux.
 +
[[Category:HOWTO]]

Latest revision as of 16:37, 24 June 2012

We don't need no stinking 555 timers! We have an AVR in the same form-factor!

Origin of the name: Programmable Domino = Progromino (pro-graa'-min-o)

The goal of this project is to design an electronic domino using a small AVR chip and minimal components, but at the same time provide a huge amount of flexibility and capability. Here's the 555 version:

http://relwin.hackhut.com/2011/03/01/555-timer-contest-entry/

And here's the current design:

Schematic for board

TODO

1. After reviewing the CR2032 spec, looks like it's not sufficient to drive 60 ma - the maximum current required with 3 LEDs on. Fallback is to use 3xAAA batteries, but that's bigger than the device itself! There must be a better solution for powering it.

2. For the initial version, was not able to incorporate the switch (too expensive for switch and PCB space). Need to come up with a suitable H/W and S/W solution. Springy wire? Using ATTiny44A provided a complete SPI interface and one extra unused pin!

3. Write some more demo programs. Ideas:

  • Add a delay of about 1/2 second between inputs and outputs
  • Switch colors from input to output (e.g., red input turns on green output)
  • Demo mode where outputs are turned on in different sequences
  • Use an averaging algorithm to adjust to ambient light conditions


Design

This design uses LEDs as inputs. The LEDs are chosen to minimize crosstalk between colors by taking advantage of the fact that LEDs respond to wavelengths shorter than those they emit. Hence the blue sense LED is a slightly longer wavelength than the blue LED output. The green sense LED is more yellow, so it will respond to green light (and blue light, but not red). The red sense LED responds to all of the colors, unfortunately. Still there is some separation, and if you line up a series of Progrominos, you'll find that the directionality as well as this separation by wavelength is pretty effective.

Here's the latest source code and programming file for the basic operation. This new version uses an averaging algorithm to determine when the light level on each LED has increased, rather than using the input voltage level directly. It also implements a way to flush the sample and hold cap internal to the processor, so that the input from one LED does not bleed over to the next sample for the next LED. This is accomplished by setting the inputs to outputs and setting them to low. This discharges the S&H capacitance. Then the pins are set back to inputs and the input buffers are disconnected, allowing the S&H to charge before the ADC takes the next sample. Timer 1 is used to set the charge time.

File:ProgrominoDelta.asm

File:ProgrominoDelta.hex

Why all this gyration? As it turns out, although LEDs output a voltage that's related to the input light level, they don't generate much current. The S&H for the ADC on the microcontroller is designed for an input impedance of about 10K. This provides enough current to charge the internal capacitor quickly (the S&H has a capacitor that holds the voltage level while the conversion takes place). LEDs look like a much higher impedance and thus require a longer time to charge the S&H. So instead of micro seconds to sample the LED light level, it takes milliseconds. Experiments with an Arduino indicate that something along the lines of 250 ms is good, but shorter times can be adequate if you're just looking for some amount of change and not an accurate measurement of light level.

What to do With Them

The bill of material ended up being fairly expensive to have a whole bunch of these lined up, though it would look very cool. To reduce the cost of having a large light show, the Progrominoes can be combined with a bunch of cheaper Le Dominoux in an arrangement like a model railroad track, where the Progrominoes act as switches between tracks of Le Dominoux.