Always Know What Your Board Is Doing with This Handheld Serial Monitor
Katie Dumont's Handheld Serial Monitor allows you to more easily view what's going on in your code without the need for a PC or debugger.
The humble serial monitor
For those new to programming or people who simply want to avoid using more advanced tools, printing out statements at various points in the execution of a program can be an invaluable tool when attempting to debug a troublesome bit of code. Because this setup often requires a much bulkier host machine with a screen in order to read the output, Katie Dumont of element14 Presents decided to create a portable DIY serial monitor that can be used nearly everywhere and with minimal setup.
Planning the design
At the very beginning of the project, Dumont chose to replicate the typical serial monitor by using a Raspberry Pi Pico along with a screen and several buttons for sending data back to the connected microcontroller if needed. Her device would have three connectors for attaching the required receive, transmit, and ground wires, as well as a rear connector for plugging in a power source like a battery bank.
Building a circuit
With the components all gathered, Dumont then assembled them all onto a breadboard. The four input buttons sat in the middle, while the main serial lines was attached to an FTDI UART-to-USB converter module that was plugged into a host PC. Last of all, the screen Dumont chose also communicates over UART and was plugged into the Pico's other serial pins. This setup allowed her to press one of the four pushbuttons and view the corresponding output in the serial monitor. Additionally, any text she entered in the PC's serial monitor would appear on the LCD upon pressing the Enter key.
Creating a case
The enclosure for this portable serial monitor project is quite simple, as it consists of a rectangular base plate with recesses for components, and a top piece that gets secured over everything and has holes for the buttons, screen, and connectors.
The code
Displaying the most recently received serial values on the screen was quite simple to do in Dumont's Python script. If the mode switch is flipped to a 1
, then it continually tries to read from the UART buffer and store the latest value in a list while also removing the initial element if more than 18 lines are present. However, setting the mode to 0
causes the Pico to wait until the record button has been pressed, at which point new values are read and displayed accordingly.
Testing the monitor
Dumont not only placed all of the parts into the aforementioned 3D-printed enclosure, but even created a set of convenient cables that have a banana plug on one end, and the user's choice of either a .1in pin header lead, an alligator clip, or another banana plug. To view this portable serial monitor in action, you can watch its build log/demonstration video here on YouTube.