This code, along with some shields, turns your Arduino Uno R4 or R3 into a combination CAN bus and Analog data logger.
Ensure that the voltage of analog inputs does not exceed the limits of the hardware you are using!
This is where settings based on hardware are configured.
Check that chip select pins, status LEDs, input buttons, etc. are assigned appropriatly.
The type of RTC chip being used needs to be configured on line 18 of src/main.cpp.
This is where settings based on data collection are configured.
Up to six CAN messages can be filtered for, or no filter can be set and all CAN messages recorded. Up to four analog data channels can be recorded. Pins A4 and A5 are used for I2C communication, so it is not possible to also record data on these pins. Pacing for analog data can be configured, to only record analog data every nth CAN message recieved.
In the file .pio/libdeps/uno_r3/mcp_can/mcp_can_dfs.h, defining DEBUG_MODE as 0 on line 41 can help save memory if you are building with SERIALLOGGING defined in include\options.h.
Data saved is in a binary format, following the structure defined in include/tCAN.h.
For simplicity, analog signals are saved the same as CAN messages, with their message ID being equal to the value of the pin.
There is an example script, datapostprocessing/bintolog.py, that converts binary files into human readable text logs of all message data.
Ensure that there are no overlapping chip select pins I moved the chip select pin of the SD card on the RTC board to D6, cutting the trace, and using the provided breakouts.
Ensure that devices have appropriate pullups/downs I wired 4.7kΩ pullup resistors to the SDA and SCL lines of the DS1307's I2C bus, using the provided breakouts on the RTC board. Uno R3 does not have input pulldowns, so depending on your analog inputs, you may want to add pulldown resistors to prevent floating.
Any MCP2515 based shield can be made to work, but here are some suggestions:
| Image + Link | Description | Price | Tested |
|---|---|---|---|
![]() |
Shield with CAN connectivity, built in LEDs, and a joystick for input. | $39.95 | ✅ |
![]() |
Much more affordable, but lacks extra peripherals. | $6.99 |
Any RTC chip supported by RTClib should work, but here are some suggestions:



