0

members

Easy Basics: Project 049a 64 LED RGB Matrix with 5050 leds WS2812

of Acoptex.com in UNO

Basics: Project 049a

Project name:  64 LED RGB Matrix with 5050 leds WS2812

Tags: Arduino Uno, LED 5050,  8x8, 64 LED RGB Matrix, Adafruit NeoPixel, NeoMatrix 8x8, 64 RGB LED Pixel Matrix, Adafruit Neopixel library, WS2812, 5050 leds, Adafruit NeoPixel NeoMatrix 8x8, 64 RGB LED Pixel Matrix, NeoPixel NeoMatrix 8x8, 64 RGB LED

Attachments: library1, library2, library3 and sketch1, sketch2

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. LED RGB Matrix with 5050 leds (WS2812) 2 pcs

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M, F-F

 

6. Resistor 1 pc (470 Ohm)

7. Breadboard half size or small size 1pc

8. Capacitor 1 pc (1000 uF 16V)

9. External power supply 5V DC 2A 1 pc

10. Power jack 1 pc

11. Momentary switch 1 pc (optional)

 

General

We will learn how to connect NeoPixel NeoMatrix to Arduino board and use it.

 

Understanding the NeoPixel

The WS2812 Integrated Light Source - or NeoPixel in Adafruit parlance - is the latest advance in the quest for a simple, scalable and affordable full-color LED. Red, green and blue LEDs are integrated alongside a driver chip into a tiny surface-mount package controlled through a single wire. They can be used individually, chained into longer strings or assembled into still more interesting form-factors.

“NeoPixel” is Adafruit’s brand for individually-addressable RGB color pixels and strips based on the WS2812, WS2811 and SK6812 LED/drivers, using a single-wire control protocol. NeoPixels don’t just light up on their own; they require a microcontroller (such as Arduino) and some programming. We provide some sample code to get you started. To create your own effects and animation, you’ll need some programming practice. If this is a new experience, work through some of the beginning Arduino tutorials to get a feel for the language. The control signal has very strict timing requirements, and some development boards (such as Netduino or Raspberry Pi) can’t reliably achieve this. 

NeoPixels are not recommended for POV (persistence of vision) displays. The refresh rate is relatively low (about 400 Hz), and color displays in fast motion may appear “speckled.” They look fine in stationary displays though (signs, decorations, jewelry, etc.). For POV use, Adafruit DotStar strips will look much better (they have about a 20 KHz refresh rate).

NeoPixels can be used for light painting. The slower movement used for photographic light painting doesn’t call attention to the limited refresh rate; the results look great, especially with a light diffuser.

There’s no inherent limit in the maximum length of a NeoPixel chain, but eventually you’ll encounter any of various practical limits:

  • RAM. NeoPixels require some RAM from the host microcontroller; more pixels = more RAM. It’s only a few bytes each, but as most microcontrollers are pretty resource-constrained, this becomes a very real consideration for large projects.
  • Power. Each NeoPixel draws a little bit of current; more pixels = more power. Power supplies likewise have some upper limit.
  • Time. NeoPixels process data from the host microcontroller at a fixed data rate; more pixels = more time and lower animation frame rates.

Each NeoPixel requires about 3 bytes of RAM. This doesn’t sound like very much, but when you start using dozens or even hundreds of pixels, and consider that the mainstream Arduino Uno only has 2 kilobytes of RAM (often much less after other libraries stake their claim), this can be a real problem!

For using really large numbers of LEDs, you might need to step up to a more potent board like the Arduino Mega or Due. But if you’re close and need just a little extra space, you can sometimes tweak your code to be more RAM-efficient. This tutorial has some pointers on memory usage.

NeoPixel products are available in a zillion form factors…from individual tiny pixels to huge matrices…plus strips, rings and everything in-between.

 

Understanding the NeoPixel NeoMatrix 8x8 module

NeoPixel matrices are two-dimensional grids of NeoPixels, all controlled from a single microcontroller pin.

There are rigid  and flexible 8x8 NeoPixel matrices.

Rigid 8x8 NeoPixel matrices

These 64-pixel matrices are assembled on a rigid printed circuit board and are available in both RGB and RGBW varieties.

RGB NeoPixels are the most affordable and can produce millions of color combinations.

RGBW NeoPixels offer an eye-pleasing “true” white in addition to RGB. These are available in three different color temperatures:

Cool white: approximately 6000 Kelvin (K).

Neutral: approx 4500K.

