micro_monitor - A Command-line Serial Monitor Project

Status
Not open for further replies.

lucky_bloop

New member
Screen Shot 2018-10-26 at 6.34.01 PM.png

micro_monitor_1.png

I'm writing to share a project I've been working on, a command line based serial monitor for working with the Teensy and other microcontrollers called:

micro_monitor

I was introduced to microcontrollers and programming through the Arduino platform but after working with other programming languages, text editors and environments I have missed some features in the Arduino IDE. Meanwhile, friends and mentors have encouraged me to look under the hood at the lower level tools that compile and upload code. I've been learning about gnu's make utility and the gcc and g++ compilers. I'm also grateful that PJRC and Platformio offer command line tools for uploading code that are quick and easy to use. The one thing I haven't found is a way to replicate the Arduino IDE's serial monitor in the command line.

Inspiration came from a few directions:
- If I'm already compiling and uploading code on the command line it's inconvenient to open the Arduino serial monitor.
- It's possible to read and write to a serial port directly from a unix shell but it's not entirely quick or convenient.
- Existing tools like Gnu's screen and the pySerial miniterm make it easy to view incoming serial data but I haven't found good way to send and receive serial messages in the same terminal window.
- As I've been working more with interpreted languages like Python and JavaScript and as I look at doing more complex microcontroller projects I'm interested in building better logging and communication into to my microcontroller projects for debugging and other purposes. It's very helpful to send a command and get some quick feedback.

micro_monitor is a bare-bones project built in Python making use of the pySerial and curses libraries. It has been tested on Mac OS and Ubuntu but could likely run on Windows with few alterations. When you launch it, it scans the system and looks for available serial ports. When a serial port is selected, you enter a serial monitor window in the terminal, much the the Arduino IDE's, that lets you send and receive messages from the serial port. Just like other simple text based user interfaces like nano, vim or less, the window can be resized as the application runs. Like the Arduino IDE's serial monitor, the command line input is very simple - you can type basic ascii characters, use backspace to delete the last character, use the return key to send a message and quit the application with the escape key.

This is a small project I put together for fun, it's a fresh work in progress and I can think of lots of ways to improve it including allowing different baud rates, adding command line options, making the serial prompt more sophisticated, etc. but I wanted to share it on here in case it is helpful to anyone. A download link and installation instructions are available on github and please feel free to fork, contribute or suggest other tools that are useful for the same purpose. Of course, I'd love to hear if it's useful for anyone or if anyone has suggestions for improvement.

Thanks!
 
Status
Not open for further replies.
Back
Top