|Graustufen / Farben||8 grayscales|
|Leuchtmittel||5 mm LEDs|
The Duck was inspired by the "Duck" presented by the French Embassy on the Camp Observe. Hack. Make. 2013. They installed a big button labelled "Do not press here", which played a loud duck quack when pressed.
This version consists of 34 LEDs on a circuit board which are arranged in the shape of a duck and play varying animations. The button is located in one corner, the quacking sound is played back through a mini speaker on the PCB.
The circuit is controlled by an ATmega8 which multiplexes the LEDs and plays the quack sound when the button is pushed. The speaker is driven with PWM so no digital to analog converter is necessary. The data for the quack sound occupy approx. three quarters of the program memory, the rest is available for the program code and the animations.
The LEDs are connected in a traditional 6x6 matrix with the last two LEDs missing. The columns are directly connected to the AVR outputs without any current limiting resistors, leaving only the AVR's internal resistance of approx. 25 ohms to limit the current through the LEDs. The row ouptuts are amplified with NPN transistors to avoid fluctuations in brightness.
Two PWM outputs are used for the speaker, with the second output generating the inverse PWM ratio to the first. In this way, the average voltage between the outputs is twice that of a single output to ground, increasing the volume. To get even more volume, two push-pull stages of two transistors each are used to amplify the AVR's PWM output signals because the internal output resistance of the AVR would limit the output resistance severely if the signals were used unamplified.
- Schematic (PNG)
- Schematic (EAGLE 4.x)
- PCB Layout (EAGLE 4.x)
- Construction Kit Instructions Rev. 1.0 for PCB Rev. 1.0
The animations are written in a special pseudo language created from assembly macros. The File "animations/ani_list.asm" specifies the order and number of repeats of the animations, while the comments at the beginning of the file explain the available pseudo commands that can be used to create animations. The other files in the "animations" directory are example animations. To create your own animation program, you can either enter all animation commands directly into the file "ani_list.asm" or create a separate file for each animation and then add them to "ani_list.asm" using the ".include" directive.
The sound to be played when the button is pressed is stored as a list of unsigned 8-bit values, i.e. the value 128 (0x80) is the zero level (silence). The value 0 must not be part of the audio data as it is used to detect the end of the list. The usable range of data values is thus 1 to 255 (128±127). The AVR is clocked at 8 MHz and uses an 8 bit PWM to generate the audio signal, which results in a sample rate of 31.25 kHz.
To replace the quacking of the duck with a different sound, it must be converted into the described format (8 bits, unsigned, 31.25 kHz sample rate) which can be done with the program "Audacity". The same program can also be used to remove silence before and after the desired sound, as the memory for audio data is very limited. The program and the example animations together require a little over 1 KiB of program memory. This leaves just short of 7 KiB for audio data, which corresponds to an audio length of approx. 227 ms. After converting the audio data with Audacity, the perl script in the "audio" directory can be used to convert the raw audio file to an assembly file which must then be included in the main program file "duck.asm" (in the line immediately following the "audio:" label).
More photos at http://arne.blinkenarea.org/Duck/gallery.htm.