Mr. Alex Wiebe conceived the
application of the LEDs and modified the Parkzone Citabria in the
photograph above. An article detailing modification of the craft and
the assembly and installation of the circuit, including the clever use
of fine enameled copper wire to save weight, and videos of the lights
in action can be found at http://www.flyinglow.ca/flyinglow/2008/12/adding-lights-to-the-citabria.html
Download the AVRStudio assembly source for the program: T12astrobe081028A
Download the AVRStudio assembly source for the include file: T12astrobe081028A.hex
Find updates at www.projects.cappels.org
This was designed to flash a pair of LEDs to be mounted on the wing
of a Parkzone Citabria R/C (remote control) airplane. The unmodified
Parkzone Citabria only weights 20 grams (about 0.7 oz), so
weight, and therefore the number and size of the electrical components
for the flasher are critical.
Another major constraint was the range of power supply voltage and
current draw. The battery in the Parkzone
varies from 3.7 to 4.2 volts. which rules out
circuits such as the Simplest
LED Flasher Circuit
, which requires a higher voltage. Current draw
also needs to be kept low because the battery is tiny. The CMOS AVR
controller handles both of these requirements beautifully.
I used the AVR ATTINY12 controller from
Atmel because I have plenty left over from other projects. With some
modification to the code, you can use the ATTINY13, which is also
available in both 8 pin DIP and surface
packages, or nearly any AVR or other small CMOS controller. See firmware
Here is the pin assignment for the ATTINY12 and ATTINY13.
Pin 1 Battery +
Pin 2 PORTB3
4 Hz, 50
ms positive pulse
Pin 3 PORTB4
10 Hz 50 ms positive pulse (square wave)
Pin 4 Battery -
PORTB0 4 Hz 100
ms positive pulse
PORTB1 2 Hz 50
ms positive pulse
PORTB2 4 Hz 100 ms positive pulse
Pin 8 Battery +
The circuit is simply the micro controller connected to a battery and
appropriate bypass capacitor, and one or more LEDs with series current
Schematic 1. This flashes two
LEDs at the same
time. The capacitor
can be a small 1206 or 0805 size
surface mount part.
I used a .01 uf 1206 capacitor.
(This project should only be posted on www.cappels.org.) If you
see this elsewhere, please email me at the address below.)
You can also invert the pulse. For example, you can invert the 2 Hz 100
ms wide pulse to light the LED for 400 ms by connecting the LED from
the positive power supply to the output pin. The circuit below
takes advantage of this phenomenon.
Schematic 2. This version of the
alternately flashes two LEDs.
In the circuit above, the red and yellow LEDs alternate. I think this
will probably pretty good with the 10
Hz 50% duty cycle. The nice thing about wiring this way it is that one
LED or the other is
on at any given time so the disturbance to the power supply, which
might affect the R/C receiver, is minimal.
Since there are several outputs, it is possible wire many LEDs that
blink at different rates and durations by connecting the LEDs in
different arrangements between outputs and the battery positive
terminal, outputs and the battery negative terminal, and between output
The value of the current limiting resistor, RLED
, can be
found with the formula below.
In the formula above, it is assumed that the resistance of the output
pin is zero ohms, which is, if you don't have special equipment to
measure fast current pulses, a reasonable though not completely
is the voltage across the LED when it is driven at the
operating current. This is easy enough to measure, or you can probably
find this voltage in the LED's data sheet.
is the desired current through the LED.
Take a look at the data sheet for the micro controller you are going to
use, and find the maximum permissible current for the power supply pins
and the output pins. The total of all of the currents through all of
the LEDs connected to a given output pin must be less than that
specified as the maximum output current for an output pin. For the
ATTINY12, the maximum current through an output pin is 40 milliamps.
The total of all of the currents into or out of all of the output pins
must be less than the current specified as the maximum current through
a ground or power supply pin. For the ATTINY12, the maximum current
through a power or ground pin is 100 milliamps. For our purposes, we
can ignore current used by the controller itself since it is so low.
When considering the current through an output pin that drives LEDs
alternatively, such as that shown in schematic 2
, it is only
necessary to use the highest of the two currents since both LEDs are
not on a the same time.
This is just about the simplest program that uses interrupts that one
The "heartbeat" of the firmware is a subroutine routine named wait_50ms
sets up the 8 bit
timer to interrupt the processor, and then puts the processor to sleep.
After 50 milliseconds, the processor is awakened by the timer
interrupt, the interrupt is cleared, and subroutine returns to the
instruction in the main routine after the instruction that called wait_50ms
The main routine merely sets or clears bits on the output pins and then
waits for 50 milliseconds, and sets and clears pins as appropriate to
reproduce the intended wave forms on the output pins. Since there is
only one timing routine, all changes on the output pins take place
according to the 50 millisecond granularity of this timing method. It
should be noted that because there are varying numbers of instructions
between calls to wait_50ms
, the timing between
changes in the output pins varies throughout the entire 1 second cycle
by a few microseconds. This tiny variation in timing is not visible.
Using this method to control the timing of the drive pulses brings a
new meaning to the term "flash memory".
You may notice that pin 5 has the same pattern as pin 7. Each pin
drives a 50 millisecond pulse at 4 Hz. The pulses from the two pins are
synchronized and in phase. On an ATTINY12, each pin can supply up to 40
milliamps, for a total of 80 milliamps to drive the LEDs.
The internal clock for the ATTINY12 is 1.2 MHz while the internal clock
for the ATINY13 can be either 4.8 MHz or 9.6 MHz. If you use the
ATTINY13, you will have to either accept that that the flashes will be
at a higher frequency and a shorter duration, or modify the code to
take into account that higher clock speed into account. It may also be
necessary to modify the setup of the timer in the ATTINY13.
When programming the chip, make sure the fuses are not set so that pin
1 is an output -this could damage your chip and potentially ruin your
day. Also be sure that the watchdog is disabled and that you have
selected the correct clock.
Many thanks Mr. Alex Wiebe conceived of the marker lights and installed
and tested them in his Parkzone
Citabria R/C airplane.
Damage From Visible Light Emitting Diodes
Contents ©2009 Richard Cappels All Rights Reserved. Photograph
copyright 2008 by Alex Wiebe. Find updates