Warm white: approx. 3000K.

RGBW pixels incorporate a translucent diffuser layer to help mix and soften the light output. This makes them appear less intense than RGB pixels (which are “water clear”), but it’s really the same LEDs inside.

Flexible NeoPixel matrices

Flexible NeoPixel matrices are available in three different sizes:

8x8 RGB pixels

16x16 RGB pixels

8x32 RGB pixels

Flexible matrices are about 2 millimeters (0.08 inches) thick.

Though called “flexible,” these matrices do not tolerate continuous and repeated bending. “Formable” might be a better word — they can be bent around a rigid or semi-rigid shape, like a hat. Repeated flexing (as on costumes) will soon crack the solder connections. (The videos on the product pages are to highlight just how flexible these matrices are, but this really is a “don’t try this at home” thing.)

Flexible matrices are available with RGB pixels only; RGBW is not offered.

Keep power consumption in mind when working with NeoPixel matrices. NeoPixel matrices don’t enforce any particular “topology” - some may have rows of pixels arranged left-to-right, others may alternate left-to-right and right-to-left rows, or they could be installed in vertical columns instead. This will require some planning in your code. It’s very strongly recommended that each NeoPixel have an accompanying 0.1 μF capacitor between +V and ground. This prevents communication problems due to brownout of the on-pixel driver logic. It’s occasionally sufficient to have one capacitor between pairs of pixels; some of our NeoPixel rings work that way.

Surface-mount “5050” (5 millimeter square) NeoPixels are available in many varieties: 5050 RGB LED, RGBW NeoPixel – Cool White, RGBW NeoPixel – Neutral White, RGBW NeoPixel – Warm White, RGBW NeoPixel – Cool White, RGBW NeoPixel – Neutral White, RGBW NeoPixel – Warm White, NeoPixel – Cool White (3X white, no RGB), NeoPixel – Warm White (3X white, no RGB). All measure 5 millimeters square. “Cool white” measures approximately 6000 Kelvin. “Neutral white” is approx. 4500K. “Warm White” is approx. 3000K.

Estimating Power Requirements

Each individual NeoPixel draws up to 60 milliamps at maximum brightness white (red + green + blue). In actual use though, it’s rare for all pixels to be turned on that way. When mixing colors and displaying animations, the current draw will be much less. It’s impossible to estimate a single number for all circumstances, but we’ve been using 1/3 this (20 mA per pixel) as a gross rule of thumb with no ill effects. But if you know for a fact that you need every pixel on at maximum brightness, use the full 60 mA figure.

To estimate power supply needs, multiply the number of pixels by 20, then divide the result by 1,000 for the “rule of thumb” power supply rating in Amps. Or use 60 (instead of 20) if you want to guarantee an absolute margin of safety for all situations. For example:

60 NeoPixels × 20 mA ÷ 1,000 = 1.2 Amps minimum

60 NeoPixels × 60 mA ÷ 1,000 = 3.6 Amps minimum

The choice of “overhead” in your power supply is up to you. Maximum safety and reliability are achieved with a more generously-sized power supply, and this is what we recommend. Most power supplies can briefly push a little extra current for short periods. Many contain a thermal fuse and will simply shut down if overworked. So they may technically work, but this is the electronics equivalent of abusing a rental car.

Can NeoPixels be powered directly from the Arduino’s 5V pin? Sometimes. The Arduino can continuously supply only about 500 milliamps to the 5V pin. Each NeoPixel can draw up to 60 milliamps at full brightness. So yes, you can skip the separate DC supply and power directly off the Arduino as long as just a few pixels are used, more if the colors and overall brightness are low. When in doubt, give the pixels a separate power supply.

For example you have estimated that you need a 3.6 A power supply but you have a 10 A supply on-hand. Your NeoPixels will not explode as long as the output is 5V DC. The LEDs will only draw as much current (A - Amperes) as they need. So extra Amperes are ok - in fact, it can be a good thing. The larger power supply will run cooler because it’s not being pushed to its limit. Excessive voltage, however, will definitely kill your LEDs. So, extra Amperes = good but extra Volts = bad.

Amp-hours are current over time. A 2,600 mAh (milliamp-hour) battery can be thought of as delivering 2.6 A continuously for one hour, or 1.3 A for 2 hours, and so forth. In reality, it’s not quite linear like that; most batteries have disproportionally shorter run times with a heavy load. Also, most batteries won’t take kindly to being discharged in an hour - this can even be dangerous! Select a battery sufficiently large that it will take at least a couple hours to run down. It’s both safer for you and better for the longevity of the battery.

