Skip to main content
Topic: Interface Arduino with GPS, accelerometer, gyro, ecc (Read 21755 times) previous topic - next topic

Interface Arduino with GPS, accelerometer, gyro, ecc

Hello,
I rewrite here my problem more precisely. Ian (crew) has been very kind in the forum Bus pirate, but for my problem I think I need a Bus pirate.
I'm not sure in electronics, but for my degree thesis I have to interface many sensors: GPS, accelerometer, gyro, magnetometer, barometer, odometer.
At the beginning I didn't want to use Arduino because I think it's too complicate for my aim, but now I think this is almost the only way.
My question is:
1) How can I interface Arduino with these sensors?
2) Which modules have I to buy? Including Arduino.
3) Which interface I need for the sensors?
I 'm sorry for the banality of the question, but I'm a beginner.
Thanks to any answer.
stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #1
If you are not good at Electronics, I guess the Arduino is the only way to go...
There are many Shields for it, that have all the functionality that you need. Check, Seeed, SparkFun, ITead, and Arduino sites...
best regards FIlip.

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #2
In the previous forum post you mentioned two boards: Tri-Axis Gyro Breakout and 9 Degrees of Freedom - Razor IMU. And here is what you plan to do:

Quote
I have to build a IMU platform integrated with a GPS sensor, and a barometer + sensor of temperature for il positioning in-door, ad example in galleries and undergrowth.

So I'll talk about both boards with keeping your goal in mind:

1) Tri-Axis Gyro Breakout: This is just a gyroscope, it won't be enough for what you are trying to. I've worked with IMU's as a part of my graduation thesis, making a tilt-wing UAV platform, and for dead-reckoning (which means trying to find your position without the help of GPS or other radio signal triangulation by using sensors related to turning, displacement, acceleration etc) you basically need an accelerometer, a gyro and a magnetometer at least, both 3 axis which gives you 9 DoF which brings us to the second board.

2) 9 Degrees of Freedom - Razor IMU: This is the sensor pack you are looking for. It is discontinued, but there should be something similar to it. But the thing is this outputs the raw sensor outputs. What you need is to "merge" these sensor outputs by using Kalman filtering, we did that in my project, not totally my job but some part of it was. Over here things are not related to electronics (which is just related to interfacing circuit components) but more related to control engineering (where Kalman filtering originated from) and mathematics.

So what you have to do is get all the required sensors: Accelerometer for acceleration data (which when integrated twice gives us the displacement data noisy as hell but can be filtered out), gyro (which gives you angular velocity, integrate it once to find your attitude in space and use it to find where axes of your accelerometer is pointing), magnetometer (points to magnetic north, accelerometer points down, you can find your initial attitude with this but accelerometer will not give you which direction you are facing initially, which is needed for initial attitude calculation and other on-the-fly corrections), GPS (can be used to set the initial location until you lose the signal inside the gallery, also might be useful during calibration), odometer (displacement sensor, can be used as long as you have contact with the ground, pretty straightforward by just one but gets interesting if you use two to track distance traveled by left and right wheels of a car), barometer (I guess you mean altimeter? to find get the depth information I assume, not really reliable, drags with temperature changes, airflow changes, need calibration, GPS data can be used initially). Then get information from them, one by one, by using each sensors protocol, I2C, SPI, UART or pin state changes (most odometers work the same as rotary encoders). This is where Bus Pirate will come in handy: Use it to test each sensor, the registers, communication, replies etc. Then you can use the firmware files for your own project, less hassle with testing out a new library related to communication. Once you can collect all sensor data in one uC, you need to actually derive the Kalman filter! It is hard, it requires lots of processing power (we used an ARM uC, 32-bits, fast, what we had with the Sparkfun IMU board we got for the project), and this is where the BIG BUCKS ARE! Commercial IMU's are not expensive because of the sensor quality only (they use laser gyros, better than MEMS gyros and more expensive as an example) but because of the firmware running inside that box, crunching all the sensor data and giving you your coordinates. Most of them just find your attitude (orientation in space) which is easier compared to finding actual position by means of accelerometer data (you do not integrate a noisy-as-hell signal just once but twice! That is bad-bad-BAD for your calculations).

