Jossep
Posts: 12
Joined: Sat Nov 22, 2014 12:53 pm

RPi + Arduino

Mon Dec 01, 2014 5:47 pm

Hello, I'm a last-year engineering student.

For my thesis I need to build an electric bike equipped with all kinds of sensors.
It is the intention to go for a ride and analyze the desired data (current, speed, acceleration , power,...) afterwards.

I will work with a Raspberry Pi and store the data on a SD-card.
I think i'ts usefull to connect some sensor to an Arduino and send the data to the rpi.
(I’ve read that an Arduino is user friendly for reading the sensor signals and a rpi for saving the data)

I am trying things out with an accelerometer/gyroscope: MPU6050 at this moment.

How does the arduino send the data to the rpi?
Will a simple USB connenction between the rpi and arduino work?

The rpi will be powered from an external battery (5V).
When the rpi and arduino are connected via USB, does the rpi correctly power the Arduino?

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: RPi + Arduino

Mon Dec 01, 2014 5:49 pm

Can't see much difference between this and http://www.raspberrypi.org/forums/viewt ... 37&t=92221

Jossep
Posts: 12
Joined: Sat Nov 22, 2014 12:53 pm

Re: RPi + Arduino

Mon Dec 01, 2014 5:58 pm

joan wrote:Can't see much difference between this and http://www.raspberrypi.org/forums/viewt ... 37&t=92221
This is a summary of what I know thanks to among other you.
I thought it would be useful to summarize it and put it here...

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: RPi + Arduino

Mon Dec 01, 2014 10:49 pm

I should not really bother replying to you as I am not an expert on any of this stuff, but I will say a few things that may or may not be correct depending upon the peculiarities of your individual use case.

I would not bother powering the arduino from usb, as it creates a voltage level problem.

First check ebay and buy the cheapest nano arduino you can find (If you are paranoid get the 3.3v spec'd versions), get a few as they should be $2 or less, you will need a soldering iron to solder up the nano. Easiest comms method is use i2c and power from the rpi 3.3v gpio pin(s) the datasheet shows this is right on the edge of spec, so it could damage your pi due to over current draw but I have never had any problems in probably 500hours of testing.

You will need 4 dupont cables to power and connect i2c for nano, the arduino example templates will work well as base and there is plenty of i2c libs and code available for the rpi.

Workout your own protocol for xfers and save all the data in a file on the rpi, its very simple if you know how, if you have never done it before but have good google skills you should be able to get a system up and communicating in 2-3 hours soldering and coding, from there it depends on what you want to do with your data.

Most sensors will run from 3.3v, but rpi has rather low current draw available from 3.3v gpio pins, so maybe get some cheap 7833 voltage regulator (3.3v) and supply from 5volt to convert to 3.3v.

Get a bread board to prototype the hardware.

Return to “Automation, sensing and robotics”