Go Down

Topic: Total noob to Multiplexing (and Aduino in general) (Read 2764 times) previous topic - next topic

BlackFang

I bought my first Arduino at a Radio Shack Saturday, and it is very intuitive. I want to control more things than I have pins, so I need to multiplex.
So I understand If Blue 1 is written high, and Black 1 low, then A turns on. What I don't understand is what the others are supposed to be set to. Can somebody explain it to me?

fungus


So I understand If Blue 1 is written high, and Black 1 low, then A turns on.


Correct.


What I don't understand is what the others are supposed to be set to. Can somebody explain it to me?


If you only want A, not BCD then Black 234 should be high (current doesn't flow from +5V to +5V).


No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

BlackFang

Ok, that makes since. Blue 1 high, Black 1 low, and Black 2,3,4 high. But what do Blue 2, 3, 4 do then? If low, B, C, and D will activate, but if high, E, I, and M will.

fungus

#3
Apr 17, 2013, 09:10 pm Last Edit: Apr 17, 2013, 09:12 pm by fungus Reason: 1

But what do Blue 2, 3, 4 do then?


They can be low. LEDs are diodes so no current should flow back to them from the black pins.

Even better: Disconnect them completely by setting them as INPUTs with LOW state.

(For the pedants: Yes I know they're not completely disconnected, but it's close enough...)
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

BlackFang

Ok, so LEDs have built in diodes to prevent back flow. Now I get Multiplexing, thank you.
So if I wanted to switch on some transistors instead of LEDs, things get a bit more complicated...

fungus


Ok, so LEDs have built in diodes to prevent back flow. Now I get Multiplexing, thank you.


No, LEDs are diodes - that's the 'D' in their name.


So if I wanted to switch on some transistors instead of LEDs, things get a bit more complicated...


Yes. Arduino pins can only supply about 40mA so driving a row of LEDs from a pin doesn't work very well. You'll need PNP transistors on the blue and NPN transistors on the black, each one with it's own resistors, etc.

Most people use chips to drive matrices because it's much easier than wiring up rows of transistors. You also have a much better chance of all the LEDs having the same brightness when you use a chip.

eg. A MAX7219 will drive a matrix directly.



No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

BlackFang

Well, I actually need to drive about 20ish vibration motors, not LEDs. But I think most of the concept is the same. I would use a 5 by 5 array to get 25 outputs for the cost of 10 pins. I would need 5 NPNs and 5 PNPs to control the flow of my non-Arduino power through the matrix. I would also need 5 diodes to prevent reverse flow on the positive lines. Is this correct?

fungus


Well, I actually need to drive about 20ish vibration motors, not LEDs. But I think most of the concept is the same.


Yes.


I would use a 5 by 5 array to get 25 outputs for the cost of 10 pins. I would need 5 NPNs and 5 PNPs to control the flow of my non-Arduino power through the matrix. I would also need 5 diodes to prevent reverse flow on the positive lines. Is this correct?


Transistors are diodes, too...  :)

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

CrossRoads

Or, you could use shift registers capable of supporting higher current/perhaps higher voltage to support your motors.
Such as 3 or 4 TCIP6B595 shift registers (or other model such as TCIP6D595, check their specs, avnet.com carries many of them) to sink current thru the motors to turn them on. Just 3 IO pins needed; clock, datapin latch pin (or SCK, MOSI, SS, if using SPI for faster control).

That will also give better motor performance if you want more than 1 on at a time and need them on at full power.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

BlackFang

So no extra diodes, cool. You have been a very big help. Would something like this be the way to wire it if I went with transistors?

I will look into shift registers some more...

fungus

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

CrossRoads

Now connect 2 shift registers to the Red & Black base resistors.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up