Go Down

Topic: I want to blink more LEDs than available pinouts (Read 9453 times) previous topic - next topic

CrossRoads

I'd go with 4 MAX7219s. I have this little breakout board for it, you can wire add LEDs with a pair of wires each and space the LEDs out however you'd like. Designed to be daisy chained together.
Using the MAX7219 is easy, write to a register directly with SPI.transfer, or with the LEDcontrol library.
http://www.crossroadsfencing.com/BobuinoRev17/
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.

louwin

Thanks to everyone for all the informative responses  :)

Have to wait for my cables/wires/ties(?) to arrive from eBay.  First lot are a week overdue so ordered 2 more lots from different sellers (hopefully one lot will arrive soon)  :)

Finding out lots about my Uno, like on-board 3.3V and analog pins can be used as digital  :D

Quick question - can I switch the on-board 3.3V with the pins?  Or will this cause some sort of short circuit?

I played with the Blink example to make it blink four times then wait 2 seconds just to get my hands dirty  :D
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

CrossRoads

The onboard 3.3V is just the output of a regulator. You can use it as a power source to other things, or add p-channel MOSFETs and switch the MOSFET on & off to let 3.3V current flow.
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.

louwin

Sorry, I didn't make my question clear.

Can I use the digital (or analog) pins to switch the 3.3V output?  I am worried that the digital pins go HIGH to 5V and how will that interact with the 3.3V?  And can the pins switch the 3.3V?
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

PaulS

Quote
Can I use the digital (or analog) pins to switch the 3.3V output?

No. The 3.3V pin is hot all the time.

Quote
I am worried that the digital pins go HIGH to 5V

They do. Nothing to worry about.

Quote
and how will that interact with the 3.3V?

Not well. You need level shifters between the 5V output pins on the Arduino and the 3.3V input pins of the other device.

Quote
And can the pins switch the 3.3V?

Which pins? What 3.3V?
The art of getting good answers lies in asking good questions.

louwin

Sorry again....   Absolute newbie here   :)  I suspect the answer is no????

Can I switch the 3.3V output from the Uno board through the digital pins 0 to 13 (and analog pins 14 to 19)?

As I read it the HIGH on these pins (0 to 19) is 5V?

I haven't received the resistors I ordered so I wanted to see if I could avoid the requirement for these resistors by (trying) to connect the 3.3V through pins(?) 0 to 19 to my LEDs?  HIGH in INPUT mode????

Maybe I should just wait for the 220 ohm resistors and use the 0 to 19 pins normally?

Sorry, am I making sense?
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

CrossRoads

Unless you have a 3.3V powered microcontroller, the outputs will switch from 0-5V.
The Uno is 5V powered - it's outputs will go 0 to 5V.
LEDs always need a resistor. Once the forward voltage reaches their turn on level, they become very low resistance devices and will let all the current flow that is available. Then it's just a matter of time as to which fails first - the diode from overheating, or the IO pin from the output transistor overheating, and typically taking out other IO pins at the same time.

Next time order parts from US sources - digikey.com (Minnesota), mouser.com (Texas), dipmicro.com (Niagara Falls).
It's ridiculous to wait weeks & weeks for parts from China to save a few cents.
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.

PaulS

Quote
Can I switch the 3.3V output from the Uno board through the digital pins 0 to 13 (and analog pins 14 to 19)?

No!

Quote
As I read it the HIGH on these pins (0 to 19) is 5V?

You read correctly.

Quote
Maybe I should just wait for the 220 ohm resistors and use the 0 to 19 pins normally?

Yes, you should.
The art of getting good answers lies in asking good questions.

louwin

Sorry, CrossRoads....

On the Uno, under Power pins

IOREF - RESET - 3.3V - 5V - GND - Vin
                             -----
This 3.3V output is the one I mean

See http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front.jpg

BTW I'm in Perth, Western Australia  :D
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

rlogiacco

First of all pins marked as 3.3V and 5V are not digitally controlled: they are always on if the Arduino board is powered up. You have absolutely no control over them, they are not controlled by the MCU (micro controller unit) which is the IC (integrated circuit) you program. There are techniques allowing you to connect or disconnect those pins from other parts of your circuits, but they are clearly out of your reach at this moment.

When you use a 5V board (almost all the Arduino boards are) then by setting a digital pin to HIGH you are putting that pin at 5V (compared to  GND pin as volts are never ABSOLUTE, they are ALWAYS relative).

This applies to analog pins used as digital pins as well.
When you use analogWrite you are NOT sending a part of 5V but 5V pulses (search for PWM on Google).
By using analogWrite(128) you send pulses of 5V followed by 0V each with the exact same duration (it is called 50% duty cycle).

