Main Content

A 16x16 Red/Green/Blue matrix display driven by shift registers, MOSFETs and a Arduino Pro Micro (old school electronics).

This is an extension to my previous Red/Green Disco Tile. By using Red/Green/Blue 8x8 matrixes, more colors can be displayed. The only change to the circuit of the Red/Green variant was to add another DM13A shift register to handle the cathodes of the blue LEDs in the Red/Green/Blue Matrix. The anodes of the blue LEDs connect to those of the red and green LEDs.

Rather than repeat the description of how a shift register works (see the description of the Red/Green Disco Tile), I would try an explain a technique called Bit Angle Modulation or BAM for short. Before I do that, let’s look at Pulse Width Modulation (PWM) first.

Pulse Width Modulation (PWM)
To light an LED, you can apply a steady current to the LED usually via a resistor to limit the current so the LED doesn’t burn out. You can vary the brightness by varying the current or in this case by varying the resistance. Note that the current following in the LED is continuous.

In Pulse Width Modulation, the current is switched on and off at a speed that our eyes/brain see as a continuous light. This is called Persistence Of Vision (POV). By switching on and off the LED very quickly, the brightness of that LED will depend on the length of the ON state compared to the OFF state. For example and LED that is only on for 50% of the time period will be half as bright as one that is on for 100% of the time period.

Note that in PWM the full cycle time is constant. If one full cycle is broken down into 256 points, then a setting of 128 means a 50% duty cycle. This is what the function AnalogWrite is doing when you control a servo using a PWM enabled pin on an Arduino.

By controlling the brightness of each red, green and blue LEDs inside the RGB LED, you can fool the eye in seeing a wider range of colors than just the 3 primary colors.

Bit Angle Modulation (BAM)
BAM differs in that the ON time isn’t always done as a single duty cycle. BAM follows a binary pattern.

Because the matrix has only three 16-bit Shift Registers, it can only have 48 columns (16 red, 16 green and 16 blue). This means it also must have 16 rows that are need to be multiplexed. That is each row must be displayed in turn at a speed fast enough to maintain persistence of vision.

Using PWM, all 768 LEDs (256 Red, 256 Green and 256 Blue) would need their associated PWM brightness value tested against the duty cycle counter. Because there are 16 rows to refresh, the loop in the code that refreshes the shift registers must run 16 times faster than the minimum period of the duty cycle timer. Also on each iteration of the loop, it needs to push 48 bits through the shift registers.

However by using BAM, the timing isn’t so critical because it doesn’t need a duty cycle timer. The final code uses 4 bit BAM allowing each LED to have up to 16 brightness levels (16 bit duty cycle). The main loop cycles through the 16 rows. Before each column value is shifted out, it is compared to the current BAM bits to see it should be switched off.”

Link to article