RGBmatrix library and Software Serial

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sjaraisseh
 
Posts: 4
Joined: Fri Nov 04, 2022 12:39 am

RGBmatrix library and Software Serial

Post by sjaraisseh »

Hello,
I'm currently working on a project that includes the 32x32 RGB matrix by adafruit, a Nodemcu esp8266 wifi module, and an Arduino Mega, 2 of each set. This is a gift for my girlfriend and we're in a long-distance relationship. Which involves me sending her cute 32-bit messages through the LED panel. Before I introduced the RGBmatrix library to the code, I got it to work through wifi and MQTT to transmit and receive inputs through serial software.
But when I uncomment out the library and matrix.begin(), the serial monitor starts acting strange, and prints out random characters. I tried with and without the rgbmatrix library and it's for sure the library interfering with the received input. Are there any solutions to this? is there a workaround I can do to get it to work?

English isn't my first language and I used Grammarly to help me write this, so please excuse any mistakes.

Thank you

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: RGBmatrix library and Software Serial

Post by mikeysklar »

This is a sweet project.

Are you able to run a stock example on the RGBMatrix?

Like this colorwheel_32x32.ino?

Can you post a photo of your wiring?

What baudrate is the serial console / software set for?

User avatar
sjaraisseh
 
Posts: 4
Joined: Fri Nov 04, 2022 12:39 am

Re: RGBmatrix library and Software Serial

Post by sjaraisseh »

mikeysklar wrote: Thu Dec 08, 2022 5:24 pm This is a sweet project.

Are you able to run a stock example on the RGBMatrix?

Like this colorwheel_32x32.ino?

Can you post a photo of your wiring?

What baudrate is the serial console / software set for?
Yes, I can upload the stock example and it runs well, I did do that when I first received the panels and tested them.
Here's my wiring(https://gyazo.com/788565cd2165aa39f593456f61dea0d3), it's a bit confusing because I'm using a shield over the Mega board. I have software serial from pin12/pin13(rx/tx) to the esp8266 module, 3 buttons(51,49,47) for inputs, and the rest of the wiring on the shield is for the matrix panel(all soldered). Hardware wise there's not much to it. It all relies on the code.
I'm basically sending the numbers 1/2/3 based on the button pressed, and the other board receives it and displays an image based on the number it receives.
I'm using baudrate of 115200, I believe that was the recommended rate for the esp8266? Not sure where I read it but I remember reading it's a good idea to use that rate.
Maybe interrupts can help in this scenario? I'm not using them because I don't know how to, but do you think they will help?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: RGBmatrix library and Software Serial

Post by mikeysklar »

Thank you for the quality photo. It does not look like your wires on the mega shield are soldered to the PCB. If they are there is not adequate solder for a reliable connection. Please solder the connection on the shield that are not going into female jumper heads and show a photo of the underside soldering.

Your setup is too complex with the additional Wifi hardware and input buttons. In order to make progress we need to strip the problem down the core issue.

If the use of SoftwareSerial is causing matrix.begin() to hang lets focus on that.

When you go back to the stock colorwheel_32x32.ino and add only the softwareserial initializer and pins does it hang the code?

User avatar
sjaraisseh
 
Posts: 4
Joined: Fri Nov 04, 2022 12:39 am

Re: RGBmatrix library and Software Serial

Post by sjaraisseh »

They are actually soldered, the only thing that's not soldered are the blue and red wires on the side, not sure why I didn't solder those, didn't think much about it(https://gyazo.com/d6fe60f39b17116c912e9cf8bf88d313).
This is actually for a school project and is due in a week's time. If you're wondering why did I leave it till the very end, its because I wasn't expecting a problem like this to occur, I didn't know libraries can interfere with others.

No, SoftwareSerial doesn't cause matrix.begin() to hang, it's the opposite. If I add the line matrix.begin anywhere in my code, it causes interferences with the serial monitor when receiving inputs through MQTT. You get this (https://gyazo.com/65bfeda8ad493e93ad7f253954868187)

As for the colorwheel_32x32.ino example, I tried to initialize softwareSerial in it, and it still causes the same issues.
Thank you

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: RGBmatrix library and Software Serial

Post by mikeysklar »

There is a open issue in the RGB-matrix-panel library. Enabling Timer1 interrupt causes an incompatibility with SoftwareSerial.

https://github.com/adafruit/RGB-matrix-Panel/issues/18

You might be able to use a the other hardware uart on the 2560, but I'm not sure that will resolve it based on later comments in the above thread. Have you tried different pins for the SoftwareSerial?

This might just need to be a faster board.

https://www.adafruit.com/product/4064

User avatar
sjaraisseh
 
Posts: 4
Joined: Fri Nov 04, 2022 12:39 am

Re: RGBmatrix library and Software Serial

Post by sjaraisseh »

Yes I tried different pins, same thing. I'll keep looking into this, but thank you for taking the time to try and help me out, I appreciate it.
Because this is a school project, I'm limited to any Arduino board, but once I turn it in, I can switch to something better.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”