loading

It's rainning leds...

Last week I saw in a shop a curious thing: a small microcontroller like Attiny85 (8 pins) controlling 20 leds with a rain effect!!

An impossible thing working with the famous Charlieplexing algorithm.

Step 1: A Bit of Theory

The schematic of the raining leds is based on geometric figures: the polygons. Each vertices are controlled by one digital pin of a microcontroller and the edges are made of LED mounted paralell and inverted. So for 5 pins, you control 5 vertices and 10 edges of 2 leds each: 20 leds. A wiki article deals with the polygons:

http://en.wikipedia.org/wiki/Complete_graph

To control each LED you have to polarize the LED you want to light on (+ on a vertice anode and - on the vertice kathod) and apply high impedance on the other vertices.

I use an attiny 85 programmed with the arduino sketch. So it uses 5 pins for 20 leds. If you want more: 6 pins for 30 leds, 7 pins for 42 leds, 8 for 56 leds...use an atmega328p/644p/1284p.

So each led, one by one (D1 to D20) are switched on and the fade off every four leds to give a rain effect with a random cycle. You can see it in the truth table i tried to make.

Step 2: The Schematic

5 pins are used for the 5 vertices, 2 pins for the power supply and 1 pin for the Charlie plexing algorithm. Respect the number of the led to make the circuit (D1 to D20).

Step 3: Programming the Attiny85 (8MHz Internal Clock): Burn the Bootloader

You need first to upload the sketch arduino in this microcontroller.

1- connect arduino uno to your PC

2- launch arduino UNO

3- select the good com port

4- file/example/arduino as ISP

5- download it to arduino uno

6- Download the “ATtiny” folder from this GitHub repository:
>> https://github.com/damellis/attiny/tree/Arduino1

- In your Arduino sketchbook folder create a new sub-folder called “hardware”

- Put the “ATtiny” folder inside this “hardware” folder

- You should end up with folder structure like this: “Documents > Arduino > hardware > attiny”

- Quit and restart the Arduino software
- Look inside the “Tools > board” menu and you should see the ATtiny entries

7- Wiring your ISP connection
ATtiny —– Arduino

Pin PB2 (SCK) —– Pin 13

Pin PB1 (MISO) —– Pin 12

Pin PB0 (MOSI) —– Pin 11

Pin PB5 (Reset) —– Pin 10

Plus (VCC) —– +5V

Minus (GND) —– GND

10uF Capcitor: not necessary

Arduino pins: RESET —-||—- GND

8- Burn Bootloader:

- Select “ATtiny85 (8 MHz internal clock)” from the “Tools > Board” menu

- Select “Arduino as ISP“ from the “Tools > Programmer” menu

- Select “Burn Bootloader” from the “Tools” menu

9- if this message is displayed your Attiny85 can be programmed now with aduino sketch.

Here, a good website:

http://www.kobakant.at/DIY/?p=3742

Step 4: The Charlieplexing Program

You need to download the library entropy.h supplied here.

The Charlieplexing program is here:

https://github.com/strykeroz/ATTiny85-20-LED-snowf...

You've got all you need to work your 20 leds rain effect!!!

It's rainning leds!!!

In the program:

- HIGH state with: pinMode(pin,INPUT); digitalWrite(pin, HIGH);

- LOW state with: pinMode(pin,INPUT); digitalWrite(pin, LOW);

- high impedance Z state with: pinMode(pin,OUTPUT);

Step 5: Conclusion

Thanx for all interesting and working tutorials on the net.

<p>LOL! I just went through all the theory and built my 9-Charlieplexor and wrote up my Instructable. Then right there on the right side of the page after I posted was this Instructable. You even showed graph theory too. I wish I had found this a month ago! I plan to use the attiny85 or similar myself and will likely use your code. Well done. </p>
<p>I hope it will be usefull for your new project. You do have spent a lot of time to do your 9 charlieplexor. It 's very complicated to link every LED: you need to focus on your schematic all the time to repect the good colors of your wires. May be you can control up to 30 LEDS with an attiny 85, I haven't tested it yet. </p><p>Merry Xmas and happy new year.</p>
It is! And I've 'discovered' ribbon cables. Now it's going pretty fast.
<p>I really like the &quot;star&quot; notation for visualizing the Charlieplexed schematic!</p><p>I have an interrupt-driven version of the firmware at https://github.com/rmd6502/charlie_heart</p>
<p>Hello and happy new year!</p><p>Thanx for your support and I give you the link where I found the animated gif example:</p><p><a href="http://www.postcogito.org/Kiko/BcdClock.html#The_Binary_Coded_Decimal_Binary" rel="nofollow">http://www.postcogito.org/Kiko/BcdClock.html#The_B...</a></p><p>Your version is very interesting and a litle bit more complicated than mine. I think I will test the code to create in the furture a matrix LED display (I use as I can recycled LEDS).</p><p>Best regards. Manu.</p><p>ps: one day I will see NY.</p>

About This Instructable

9,971views

92favorites

License:

More by manu4371:Arduino PLC 32 I/O+State Machine+SCADA or HMI Arduino-tomation part 1 Arduino Mega+Ethernet Shield+Lcd Display+AdvancedHMI 
Add instructable to: