Sure, looking at real-time data is cool and all, but wouldn’t it be nice if you could record it and really dig through it afterwards? Today we will learn about the data logging features included with the REM V4 and later.
The REM is built off an Arduino compatible architecture, and one of the fun things we can do with an Arduino is Serial Data Logging! By connecting the REM to a computer through the USB port, we can use a Serial Monitor Program to view and save data that was read in. By copying the Serial Data to a Text File, we can then view it later or import it into a grapher such as Microsoft Excel for easier viewing.
Note: REM II V4 and above also come with a micro SD slot that is planned for future data logging when I can get the code working properly. Models before V5.2 may have incorrectly wired micro SD slots so please ask if you have any questions!
Serial Monitor Setup
Getting the goods is fairly straightforward after everything is setup. I use the Arduino IDE’s built-in Serial Monitor to capture and save data since it’s the most familiar to me. You can download it for free here: https://www.arduino.cc/en/Main/Software .
You may need to install this Teensy Add-on package as well so that Arduino can properly talk to the REM: https://www.pjrc.com/teensy/teensyduino.html
Once everything is installed we can open it and get to work. Plug in the REM and wait for any drivers to install. Then in Arduino, go to Tools > Port and see if the REM is listed. It should be called usbmodem14111(Teensy) under the Serial Port list. Click the correct port so that we can talk to the REM.
If that worked, you should be able to go to Tools > Serial Monitor and access the REMs Serial Port and read in data! A few things to notice are baud at bottom right corner which sets the speed that the Serial Monitor is listening for. We will want 115,200 if Arduino doesn’t pick it automatically. Autoscroll allows the window to automatically show the latest data. You can uncheck this to scroll manually or allow you to copy data from the window. Control + A will select all the data, Control + C will copy all the selected data, and Control + V will paste all the data into a text editor after you open one.
Note: The Arduino Serial Monitor can be a little picky, so if the REM is ever disconnected or shut down, all the data currently in the serial monitor will be grayed out and can not be copied. You MUST copy the data BEFORE the REM is unplugged or you will not be able to retrieve it! Plugging the REM back in will usually erase all current data in the monitor, so you’ve been warned!
REM setup is simple. In Renduinix v0.890, go to Options > More > Settings > Advanced Menu > USB Output to select the serial output needed. Settings are as followed:
– Disabled: Data will not be transmitted to the USB Serial Port
– Normal: Data will be sent as calculated values that can be easily read
– Raw: Data will be sent as the full un-calculated stream for deeper log viewing
– Passthrough: Data will be sent completely unedited at 62,500 baud for compatibility with a Renix logger
I personally use Raw because a lot more info is available if you feel like adding some formulas, but normal should do fine for the average viewer.
Note: If you had to change this setting, make sure to restart the REM so it can properly take effect!
Now that everything is in place, all you need to do is turn on the vehicle’s ignition and the REM should start transmitting data to the computer!
Viewing a Datalog
Ok, so now that we’ve got a text file of our datalog, what can we do with it? Well, view it of course!
I like to use Microsoft Excel to view data logs since it organizes everything into rows and columns, allows the use of formulas, and most importantly can graph the data!
For the smoothest import experience, it’s important that the datalog was saved as a Plain Text Document (.txt). A Rich Text File uses lots of junk in the background which will show up when we use Excel’s import wizard, and we don’t want that.
Note: For large files, it is highly recommended that you use Excel 2010 or newer! Older versions will lag pretty bad when trying to graph larger logs so save some headache and use a newer version!
In Excel, go to File > Import and select Text File. Find your file in the browser and click open. The import wizard will show us a few things, we want Delimited, not Fixed Width since we are using spaces as our separator value. If the data starts on row 1 then you are good to go, otherwise select the row you would like to start at and click next.
In the next screen, select Space as our delimiter, and deselect all other ones. You may notice “Treat all consecutive delimiters as one” becomes auto checked, turn this off as it is necessary for a compressed raw file to be imported properly. After that you can click finish and import it to a new sheet! I like to import to row 2, so that row 1 can be used for labels.
At this point, it’s up to you what you wish to view, but a few tips to make viewing easier.
– The first column is Millis, this is a timer variable that keeps track of how long the REM has been running for. Divide this by 1000 or ignore the last 3 digits to see how many seconds you are in the log.
– When graphing, I prefer a Straight Marked Scatterplot with the X-Axis set equal to the millis row. This will allow the graph to be displayed in an accurate time scale and allows you to view sections with some clever editing. Right click the X-Axis and edit the minimum and maximum value to display. This allows you to look at different or smaller section of a log so you don’t lock up your computer with billions of data points!
– When Graphing a Raw Log, it may be useful to adjust the Y-axis so values are more readable. Set the Max to 256, Min to 0, and Major Axis to 32. This will let you see some of the Renix Patterns a little easier since we are working with 8-bit values.
– Not all values are created equally! Prom Values never change after key on, and some values are actually digital binary states that contain many on/off readings in one value! To view these correctly, the value will have to be broken into it’s 8 individual bits so you can make sense of it’s meanings.
Besides that, have fun and happy logging! You never know what you might find hidden within these mystical little systems.