Posts: 4
Joined: Thu Mar 15, 2018 10:22 pm

Interfacing Arduino to Pi for Sensor Data

Thu Mar 15, 2018 10:43 pm

Hi there everyone. This is my first post so if i have missed some board etiquette please let me know.

I have been using arduino's to collect data from a motorcycle for my final year dissertation. Essentially it boils down to this;

5 * ADXL335 analogue accelerometers
1 * KY-003 Hall Effect Sensor
1 * analogue linear potentiometer
Previously used arduino Nano, Uno, Mega and currently Due to collect data

I am using the above setup to measure the suspension motion and movement of the sprung (body of the bike) and unsprung masses (wheels, calipers, discs swingarm etc) for a bike going over a special speed bump (machined into a 1-(cos(x))^2 shape).

The issue i am having is getting a high enough frequency to capture the data. With the mega (16MHz clock speed) i was getting 27Hz, and with the Due (84MHz clock speed) i was getting 37 Hz. The problem is that i need around 50, with 100 being Preferable, and ideally 200Hz. My theoretical solution is to use an arduino Due (or mega if its easier) to run the sensors, then pass the data to the Pi to do the computations. I have been following the below guide; ... duino.html

This has given me some sucess as i have managed to get data at a frequency of over 500Hz with one sensor, which i know will drop with another 16 inputs on top, but was better than the arduino on it's own.

The raspberry pi i am using is a 3 B+. I connected the arduino with a normal lead, as if i was connecting to a desktop or laptop, and passed the data through serial communication. The issues with this is that it did not print as expected (see below) and it was skipping a few seconds and not recording.

Currently the Pi is displaying the data in this form;


whereas i need it in the form;

0.018084 1023 75.00

My question. What is the best way to connect an arduino to a raspberry pi to send basic data to the pi for further computation. I can see that the pi supports i2c and SPI. Would these be better choices to interface the two? Is there any other issues i should be aware of?

Many Thanks

Ross Hanna

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 6 guests