If you need to power LOTS of NeoPixels but don’t have a large Amperes power  supply. You can use several small or one big power supply. There are benefits to using a single supply, and large power supplies are discussed below. “Non-optimal” doesn’t necessarily mean “pessimal” though, and we wouldn’t discourage anyone from using what resources they have. If you go this route, the key is to have all of the ground pins among the strips connected in common, but the +5V from each power supply should be connected only to one length of NeoPixels - those should not all be joined. Every power supply is a little different - not precisely 5V - and this keeps some from back-feeding into others.

There are 5V DC power supplies up to 10 Amps. This is usually sufficient for a couple hundred NeoPixels or more. For really large installations, you’ll need to look elsewhere. One possibility is to repurpose an ATX computer power supply. The nice beefy server types often provide up to 30 Amps. Some minor modifications are needed. Google around for “ATX power supply hack.”  Note that the ATX 5V rail can be very unstable if there's no load on the 12V rail! Even larger (and scarier, and much more expensive) are laboratory power supplies with ratings into the hundreds of Amps. Sometimes this is what’s needed for architectural scale projects and large stage productions. Please note that projects of this scale are potentially very dangerous, and the problems of power distribution are fundamentally different than hobby-scale projects. 

Distributing Power

The longer a wire is, the more resistance it has. The more resistance, the more voltage drops along its length. If voltage drops too far, the color of NeoPixels can be affected. For example, let's look at full 4 meter reel of NeoPixels. With 5V applied at one end of the strip, for those pixels closest to this end, power traverses only a few inches of copper. But at the far end of the strip, power traverses 8 meters of copper - 4 meters out on the +5V line, 4 meters back on the ground line. Those furthest pixels will be tinted brown due to the voltage drop (blue and green LEDs require higher voltage than red). NeoPixels don’t care what end they receive power from. Though data moves in only one direction, electricity can go either way. You can connect power at the head, the tail, in the middle, or ideally distribute it to several points. For best color consistency, aim for 1 meter or less distance from any pixel to a power connection. With larger NeoPixel setups, think of power distribution as branches of a tree rather than one continuous line.

Driving 5V NeoPixels from 3.3V Microcontrollers

Increasingly, microcontrollers are running at 3.3 Volts instead of 5 Volts. That’s great news for efficiency, but can present a communication problem with 5V NeoPixels. The 3.3V signal from the microcontroller may not be “loud” enough to register with the higher-voltage device. The manufacturer recommends a minimum signal voltage of 70% of the NeoPixel voltage.

There are two ways this can be addressed:

  • Lower the voltage to the NeoPixels so it’s closer (or equal) to that of the microcontroller. This is why we recommend LiPo batteries: 3.7V is enough to run a short length of pixels, and the microcontroller is comfortable at that voltage as well.
  • Use a logic level shifter to step up the signal from the microcontroller to the first pixel.

WS2812 or WS2812B - What's the difference?

WS2812B LED modules are new and WS2812 (or WS2812S) are old. Both B and S LEDs can be chained together and are compatible with the NeoPixel Libary. Let's compare both (WS2812B and WS2812 (without "B") or WS2812S:

  • WS2812B have a 4-pin chip LED installed instead previous versions with 6-pin chip LED;
  • The 'B chip type adds additional polarity protection and is the same brightness as the 'S type.
  • if one LED is broken then the other LEDs are still operational (all LEDs off in case of WS2812);
  • less warm.

Specification:

64 eye-blistering RGB LEDs adorn the NeoMatrix for a blast of configurable color. Arranged in an 8x8 matrix, each pixel is individually addressable. Only one microcontroller pin is required to control all the LEDs, and you get 24 bit color for each LED.

Dimensions: 71.17mm / 2.8" x 71.17mm / 2.8" x 3.28mm / 0.12"

Weight: 24.21g

May ship with either WS2812B or SK6812-based LEDs. They are the same brightness, color and protocol

You can find WS2812 datasheet here and here.

You can find SK6812 datasheet here.

Other information about NeoMatrix modules is here.

You can also check them on Youtube: here and here.

 

Signals and connections of the NeoPixel NeoMatrix 8x8 module


