Hi,
first of all I have to say that I am a newbie so apologies in advance if my question is silly. However, I read the forum discussions on RGBLED matrix and I was not able to find an answer to my problem ( probably due to my limits).
I have a WS2812 RGBLED 32x8 matrix connected to an ESP32 and I succeed in displaying static text (dtemp and hum from a BME280 sensor and time from a DS3231). The data are displayed in three successive moments (one after the other, because of display constraints) and after having displayed this info, the ESP32 goes to deepsleep and the cycle goes on.
On the other side I was able to display scrolling text with more than 40 characters by using commands contained in the loop.
Since the default font used for scrolling text is quite large( FreeMono18pt7b) and this limits severely the number of characters displayed when a static text is used, I tried to use smaller fonts, such as FreeMono9pt7b but it was a complete failure, because just a couple of characters were displayed partially on the matrix. I'm afraid that this is due to my inexperience.
For displaying both static and scrollin text I'm using the AdafruitNeoPixel, NeoMatrix and GFX libraries and I'd like to know
whether there are smaller/narrower fonts compatible with WS2812 RGBLED 32x8 matrix in order to increase the number of characters that can be displayed as static text and
whether it is possible to get a scrolling text with all the instructions contained in the setup since when using ESP32 deepsleep, the loop must be empty.
I know that a simple solution would be to concatenate two or more matrices so that to increase the display area available for static text but I'd like to know if there is any workaround to overcome this obstacle just using one 32x8 matrix.
Thanks for your help
I admit thatI know nothing about deepsleep on the ESP32, but that sounds very unlikely. Can you please post a link to where this is explained as I am intrigued
since the last code lines of void(setup) send the ESP32 to deepsleep
//Go to sleep now
Serial.println("Going to sleep now");
esp_deep_sleep_start();
Serial.println("This will never be printed");
For this reason I was just asking if it was possible to write a code in the setup that can make the text scrolling but as I understand from your posts it seems impossible.
So now I have three choices
to concatenate two or three matrices in order to increase the display area ( not so nice solution, because the display will become very cumbersome)
to use a smaller/narrower font that is compatible with my matrix but I do not know if there is one availabe and I'vv appreciate if you can help me to find one
to buy a 64x64 2.5 mm pitch matrix so that it will be possible to display a greater number of characters
Hi, thanks
The code example of the link is the same I'm using to scroll the text and I understand that it uses the loop.
So If I wish to turn off the leds for a fixed time interval I'm going to use delay() or millis ().
Am I right ?
on a 32x8 matrix, smaller font simply will not be readable
Be warned that such matrices can't be run in deep sleep mode even for fixed text.
In general, I think that working with matrices and using a deep slip are poorly compatible. You need to reconsider the concept of the project and, for example, abandon the slip mode altogether.
Ok really thanks for the precious info that saves me a lot of time in useless attempts.
But why a smaller pitch matrix shouldn't work displaying static text at fixed intervals between depp sleep periods ?
Such a matrices uses a dynamic indication, it means that it must be updated a hundreds times in a second even if the text on the screen is not changed.
Hi, sorry for the misunderstanding; it was my fault but I just meant that the code you posted has code lines written in the loop
void loop() {}
int scroll = display.width();
char sometext[] = "Never gonna give you up.";
int scrollwidth = sizeof(sometext) * 6; // each character is 5 pixels plus one kern pixel
and this command - I think - won't be executed if i send the ESP32 to deepsleep in the setup.
Furthermore I acknowledge that I have "this code" because I downloaded it from the link you posted ( i thought that this was implicit): my very modest programming level due to my old age(74) and to the fact that it's few months that I entered this world coming from a different one (ear surgery) wouldn't have allowed me to write "this code". Being conscious of my limits is the main reason why I'm asking help from you forumers ( and learning a lot).
I'm already using a RTC DS3231 to display time on the matrix
I've understood that the "default" font displayed on the matrix is the only one compatible with it.
My fault again because i didn't read with the proper attention the code.
Your code has no code lines in the loop because the loop {} is empty and it is the notloop that contains a part of the instructions.
Since it's the first time that I encounter this, I hadn't understood the fineness of the programming and I am not able to understand why to use this even if I admit that "changing criteria" is a very nice demonstration of programming abiilty
Now I'm asking you if it's possible in your code to send the ESP32 to deepsleep (still in the setup, I think ) without disrupting the code in order to display the scrolling text only when the ESP32 wakes up. Thanks again and sincere apologies for my superficiality
The code stays in-tact even during extended power-down.
At power-up, the microcontroller executes the stored code.
You would need to "port" (translate) the code to ESP32-friendly code. I wrote this for the Uno/Nano, which has different DIO pins and pin-naming than the ESP32. With some pinouts from the internet, and some "ESP32 WS2812 matrix" examples, you will see the changes you will need. If you get stuck, ask more questions.
Hi, you're really great!
Following your suggestions I was able to "port" your code form Nano to ESP32 and use deepsleep while scrolling the text.
So you are the living proof that "changing criteria" even a tenet like " void loop() must be empty when using the deepsleep" (as it is repeated constantly in several, if not all tutorials) is not true.
Here is your code working with deepsleep on an ESP32
Besides the hardware adaptations I had only to modify the while(1) preceeding notloop() because in my hands the ESP32 simply didn't enter the deepsleep. I decided to use a for loop in order to have the time needed for text scrolling through the display; after some trials I've found the number of iterations needed for the length of your text that obviously has to be adapted to the text that one has to scroll. Thanks again for your patience with an old newbie.
#include <Adafruit_NeoMatrix.h>
#define LED_PIN 25// Data pin
#define DISPLAY_WIDTH 32
#define DISPLAY_HEIGHT 8
#define BRIGHTNESS 30
byte delayMS = 20;
Adafruit_NeoMatrix display = Adafruit_NeoMatrix(
DISPLAY_WIDTH, DISPLAY_HEIGHT, LED_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
int scroll = display.width();
char sometext[] = "Never gonna give you up.";
int scrollwidth = sizeof(sometext) * 6; // each character is 5 pixels plus one kern pixel
int i = 0;
void setup() {
display.begin(); // Initialize the display object
display.setTextWrap(false);
display.setBrightness(30);
display.setTextColor(display.Color(0, 255, 0)); // Set text color (white)
for (i=0;i<=180;i++) { // this is the time needed for scrolling the text through the ddisplay
notloop();
}
// ESP32 going to sleep for the specified time
uint64_t uS_TO_S_FACTOR = 1000000;
uint64_t TIME_TO_SLEEP = 180; // Sleep for minutes
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
Serial.println("Going to sleep...");
delay(100); // Allow time for serial output
esp_deep_sleep_start();
}
void loop() {}
void notloop() {
display.fillScreen(0); //Turn off all the LEDs
display.setCursor(scroll, 0); // start displaying Neopixels at the right edge
display.print(sometext); // store the Neopixel buffer
if ( --scroll < -scrollwidth ) { // width of sizeof(text)
scroll = display.width(); // re-start at the right
}
display.show(); // display the Neopixel buffer
delay(delayMS);
}
Hi,
You're perfectly right. I was again inaccurate
What I meant to say is that I was surprised that it was possible to use a function as a loop just naming it in a different way while keeping the loop empty.
Never found this workaround in the tutorials on deepsleep and if you ask Perplexity or Copilot for an answer you won't get it.
But I have to add it that this surprise derives from my very limited knowledge. One more reason to study...