TL;DR: If you are trying to use an Arduino to find position in a closed space that is not possible you can find your orientation (check out DIYdrones, they are doing that), but you can use it to collect and send data to a computer and crunch the numbers later. Also civil engineering and building an IMU as a graduation thesis?! What are your professors smoking?!

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #3
Thanks Tayken for the long and exaustive answer.
So you are advising me to don't use BusPirate because then I have to merge datas, and it's very difficult, right? I think so, too.
BusPirate can read datas, from more sensors linked in parallels, in a serial mode, query each sensor with its ID, right?

Arduino can merge easier datas from all sensors, or does also it require something other?

TL;DR: I'm doing a graduation thesis in topography, a part of Civil Engineering ;)
Thanks
Stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #4
[quote author="stivbigs"]TL;DR: I'm doing a graduation thesis in topography, a part of Civil Engineering ;)
[/quote]
The problem here was that even we, a team of 1 undergrad, 3 grad and 2 PhD students in Mechatronics Engineering found that merging data to get reliable results from a bunch of sensors to form an IMU was exhausting, we had many sleepless nights to meet deadlines, I was not expecting this to be done by a Civil Engineer, like we study the separate parts of the engineering spectrum. :)

OK, back to other questions:
[quote author="stivbigs"]So you are advising me to don't use BusPirate because then I have to merge data, and it's very difficult, right? I think so, too.[/quote]
Well, you can use it but as long as:
- For trying out each sensor. I use my BP for trying to see if I can communicate with a sensor, if I am accessing the registers correctly. If I can, I connect the sensor to my board and write my own firmware by the help of BP firmware.
- The sensors are using the same communication protocol (I2C, SPI, UART etc). These all have different electrical characteristics, different connection diagrams so you cannot use connect all these on the same pin. Check out Wikipedia for more information.
- If you are using the Razor IMU (or sth similar) you can use BP binary scripting mode to get all data to your computer and process them later. Probably an FTDI breakout board will do the same job as that board outputs data via UART.

[quote author="stivbigs"]BusPirate can read datas, from more sensors linked in parallels, in a serial mode, query each sensor with its ID, right?[/quote]
Yes and no. As I said they have to share the same data protocol otherwise data corruption may occur. And their ID should be different (for I2C). Or you should use different Chip Select lines (for SPI).

[quote author="stivbigs"]Arduino can merge easier datas from all sensors, or does also it require something other?[/quote]
Arduino is a real simple microcontroller and programming language platform. It can do lots of things but it does not have enough memory and processing power for IMU operation. DIYdrones guys are using a simple approach called Direction Cosine Matrix method. This is possible for Arduino (they are using an Arduino variant, a lightweight one for aircraft) as it is computationally simple (relatively) does not require too much source. But this will not be enough for dead-reckon problems. + They use this for not position sensing, but finding the attitude (orientation) of the aircraft. You might use the same method and double integrate the accelerometer readings after finding the attitude but this will produce huge errors as there is noise, bias etc present on the sensor data.

I advise you to check out different communication protocols that BP can do, like I2C, SPI and UART. This will give you some idea if you can connect the sensors to the same pin or must use different pins. Then read some manuals about IMUs. There is a nice tutorial about DCM on the net, as simple as it gets. Then ask things that bother you, I'll try to answer as many as I can ;)

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #5
my silly addon comments :oP

as Tayken already said, designing and integrating sensors is not an easy thing .

maybe you could start with something already built,  of course it might cost you more money ...
search for drone systems ... the first from google  ... http://diydrones.com/profiles/blogs/new ... nsor-board

i'm sure there is some more ready to used hardware and software platforms (and probably more expensive) for you to used and who can jump start your project .

