Instructables

Angle measurement using gyro, accelerometer and Arduino

The device is a rough prototype of what will eventually become a self balance robot, this is the second part of the hole thing (read accelerometer and control a motor to self balance). The first part with only the gyro can be found here.
On this instructable we will measure the angle using both gyro and accelerometer, and using a technique to merge both sensor to get a smooth signal. The technique is called "complementary filter".

previous
 
Remove these adsRemove these ads by Signing Up

Step 1: What we gonna need:

Some part can be replace, and some modification at the code have to be made to fit your hardware.
On this project we will use:
- Breadboard
- Microcontroller, I used the Arduinoboard
- Wire
- Jumper Wires
- Gyroscope XV-8100
- Nunchuck Wii (for the accelerometer)
- Nunchuck Wii adapter for Arduino

Step 2: Building...

DSC05257.JPG
DSC05251.JPG
The circuit consists of a gyroscope connected direct to port 0 at your arduino and a nunchuck wii connect at the I2C port.

Assembling the gyro:

1. - plug the gyro at the breadboard
2. - wire ever thing:
- Vo pin from gyro connected to analog port0 at arduino (Light orange wire)
- G pin from gyro connected to ground (White wire)
- V+ pin from gyro connected to Vdd(3.3V) (Orange wire)

Assembling the accelerometer:

1. - plug the adapter at the nunchuck
2. - plug the nunchuck at the arduino using the adapter
3. - place the accel sensor like the photo above
ihelmi5 days ago
Nunchuck controller are use for what?? How can I use this, to combine with my pyranometer tracker?
otaviousp (author)  ihelmi4 days ago
Nunchuck controller has an internal integrated accelerometer.

You can use it for a variety of things, depend what are you doing or your need.
ontreus2 years ago
Desculpe-me, é que estou construindo um bicoptero e estou com um problema no equlibrio de todo o sistema, estudando seu codigo: angle_for_instructable.pde
Não vi nenhuma linha para a execução dos motores que vc usou no seu robô.
estes comandos estão em um outro arquivo a parte?
Obrigado pela atenção.
jgeidl3 years ago
The code link does not link to a .rar but to a .tmp file. Is the code link available somewhere else?

Thanks,

Jim
vivekchopra3 years ago
i need to build a human body sensor using an accelerometer and a gyroscope........and i am gonna use labVIEW as software for analysis.....can you please help me with the microcontroller part........should i go with lpc2138???

thanks
Is there any information about how that formula is derived, because I hate using things i dont fully understand
otaviousp (author)  skeleton11023 years ago
Read this instructable first, there is a plenty of information.

http://www.instructables.com/id/Accelerometer-Gyro-Tutorial/

Any doubt feel free to ask.
I mean the one to calculate the angle using accelerometers.
paolo.mosna3 years ago
Sorry If i bother you but where can I buy the gyroscope device you used in your realization?
otaviousp (author)  paolo.mosna3 years ago
I bought this gyro at eBay. But is no longer available.
Accentrix3 years ago
Thanks for the explanation. I was waiting for someone to do this.
WyoJustin4 years ago
Thanks, I'll need this for my next project.

Justin
otaviousp (author)  WyoJustin4 years ago
Nice, xD
gellis30004 years ago
When I try to download the .rar, all I get is a .tmp file. I have tried 3 different browsers, how does this work?
otaviousp (author)  gellis30004 years ago
Try just renaming from .tmp to .rar
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!