Embedded systems often require streaming data from a device through a terminal. Today it is common to record the data and then post-process the recorded text file with a script to display a plot. This project allows the user to plot variables graphically in real-time as you would plot electrical signals with an oscilloscope.
This project was built off an incredibly awesome github project and YouTube tutorial that built an egui application to plot real-time readings from the serial console.
Features added in this project:
- Ineractive serial console
- Auto find serial ports, drop down selectable
- Multi-variable plotting
- Export text logs and CSV (almost working)
Usage
# Clone the repo
git clone git@github.com:shanemmattner/Serial_Console_Oscilloscope.git
# Navigate to the application folder
cd Serial_Console_Oscilloscope/application
# Build/run the application
cargo run
You should now see the first screen:
Plug in your device, go to the drop down menu, and pick the correct port:
Messages will start streaming in from the port on the left side of the screen:
Input the variable you want to plot in the Variables
text box on the right. When you press enter you should see the plotting start.
Note:
The variable name must be of the format: *variable/punctuation*Value**space*
. You must also have a return
after the variable name, this lets the plotter know you're done inputting the name and start looking for the data.
My Variables
field contains counter at
. Notice the space as well as a return
to a new line:
counter at
Given a sterial stream of:
counter at 51375
counter at 51376
counter at 51377
...
We want to zoom in a bit on the y-axis
so let's enter a value in the Include Y-axis Range
box:
Next let's save the data to a CSV by clicking the Export CSV
button:
Finally, let's save the logs to a text file. Enter a name for the file and press Save logs
:
TODO
- Deleting trace removes it from plot
- Improve serial reading
- Currently dropping a lot of characters
- Set size of left panel and serial messages
- Size gets messed up right now depending on the length of serial message received
- Timestamps for incoming data
- Save data to CSV accurately
- Serialize data and put into polars dataframe
- Start/stop reading serial port
- Set y-axis
- Trace labels
- Multiple y-axis
- issue open on github for this
- input for changing look_behind
- Allow users to toggle seeing rows that are used for collecting data
- So terminal isn't flooded with data
- Drop down menu
- Quit
- Disconnect from device
- Allow timestamps from processor instead of timestamps from application side
- Generate Plotly plot from data
- Row of options for each trace
- toggle visibility
- perform some function on it
- profile code to see what's taking the most processing time
- improve string parsing error handling
- option to apply some function to each trace of data
- ie performa a moving average on a signal, multiply 2 signals, or more complicated math
- Parse symbol file and show user list of variables they can access
- Requires the associated firmware logic to send back arbitrary memory addresses
- Auto recognize variables being printed and allow user to select which to add as traces
- Transfer function generator between 2 signals
- Option to connect to database
- Make into WASM app
- Change name of signal on plot
- Digital decoding (ie allow users to pack 32 outputs into one
int
) - Integrate with oscilloscope data
- Does Saleae allow for this?
- Hardware in the loop testing
- Integrate DAC/GPIO output
- Calculate live statistics about signals
- Allow for user to set a window
Known Bugs
- Reading the serial terminal isn't perfect. We often lose data, especially when there's a lot of text coming through
- Left panel will grow and shrink with text