:-)

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #6
Nice find voidptr!

By checking out the schematic, you need I2C for barometer, accelerometer, gyro and magnetometer. GPS output is done by UART. For 99 Euro, seems pretty good to me.

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #7
Thanks Tayken for the usual exaustive answer. I think I'll give up the project with Arduino, and if there is something already built I think I'll give up also BP.
I have already found Daisy 7 platform, but I didn't know if was good for me, so thanks Voidptr ;)
Actually I have found this platform (http://www.acmesystems.it/beeboard_imu_gps) that integrate Daisy 7 with an Usb output.
My original project was to choose each sensor, to buy what I desired, but now I think that is too difficult for me. However BEE Board and Daisy-7 IMU-GPS module has quite good sensors, so I can try it. The only con is that datas are not merged as in some other platform as sbg one (http://www.sbg-systems.com/products/ig-500n)
Thanks
Stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #8
I have also found another solution. It's based on Arduino. Give a look, I think it's quite good, Only there aren't characteristics of IMU:
https://store.diydrones.com/Full_ArduPi ... apm-02.htm
What do you think about it? I can also take datas out from USB.
Thanks
Stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #9
First option looks good. Has all circuitry needed for communication, all you have to do is program the software on computer.

SBG one will be pricey, I should warn you about that. One other project my professor was working on was a humanoid robot, they used an IMU like that. As I can remember the cost was around $6,000 for just one IMU. No GPS, only accelerometer, gyro and magnetometer. But 100 Hz is what you need basically for dead reckoning, there will be errors eventually related to calculation errors (discrete integration and such).

I actually did see the last one. Some guys from DIYDrones were at THS about 2-3 months ago, it can stabilize the quadcopter by DCM. Dave from EEVBlog was using the same board and had to debug a problem he created, maybe in the later videos he talks about the board, worth checking out.

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #10
Ok.
1) I actually think I'll use DAISY-7 solution. But I have to know how can I read datas from sensors, which output have.

2) Full ArduPilot Mega kit is surely more attractive because, after I have made my experiments, I can also add other sensors. But even here I have doubts on output: a) I don't know which interface it has,  b) I don't know if I can query each sensor from pc or I have to write some lines of code for arduino.

Thanks
Stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #11
[quote author="stivbigs"]1) I actually think I'll use DAISY-7 solution. But I have to know how can I read datas from sensors, which output have.[/quote]
You check out the schematic to see that the output (10 pin connector) has signals for I2C which turns out to be all the sensors except GPS and UART which is connected to GPS. GPS will probably output continuous stream of data. You have to use I2C commands and have to look up the sensor datasheets to find sensor specific commands and registers.

[quote author="stivbigs"]2) Full ArduPilot Mega kit is surely more attractive because, after I have made my experiments, I can also add other sensors. But even here I have doubts on output: a) I don't know which interface it has,  b) I don't know if I can query each sensor from pc or I have to write some lines of code for arduino.[/quote]
More info about that board is over here.

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #12
Ok, thanks.
Arduino has USB interface.
For Daisy-7 I have to link GPS to pc with a serial port (as you have said). But for other sensors, that have I2C interface, I have to use a BusPirate, right?
stiv

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #13
Arduino has FTDI IC which creates a virtual serial port.
For Daisy 7 you have to either use an Arduino to get data from sensors. Or a Bus Pirate. With Bus Pirate first you can use terminal mode for accessing registers and getting readings out but after that you'll have to write your own program to use binary mode to get sensor readings. Probably another FTDI breakout connected to GPS pins is nice for getting position data that can be used for calibration during tests out in the open and initial position lock when used in a closed space.

Re: Interface Arduino with GPS, accelerometer, gyro, ecc

Reply #14
Taken you'll be in my degree credits ;)
However I think that I'll use Daisy-7 with BeeBoard or Full_ArduPilot Mega kit, that is more expensive but it is also expandable in a future.
Stiv