IMPORTANT NOTES:

  • Try to minimize the distance between the Arduino and first pixel, so the signal is clear. A meter or two is usually no problem. Much longer and things can become unreliable.
  • Avoid connecting NeoPixels to a live circuit. If you simply must, always connect ground first, then +5V, then data. Disconnect in the reverse order.
  • When using a DC power supply, or an especially large battery, we recommend adding a large capacitor (1000 µF, 6.3V or higher) across the + and – terminals. This prevents the initial onrush of current from damaging the pixels.The capacitor buffers sudden changes in the current
  • With through-hole NeoPixels (5mm or 8mm), add a 0.1 µF capacitor between the + and – pins of EACH PIXEL. Individual pixels may misbehave without this “decoupling cap.”
  • Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel. The resistor should be at the end of the wire closest to the NeoPixel(s), not the microcontroller. Some products already incorporate this resistor…if you’re not sure, add one…there’s no harm in doubling up!
  • If powering the pixels with a separate supply, apply power to the pixels before applying power to the microcontroller.
  • Observe the same precautions as you would for any static-sensitive part; ground yourself before handling, etc.
  • NeoPixels powered by 5v require a 5V data signal. If using a 3.3V microcontroller you must use a logic level shifter such as a 74AHCT125 or 74HCT245. (If you are powering your NeoPixels with 3.7v like from a LiPoly, a 3.3v data signal is OK)
  • Make sure that your connections are secure. Alligator clips do not make reliable connections to the tiny solder pads on NeoPixel rings. Better to solder a small pigtail wire to the ring and attach the alligator clips to that.
  • If your microcontroller and NeoPixels are powered from two different sources (e.g. separate batteries for each), there must be a ground connection between the two.

Some of projects don’t make the above precautions…these are typically small battery-powered devices and power spikes aren’t a big concern. Any project with a lot pixels or a large power source should definitely include the power capacitor and data line resistor.

DIN (or DI or arrow) - data input pin. Some modules have an arrow showing the direction that data moves.

+5V - power supply 5VDC. 

GND - ground. 

DOUT - data output pin.

There are two 3-pin connection ports. Solder wires to the input port and provide 5VDC to the +5V and ground pins, then connect the DIN pin to your microcontroller.

If you're using our NeoPixel Arduino library, use digital pin 8 on your Arduino board (you can change it in sketch). You'll also need to make a common ground from the 5V power supply to the microcontroller/Arduino. Since each LED can draw as much as 60mA (thats up to 3.5 Amps per panel if all LEDs are on bright white!) we suggest 5V 2A power supply. For most uses, you'll see about 1-2A of current per panel.

For the second module, connect the DIN connection to the first panel's DOUT. Also connect a ground pin together and power with 5V.

Large numbers of NeoMatrix can be chained together by tying DOUT to DIN on each board, and leaving the last Dout floating. Power (5V) and ground (GND) can also chain along through the arrays to save on wiring.

You can chain as many as you'd like although after 4 or more panels you may run low on RAM if you're using an UNO. Watch your power usage too, you may need a 5V 10A power supply for so many of these!

CAPACITOR IMPORTANT NOTES: Capacitors may retain a charge long after power is removed from a circuit; this charge can cause dangerous or even potentially fatal shocks or damage connected equipment. Electrolytic capacitors are polarized components due to their asymmetrical construction, and must be operated with a higher voltage (ie, more positive) on the anode than on the cathode at all times. For this reason the anode terminal is marked with a plus sign and the cathode with a minus sign. In addition they can only tolerate low applied voltages. Applying a reverse polarity voltage, or a voltage exceeding the maximum rated working voltage of as little as 1 or 1.5 volts, can destroy the dielectric and thus the capacitor. The failure of electrolytic capacitors can be hazardous, resulting in an explosion or fire. CONNECT NEGATIVE terminal of capacitor to GND and POSITIVE terminal to +5V.

Wiring

1. Single NeoPixel matrix

2. Two NeoPixel Matrixes

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Modify the sketch. 
  5. Verify and upload the sketch to your Adruino Uno.
  6. Enjoy

Code

1. Adafruit_Neomatrix library

You can find more information here.

2. Adafruit_Neopixel library

You can find more information here.

Summary

We have learnt how to connect NeoPixel NeoMatrix to Arduino board and use it.

Libraries:

  • See attachments on the begining of this project description - all libraries included.
  • We have used the Adafruit_NeoPixel, Adafruit_NeoMatrix, Adafruit_GFX libraries. Download, unzip and add to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. 

Sketch:

  • See attachments on the beginning of this project description


Other projects of Acoptex.com

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 11-12-2017
Viewed: 1090 times