“A practical use of the M5Stack Atom RS232 as part of a remote display.
This project came about after pricing commercially available remote displays for our roller mill. We wanted a display at the front of the mill so that the operator could see the weights from the both the tractor seat and be large and easy to read in the dark.
Displays that are available and compatible for our the scales were more expensive than we really wanted to pay. I decided to use my limited programming knowledge and the experiences I have had with microcontrollers in past projects to come up with a solution.
I decided to base the project around the ESP32 module. I specifically chose the M5Stack Atom RS232 because I had used the Atom module before in a different project with good success. I also used 7 of m5Stack’s SK6812 Digital RGB LED Strips. The 20cm version was long enough to represent the number of characters I needed.
The scale on the mill had a serial port which made it an obvious mode of communication. The physical connection was a little tricky because the form factor of the port was not a DB9 or something similar, but was an 8 pin AMP connector. A little digging through the scale’s manufacturing literature did give a pinout for the connector and a little trial and error led to successfully isolating TX/RX pins and ground (yes, a little “magic smoke” was released). For my purposes, I only used the RX and ground pins.
Power was supplied from the 12 volt accessory outlet that is common on most agricultural equipment. I did not directly power the Atom RS232 using the provided pins on that unit, but instead opted to use a separate power converter to go from 12 volt to 5 volt and power the Atom through the USB. The number of LED Strips used was not enough to over tax the Atom’s ability to supply power through the Grove port. I was careful to limit power draw by only turning on the LEDs I needed and lowering the brightness of the strips. Any version of this kind of display that is larger I would recommend using a second power converter to supply the LED strips. Also running the Wifi or the Bluetooth in the Atom will contribute to power draw (for the sake of simplicity I disabled both).
The box is constructed with PVC board, Plexiglass and stainless steel screws. The box is glued together with supper glue and reinforced with screws. The Plexiglass has sealant to on the top and sides, but not the bottom to allow air exchange and unwanted moisture to dissipate. The LED strip are connected in a series that is zigzagged in the display. This is important to note because your sketch setup requires this information to properly display data to the LED strips.
I used the Arduino IDE with ESP32 plugin. Hunting down the correct libraries was mildly difficult and required extensive Google use (mostly ended being adafruit based libraries). But basically the current sketch can be boiled down to doing two things: parsing the serial data and instructing the LED strips in matrix in a loop. Parsing the serial data was simply retrieving any whole integers in the stream. This method may not work depending on how different scales outputs data.
Please forgive the readability of the sketch. I am mostly a novice playing with fire and a keyboard. ALL software is as is and all outcomes are not guaranteed.
The next versions of this display will have dual power supplies so that larger LED strips can be used as well as the Wifi portion of the Atom. Also running a websocket server on the atom to allow customization of display (i.e. color, brightness, special modes and units of measure if applicable) from any web browser.”