In other words your entire board operates at 5V, but on Uno and some other boards you get a 3.3V pin as well: not because the board operates at 3.3V, but you can drive 3.3V modules throught it. You can use digitalRead and analogRead with modules operating at 3.3V because a 3.3V HIGH value is considered HIGH for a 5V pin as well.

When speaking about LEDs you cannot omit resistors, NEVER. LEDs are current hungry: once they turn on they will try to absorb all the current they can until either they burn out (best case) or the current source burns out (worst case because either you blown a pin on your Arduino board or you blown your board voltage regulator IC).

Whenever you read about people driving LEDs without a series resistor they are putting their LEDs and their boards at risk: I've read some saying you can use analogWrite, turn the LEDs on for very limited time and much more, but they are all wrong in their assumptions. If your board doesn't stop working you are definitely permanently damaging it, even if you do it for a few seconds.

As stated by CrossRoads, LEDs (and any other diode) can be treated as a short circuit once they start to conduct, which happens when the voltage reaches a pre determined level. Different LEDs have different voltage levels and it is called "forward voltage".

I found this web site very instructive when I started http://www.electronics-tutorials.ws/ and I suggest you follow at least the basic tutorials on resistors, capacitors and semi conductors as you are missing very basic information. I was at your exact same level just a few months ago, so don't get discouraged, but start studying some stuff.
Please, do not send me personal messages containing forum related questions: I will not answer.

I share my discoveries and thoughts at http://rlogiacco.wordpress.com

nickgammon


Can I switch the 3.3V output from the Uno board through the digital pins 0 to 13 (and analog pins 14 to 19)?


I suspect this is an X-Y question. Why do you want to?

http://xyproblem.info/
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

louwin

#26
Oct 13, 2014, 03:07 am Last Edit: Oct 13, 2014, 03:11 am by louwin Reason: 1
rlogiacco, thank you for your very informative answer  :D

Are you saying that even on the 3.3V line I MUST have a resistor to an LED? If so what value?

I am under the impression a resistor (220ohm) is only needed when you connect 5V to an LED?

I have a USB power board (for the MB-102 breadboard) with 3.3V output and have driven 4 LEDs (granted only momentarily) on 3.3V without a resistors. And I have plugged in an LED on the 3.3V to GND (on my Uno) for a couple of seconds.

Are you saying this could damage the board and/or the LEDs?  :(

The 3.3V is/was why I was considering getting a Due instead of the Mega2560.  I want to blink 200 LEDs (one or two MAX) so 200 resistors is a lot of wiring so I wanted to avoid them  ;)  Are you saying I shouldn't wire LEDs on a 3.3V line without a resistor?
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

PaulS

Quote
Are you saying I shouldn't wire LEDs on a 3.3V line without a resistor?

Yes. It isn't the voltage that matters. The resistor limits the amount of current that the LED can draw. The LED, when turned on, is basically a short circuit, and can draw a LOT of current - more than the Arduino can supply, unless the current is limited, somehow. That's what the resistor does.
The art of getting good answers lies in asking good questions.

nickgammon

Absolutely you cannot avoid resistors. Unless you have a constant current supply which neither the 3.3V pin (nor the 5V pin) is.

Getting a lower voltage in no way removes the need for resistors so you are barking up the wrong tree here.

Quote
I want to blink 200 LEDs (one or two MAX)


What do you mean? Two at once max?

If you want to only blink one at a time you could connect the "other" end of all the LEDs together, have one resistor in series, and then ground that. That way they all share that resistor. But if you have two on then those two share that resistor which will throw out the current calculations.

Quote
I am under the impression a resistor (220ohm) is only needed when you connect 5V to an LED?


That's just Ohm's Law.

http://led.linear1.org/1led.wiz

That would give you 15 mA with a red LED connected to 5V.

Put in 3.3V in the calculator and you need a 100 ohm resistor. Not no resistor.

Code: [Select]
R = voltage / current
  = (3.3 - 2) / 0.015
  = 1.3 / 0.015
  = 86 ohms (rounded up to 100 ohms as the next standard value if you are using 10% tolerance)

Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

louwin

#29
Oct 13, 2014, 05:28 am Last Edit: Oct 13, 2014, 05:33 am by louwin Reason: 1
WOW! Those replies were a surprise.

Another WOW!  Used an unusual smiley and lost the rest of my message....   :(

The preview showed the whole message but when I posted it, everything from the smiley got lost.  :(

My iPad has a new smiley menu that the forum obviously can't handle.  :(

My grandson (2 year old) is home so will post my revised question later this evening....
Newbie, bought a Uno because I had a $10 Paypal voucher  :)

I live in Perth, Western Australia.

Go Up