Arduino with 30 Digital Outputs

Heyho!

I am currently working on a Project that requires a lot of Digital Output.
What i am trying to achieve:

I want one controller to manage at least (!) 14 addressable LED Strips and every LED Strip will have a Servo in addition. That makes a minimum of 28 Digital Pins that i need.

The only vanilla Arduino with that many Outputs is the Mega.
But i am not sure if the Mega can handle all that data at once.
I need to refresh the data on ALL ports at least 30-40 times a second.

In the beginning i thought about using the Portenta for its power since i wanna fetch all the data over the network but Pin wise, the Portenta sucks a bit.

Any ideas how i can manage that in a smart manner?

Cheers,
Christoph

You can add 32 GPIO pins to any Arduino with 2 each MCP23S17 16 bit SPI GPIO expanders. Other parts in that line are MCP23008.

Adafruit writtes libraries for the MCP parts, whichever you choose.

The are also shift registers to help to do the lob. Some have high current outputa to drive high power LEDs

A typical WS2812 implementation can run at up to 800kbps, or 100kByte/sec. You need 3 bytes/24 bits for each pixel in the strip, so you can address about 33pixels per second. This limit is imposed by the LED strip, not the Arduino. Since the Arduino/controller will be mostly waiting around doing nothing while it's sending out data at the leisurely pace of 800kbps, the bottleneck isn't really on the controller side. You can realistically address 33 strips of 1 pixel each and that'll be it.

EDIT: obviously not....33kpixels, not 33 pixels. Sorry...

Some kind of divide & conquer. This is one of the cases where it may make sense to have auxiliary controllers addressed as e.g. I2C slaves that handle the communication to the LED strips, so that this can happen more or less simultaneously.
How many pixels do you have on each strip?

Thanks for the Insight!

Every Strip will be 1m with 60 Pixels per Meter.
So basically i would be running 60 pixels per Digital Pin.

Does the 800kbps apply to one pin or all the pins at once?
Because in fall 2023 i tested a protype and i easly got the refresh rate that i wanted with one strip

Sorry, I'm a dumba&&. Someone pointed out that my math is way off by a factor 1000. You can address 33000 pixels (theoretically) per second. So you should be fine.
Sorry about throwing you for a loop.

Your controller can do only one thing at a time.

PCA9685 would enable control of up to 16 servos.

The ws2812 strips are more difficult. You can only attach them directly to Arduino pins, not through some I/o expander.

But even attached directly, the Arduino can only update one strip at a time, and as pointed out above, the data speed is limited by the strip and longer strips take longer to update.

There is a library available from PJRC.com which can update 8 strips in parallel, which would effectively increase the speed x8.

Tell the forum more about the project and we can give better advice and suggestions.

33 per second????

Yeah, see above:

Thanks for the Reply!

So to elaborate what my project is:

I will have 14 LED Strips with 60 Pixels each.
Every strip will be in a LED Profile which has a servo attached in the middle to be able to move the indiviudal LED Strips.

The goal for me is to build this moving led art piece that i will control with a web app that send the data to the Arduino. the arduino should only send the data further to the strips and servos.

Power will come from a seperate power supply with sufficient AMP

this was my inspiration:

60 LEDs x 14 strips = 840 LEDs
840 LEDs x 24 bits per led = 20K bits
20K bits @ 800KHz = 0.025 seconds
0.025 seconds = 40 updates per second.

That's the theory. But in practice, there will be many overheads such as calculating what data to send to each strip, calculating and updating the servo positions, receiving any incoming data etc. So 40 updates per second will probably not be possible in practice.

Will all strips need to be updated on every refresh? Can you limit the number of strips to be updated on each refresh in some way?

1 Like

Another aspect to consider is that ws2812 LEDs have a slow PWM frequency of around 600Hz. When moved rapidly, the eye will not see the intended colours, but a series of red, green and blue dashes.

You should experiment with a single strip and servo to see if you will get the effect you were hoping for, before you build 14x as many.

Good Ideas!
I am also considering using a ESP32-ETH per LED Strip. That would also come in handy if i want to use it in a different formation in the future.

Yeah i will build one unit to test the concept.
Thanks a bunch for the help

If all strips have the same pattern, you can connect them all in parallel on one (or a few pins).

You can use a Teensy with PJRC Store and a dedicated library; that can handle 8 strips in parallel using DMA; you must just find the right Teensy (see the link, it needs to support DMA). Two strips in series will give you 16 LED strips.

You might also want to use a PCA9585 to control the servos, the servo library will likely conflict with the LED library.

FastLED library also can handle WS2812b strips in parallel on some controllers.
I used it on Arduino Due that runs a 11 strips in parallel, controls a screen about 8000 leds with approximately 30 FPS.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.