P10 display brightness control using DMD library

Using a P10 single color display, currently with UNO, eventually nano.
Is it possible to change / control the brightness of the display using the DMD library or do I need to use the DMD2 library?

All the code works fine for a sign for the Food Pantry I volunteer at, but they now tell me they want to be able to dim the display.

From DMD.h...

#define PIN_DMD_nOE 9 // D9 active low Output Enable, setting this low lights all the LEDs in the selected rows. Can pwm it at very high frequency for brightness control.

1 Like

Why just not to read the library manual before asking in the forum?

I tried reading it before posting. I did not understand it. I guess I’m not advanced enough.

I tried a sketch to dim the display but no results. The text scrolls fine, but no dimming.


```cpp
#include <SPI.h>
#include <DMD.h>
#include <TimerOne.h>
#include "SystemFont5x7.h"
#include "Arial_black_16.h"

#define DISPLAYS_ACROSS 2
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

const int MY_DMD_nOE_PIN = 9;  // Define name for the PWM pin

void ScanDMD() {
  dmd.scanDisplayBySPI();
}

void setBrightness(int level) {
  // Use PWM on MY_DMD_nOE_PIN for brightness control
  analogWrite(MY_DMD_nOE_PIN, level);
}

void setup(void) {
  Serial.begin(9600);
  Timer1.initialize(5000);
  Timer1.attachInterrupt(ScanDMD);

  pinMode(MY_DMD_nOE_PIN, OUTPUT);
  dmd.clearScreen(true);
}

void loop(void) {

  // Set the brightness to a specific level (adjust as needed)
  int level = 150;
  setBrightness(level);

  Serial.print("Setting brightness to: ");
  Serial.println(level);

  byte b;

  dmd.selectFont(Arial_Black_16);
  dmd.drawMarquee("Scrolling Text", 14, (32 * DISPLAYS_ACROSS) - 1, 0);
  long start = millis();
  long timer = start;
  boolean ret = false;
  while (!ret) {
    if ((timer + 30) < millis()) {
      ret = dmd.stepMarquee(-1, 0);
      timer = millis();
    }
  }
  dmd.clearScreen(true);

  delay(2000);
}

Is your PWM routine adjustable? Can you make it turn off and on at 1Hz (blink), then increase the duty cycle?

The DMD library uses pin 9 as nOE. But in your code you dimmed by pin 6

Sorry, you are correct. I was messing with the sketch and didn’t change it back. There is no effect when defining as pin 9.

Please show all your connections.

My photos aren’t the best, but:

Image of sign

Image of UNO connections 6,7,8,9,11,13 & grd

Image of P10 connections - 1,2,4,5 & 6 on right, 1 & 2 on left (from top)

Image of 5V connections

Image of connection diagram I used

I am able to dim the display by adding a 15 ohm resistor to the 5V line but I would like to do it via program. I want to use DMD vs. DMD2 although DMD2 dims it successfully.

I'm sorry, but judging by the code, the DMD library does not support brightness control. Working with OE pin inside the library only includes turning on and off and does not support PWM.
Adding a setBrightness() method to your sketch is not enough. To add brightness control, you need to change the library code. It might be easier to switch to DMD2.
There are also other libraries for working with monochrome DMD.

Thanks for answering.
I am not advanced enough to understand much about the code, but I noticed in the DMD code there is a line that says:
#define PIN_DMD_nOE 9 // D9 active low Output Enable, setting this low lights all the LEDs in the selected rows. Can pwm it at very high frequency for brightness control.”
I though perhaps experts who understand such things could help me out.

This is only a possibility; there is no support for this in the library code.
To do that, you need to add a PWM control yourself. The next issue that the Arduino has default PWM frequency about 500-1000 hz, but the DMD brightness control needs 10-20 KHz or above.

All these fixes are not too complicated, but why do this if there is already a DMD2 library if you want to run it on Arduino.
But in principle, I advise you to consider more powerful controllers, such as esp32, stm32 and rp2040. These controllers can control hundreds of panels.

Looking for guidance on how resistors work for controlling brightness on 16 X 32 red P10 led displays. I am using a nano for running my program based on DMD library and it works fine, I would just like to make a day / night display sign and hopefully prolong the sign lifespan.

I am running two P10 panels from a 5V, 4.8A (24 watt) power supply. When I measure the volts / amps with all led’s on across both panels I get:
4.1V / 3.46A (14.2W).
When I add resistors I get:
0.5 ohm resistor 4.9V / 2.02A (9.9W),
1 ohm resistor 4.9V / 1.59A (7.8W),
2 ohm resistor 5.0V / 0.86A (4.3W).
The brightness of the display decreases with each increase in ohms.

Can someone explain in simple terms why the large drop in wattage with very little resistance added is happening here?

Am I harming the P10 panels by adding a resistor / using a resistor to control brightness?

Does adding resistors and reducing the measured wattage mean less stress on the power supply?

Thanks for any knowledge sharing.

LEDs are current devices, adding the resistor decreases the current hence it gets dimmer. Did you read the data sheet. I found this as the first line in pin description; Enable: This pin is used to control the brightness of the LED panel, by giving a PWM pulse to it. You already have an Arduino that will give you a PWM output. As you dim it the less current you will use.

The panels are 20 Watts or 4A each.

Thanks. I am using the DMD library which doesn’t provide dimming through the code so no PWM. I explored that topic and came up empty, thus trying the resistors.

Simply connect one of the PWM pins to the display(s). You do not need a library to control a PWM pin and the library will have no idea if the PWM is there or not. PWM is simply an analogWrite(value) to a pin.

Threads merged.

OE should be controlled by the library and switched on and off in certain moments, otherwise you will see glitches on the panel.

@jbrown658 Why not to use DMD2 library, that supports brightness control?