MEAM.Design - MaEvArM - Graphical Data Logging


The goal of the graphical data logging section is to provide an easy way to visualize data on the M1. It is possible to see data using the USB communications framework, but viewing in the terminal does not always give a very intuitive idea of what is happening.

In this guide, we will set up a method for viewing ADC values on a graph. You can throw any data at the graph, such as filtered ADC values.

Configure M1

The first step is to get your M1 to spit out Hex values over the USB port to your computer. Follow the USB guide, but use the following code instead:

#include "maevarm-usb.h"
int main(void)
unsigned int value = 512;
while(!usb_configured()); // wait for a connection

Now, your M1 will be spitting out an endless stream of 0x8000's to your computer. Check that it is working by running one of the various terminal options described in the USB section.

Configure Python


You need to install matplotlib from: Get this file if on Snow Leopard: matplotlib-0.99.3-Apple-py2.6-macosx10.6.dmg

You also need to install PySerial from - get the source version. Unzip it, and open a Terminal. Change directories into the unzipped folder, and run "python" - this will install the pyserial library.


You're going to want to download the Portable Python distribution: Make sure to download the 2.5.4 distribution. Now, grab pyserial from: Don't get the Windows installer - get the tar.gz source file. Unzip that with 7-zip - you may have to then unzip the resulting tar file, too.

In the resulting pyserial-2.5 folder, copy the serial folder. Paste it into the "\App\Lib" directory of the Portable Python distribution.


If you are running Linux, BSD, or your own operating system that you wrote in your free time, chances are that you know how to get Python running as described.

Running the Script

Updated some Python code

link: PyLogger (right-click, select download as
If having trouble, try this Logger, which eliminates a redundant new line check - thanks Miki. link: PyLogger2 (right-click, select download as
link: PyViewer (right-click, select download as
When in Windows, the Logger file should be modified to read from COM7 instead of /dev/cu.usbmodem411

Place these files anywhere if on Mac, or in the "~\App" directory of your Windows Portable Python install.

If on Windows, change into the Directory of your Portable Python installation. Go to the "\App" directory. Run "python.exe" - you should see a graph pop up with a straight line on it.

If on Mac OS X, open a Terminal and go to the directory where you downloaded the Python script. Run "python" - you should see a graph pop up with a straight line on it. For mac:

Running the Logger Wirelessly

If you want to log data wirelessly,