LED effects with ATTYNI2313

8,416

Circuit Image

This project I made for my little daughter. It is 24 channel light illumination. The schematic is very simple 24 LEDs, 1 MCU and some additional components. The main principle is dynamic indication, which is usually implemented for control of 7-segment digital indicators. Here is the same, as for indicators are used traditional 5-mm LEDs. For control unit is implemented not expensive MCU ATtiny2313 (Atmel), which can drive direct LED (up to 20 mA on each pin). As you can see on the schematic, 24 LEDs are grouped in 4 groups, each one consist 6 LEDs. More: LEDs in group 1 indicate the content of register r0 of MCU, LEDs in group 2 – r1, LEDs in group 3 – r2 and LEDs in group 4 indicate the content of register r3. Dynamic indication do this, as in each moment of time indicates content of one register and scans them consecutive. For instance, when the content of r1 is loaded in output port (PORTB), the transistor Q2 is switched "ON", and the LED of group 2 indicate the bits in r1. There are 3 buttons – "F", "+" and "-". The button F is for change of effect, and buttons "+" and "-" are for increasing or decreasing the speed of effect. For example, each time when you press button "-" changing of lights go more slowly. For fast changing of speed you can press and hold the appropriate button.

The speed of effects is independent of speed of dynamic indication, which is constant.

The schematic can be powered by any DC adapter for 8 to 15 V / 100mA. I use 12V adapter and for the stabilizer 7805 there is no need of heat sink for them this is one of advantages of implementation of dynamic indication. Others advantages are simple schematic and PCB, lower pin count of MCU etc. Software is written in assembler of IDE AVRStudio 4. The program code is below. There are a lot of comments for explanation how the program works. With simple changes in code everyone can make different effects and/or add them. Each effect can be up to 24 stages.

If the LED pins are made longer with additional wires, LED effects can be used for Christmas tree or for advertising text on shop window (for instance). If there is need, LED number can be easy increased up to 32 LEDs and stages.

The circuit design comprises a microcontroller (MCU) ATtiny2313 which serves as the control unit for a 24-channel LED illumination system. The ATtiny2313 is capable of sourcing up to 20 mA per pin, allowing it to directly drive the LEDs without the necessity for additional driver circuits. The LEDs are arranged in four groups, with each group containing six LEDs. The dynamic indication system operates by sequentially illuminating each group based on the contents of specific registers (r0, r1, r2, r3) within the MCU.

Transistors are utilized to control the power to each group of LEDs, with Q2 being activated when the output port (PORTB) reflects the contents of register r1. This allows for a visual representation of the data stored in the registers through the LED groups. The circuit is equipped with three control buttons: "F" for changing the lighting effects, and "+" and "-" for adjusting the speed of the effects. The speed of the effects is independent of the dynamic indication speed, which remains constant throughout the operation.

The circuit can be powered by a DC adapter with a voltage range of 8 to 15 V and a current rating of 100 mA. A 12V adapter is recommended, and the use of a 7805 voltage regulator eliminates the need for a heat sink under normal operating conditions, further simplifying the design. The software for this project is developed in assembly language using the AVRStudio 4 IDE, and it is structured to allow easy modification for different lighting effects, accommodating up to 24 stages of effects.

For applications beyond simple illumination, such as decorative lighting for a Christmas tree or dynamic advertising displays, the design allows for easy expansion. The LED count can be increased to 32, providing additional flexibility for more complex visual effects. The straightforward nature of the schematic and the low pin count of the MCU contribute to a compact and efficient design.This project I made for my little daughter. It is 24 channel light illumination. The schematic is very simple ? 24 LED?s, 1 MCU and some additional components. The main principle is dynamic indication, which is usually implemented for control of 7-segment digital indicators. Here is the same, as for indicators are used traditional 5-mm LED?s.For control unit is implemented not expensive MCU ATTYNI2313 (Atmel), which can drive direct LED (up to 20 mA on each pin).

As you can see on the schematic, 24 LED?s are grouped in 4 groups, each one consist 6 LED?s. LED?s in group 1 indicate the content of register r0 of MCU, LED?s in group 2 ? r1, LED?s in group 3 ? r3 and LED?s in group 4 indicate the content of register r3. Dynamic indication do this, as in each moment of time indicates content of one register and scans them consecutive. For instance, when the content of r1 is loaded in output port (PORTB), the transistor Q2 is switched "ON", and the LED of group 2 indicate the bits in r1.

There are 3 buttons ? "F", "+" and "-". The button F is for change of effect, and buttons "+" and "?" are for increasing or decreasing the speed of effect. For example, each time when you press button "-" changing of lights go more slowly. For fast changing of speed you can press and hold the appropriate button. The speed of effects is independent of speed of dynamic indication, which is constant. The schematic can be powered by any DC adapter for 8 to 15 V / 100mA. I use 12V adapter and for the stabilizer 7805 there is no need of heat sink for them ? this is one of advantages of implementation of dynamic indication. Others advantages are simple schematic and PCB, lower pin count of MCU etc. Software is written in assembler of IDE AVRStudio 4. The program code is below. There are a lot of comments for explanation how the program works. With simple changes in code everyone can make different effects and/or add them. Each effect can be up to 24 stages. If the LED pins are made longer with additional wires, LED effects can be used for Christmas tree or for advertising text on shop window (for instance).

If there is need, LED number can be easy increased up to 32 LED?s and stages. 🔗 External reference