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

Logging data from RPi

Sat Nov 22, 2014 1:23 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 display the desired data (steering angle, power,...) on a tablet / smartphone.

After lots of searching on the web, i found a possible solution:
I have to work with an Arduino and a Raspberry Pi.
I need to connect the sensors to an Arduino, Arduino sends the data to the Raspberry Pi that stores the data.

The problem is that i don't know where to store the data.
I've read a lot about storing it on a database and control it via phpMyAdmin (or something similar).
But of course i have no wifi or ethernet connection.

So my question is: Where/how do I store the data I collect during my trip?

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

Re: Logging data from RPi

Sat Nov 22, 2014 2:30 pm

Given that you have no external connectivity you'll have to store the data in a file on the Pi. The obvious location is the Pi's SD card (which must be present for the Pi to boot/run) or a USB flash memory dongle.

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

Re: Logging data from RPi

Sun Nov 23, 2014 9:15 pm

Thank you.

Do you think I can realise this project without the Arduino?
What is the benefit of the Arduino in this project?

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

Re: Logging data from RPi

Sun Nov 23, 2014 9:23 pm

Whether an Arduino is needed/useful depends on the sensors you plan to connect. For instance an Arduino can handle analogue sensors, whereas a Pi would need to have additional components to handle an analogue sensor.

User avatar
Gavinmc42
Posts: 4526
Joined: Wed Aug 28, 2013 3:31 am

Re: Logging data from RPi

Tue Nov 25, 2014 3:21 am

Use i2c sensors
Lots around of them around
LTC2945 for voltage/current/power
TMP112 temperature
Accel/Gyro/Compass etc

Break out PCBs from Adafruit/Sparkfun/Seeed if you cannot make your own.

Use simple Python scripts to read i2c sensors and log data to a file on SD or USB stick
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Logging data from RPi

Mon Dec 01, 2014 4:07 pm

Thank you!

The desire to log the data to a smartphone or tablet is rejected.
It is enough to check the data after the bicycle tour.

I am trying things out with an accelerometer/gyroscope: MPU6050

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 (9V).
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: Logging data from RPi

Mon Dec 01, 2014 4:16 pm

You can talk to a MPU6050 directly from the Pi, you don't need an Arduino.

The Pi requires 5V power. If you power the Pi from a 9V battery you will destroy the Pi.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Logging data from RPi

Mon Dec 01, 2014 7:25 pm

Jossep wrote: How does the arduino send the data to the rpi?
Will a simple USB connenction between the rpi and arduino work?
You can communicate serially over USB, and the Arduino will appear as a tty device in /dev (exact name depends on model) on the pi.
Jossep wrote: The rpi will be powered from an external battery (9V).
When the rpi and arduino are connected via USB, does the rpi correctly power the Arduino?
If you power the Arduino from the 9v battery, the regulated 5v output can power the pi.

User avatar
yv1hx
Posts: 379
Joined: Sat Jul 21, 2012 10:09 pm
Location: Now an expatriate, originally from Zulia, Venezuela
Contact: Website Skype

Re: Logging data from RPi

Sat Dec 06, 2014 4:25 pm

I will go thought direct the option using the RPi, unless you have a very specific sensor that requires the Arduino for interact with others devices.

As some other people has told you, the RPi cannot be powered directly from a 9volts battery, you need some type of voltage regulator, also I'm unsure if the 9volt battery will last more of a few minutes while powering the Rpi.

If you need the barometric pressure/height/air temperature sensing, the BMP180 breakout board from Adafruit is a great option.

In that case I would recommend you use a portable power bank (Like these: http://www.amazon.com/Power-Chain-Smart ... power+bank), the capacity will be restricted to your budget and/or endurance time.

Some people find overkill the use of Mysql and related databases in the Rpi, I'm not an expert on that, but in all of my projects I always use the plain text files for storing the data recovered form the physical world, in this way I can ingest the data easily in another systems.
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://twitter.com/yv1hx

Return to “Automation, sensing and robotics”