Go Down

### Topic: first time multiplexing/charlieplexing for a complete beginner (Read 2247 times)previous topic - next topic

#### ninelives1

##### Dec 04, 2012, 04:44 pm
Hi, I'm new to arduino and have only done some
basic projects with LEDs. I'd like to make a small
heart for Valentines day but I want to understand
The concept of multiplexing fully. I learn by doing
it myself and I'd like to do many trials on breadboard
Before i try anytihing serious. How should i go about
Learning this? Sorry for the formatting. This is from my phone.

#### Hippynerd

#1
##### Dec 04, 2012, 05:46 pm
There are lots of instructables, blogs, and forum threads about multiplexing and charlieplexing. why not try any of them?

If you have 4 RGB LEDs, you can make a charliplexed spire (leaving 4 leads to control via the arduino) You get to control a total of 12 LEDs (4 red, 4green, 4 blue).

Or if make a small matrix or cube. Whatever you do, start small, once you understand the concept, go bigger (then you will have new problems to solve as you make larger circuits.)

#### ninelives1

#2
##### Dec 04, 2012, 08:02 pm
Do you know any good resources?

#### Hippynerd

#3
##### Dec 04, 2012, 08:48 pm
http://arduino.cc/en/Tutorial/HomePage

http://www.instructables.com/tag/type-id/?q=arduino%2C+led&sort=none

#### MontySylver

#4
##### Dec 05, 2012, 04:34 pm
I am looking for a tutorial too. I already found a lot of them, my problem is that they all seem to explain what is happening but I can't figure out how and why it works. Also everytime I tried to fit one of them for my needs (driving a 2x3 matrix with an ATTINY85) the LEDs either stay lit or they are flickering randomly. Any advice?
Witty text goes here, I guess.

#### Hippynerd

#5
##### Dec 05, 2012, 06:03 pm
Controlling the LEDs is as simple as bringing on pin high, and another pin low, sometimes in software this is represented in 1 (high), and 0(low).  When you multiplex you have rows and columns. Lets say you have a grid of 8 by 8 (64 LEDs). All your cathodes connect in row are connected, and all the anodes in a column are connected, this leaves you with 8 anodes, and 8 cathodes to deal with (instead of 64 anodes and cathodes to deal with).

When multiplexing you only light 1 led at a time, but you can turn many leds on and off very quickly, so that it appears that they are all lit at the same time, this is called persistence of vision.

So, to light a single LED, you turn one anode pin high, and one cathode pin low, this lights one LED, then you pause for a few milliseconds, then turn those pins off,
You repeat this process until you light up whatever pattern you need.

This is how every cube or matrix works.

A 2x3 matrix would require 5 pins from your controller, multiplexing is only saving you 1 pin over controlling the anodes or cathodes independently, so its realistically only practical as an learning example.

#### MontySylver

#6
##### Dec 05, 2012, 06:52 pm
Lighting single LEDs works flawless. Now I just need to find out how to put some more "action" into the whole thing.

Quote
A 2x3 matrix would require 5 pins from your controller, multiplexing is only saving you 1 pin over controlling the anodes or cathodes independently, so its realistically only practical as an learning example.

That's true, i've done it that way because an ATTINY85 has only 5 I/O pins. And yes, it is also for learning .
Witty text goes here, I guess.

#### Hippynerd

#7
##### Dec 05, 2012, 06:56 pm
If you want more action, then you need to start writing code. start with making one LED light, and all others off, then turn it off, and light the next LED. Do this one by one to each LED until it sequences each LED 1 time.

There is a limit to what you can do with 6 LEDs, but you should be able to learn the basics.