Your sensor may have any kind of output, the one that I know are either I2C or analog.
In the data sheet of your sensor you can find this variable (g / data_output), using this variable is actually waste of time. If you use the method I explained here, you just need to make sure your readings are in same units. Units will cancel each other.
If you want to show the data on your PC screen and in terms of g then do the calculation on your PC not in micro because that will take time form your PC and not your weaker controller on vehicle.
The only thing, I did missed the first time; I was using it was wasting time for finding the readings in g which is not important and keep in mind that I2C and analog outputs are integer and not float so all future calculation becomes much faster for the controller.
You may want to calibrate your accelerometer, this is not actually hard. all you need to do is to rotate the sensor and see the maximum reading in each axis, then multiply the variable (g / data_output) to your reading and you have to get something around 1. Do not be so picky if your reading is not exactly one since most of the sensors with cheap price are not that accurate and keep in mind that soldering and environment may change the accuracy of the sensor or the variable (g / data_output) slightly.
here I explained how to test your accelerometer. (http://asafdari.blogspot.com/2012/01/how-to-test-gyroscope-accelerometer-and.html)
There will be one other variable that you will need for using in what I explained here (Using three axis accelerometer with three axis gyroscope). This variable is called gravity.
Gravity is basically g in your sensor measurement, without changing units.
Using Pythagorean theorem we know that:
Acceleration_resultant = sqrt ( Acceleration_x^2 + Acceleration_y^2 + Acceleration^2 )
Now, consider the situation where the only acceleration applied on sensor is gravity, then:
Gravity = = sqrt ( Acceleration_x^2 + Acceleration_y^2 + Acceleration^2 )
Finding gravity is necessary and you don't need to measure it every time you turn on your vehicle, you can measure it once and use it as a constant. But it is good to once in a while you measure it again to make sure that your sensor is not affected by environment and even if it is, then just use the new value. I would calculate Gracity 100 times while my sensor is at rest and I would get its average and use it as a constant. Just one more thing, usually the output will be something more than a few hundred (despondent on your sensor and resolution of our reading) so ignore the decimal point and just round it and keep it as an integer so it will be faster for controller to do calculation with integers.
Usually the vehicles start from rest, so you may calculate Gravity every time you turn on your vehicle. Just make sure you are not relying on one reading.
I made this blog to share some of what I experienced.It is mostly about my quad. which you can see in the picture.
Monday, 16 January 2012
How to test gyroscope, accelerometer and filter?
You may rotary index. I took one from university's workshop and it helps a lot. It helps you to see the accuracy of the gyroscope, accelerometer and your filter. I have to say that it does not help with raw data from gyroscope it helps with the angle output base on gyroscope alone. you can use the following formula and test your gyroscope, just make sure that initial value for previous_angle is equal to zero and then angle change is reading from gyro and it gives you the angle. you have to keep the reading from rotary index and consider it as a zero at the time that you first turn on your sensor. This will even give you the idea that how gyro is drifting. If you rotate it at a faster, it will drift faster too.
angle = previous_angle + angle_change
For accelerometer the reading from sensor should be equal to rotary index.
For filter output, the reading rotary index should be equal to filter output.
angle = previous_angle + angle_change
For accelerometer the reading from sensor should be equal to rotary index.
For filter output, the reading rotary index should be equal to filter output.
Wednesday, 11 January 2012
All the projects I have done (MIT, please read this) ((there is no technical information in this post))
I have applied to MIT. There was an empty text box for blog address so I decided to fill it up by my blog address. Then I was like let’s explain whatever I did back in high school and afterward. So if they come here, they may read it. I can also make sure if they have checked my blog by a high chance. (My blog is not that famous and I don't have a lot of audience from USA.) Anyway let's get to the point.
The first project that I did comes back to my secondary school time, when I was 14. I made bridges models. At the time I did not know anything about hydrophilic systems. Once I was in our school lab and I notice that glass made syringes are so frictionless that gravity can move their piston. I wanted to make few bridges with moving part, so I thought that I can pump water inside the syringes and then it gives me movement in one direction. Then I did a short research and I used cars water pump (the one for cleaning front glass). We were one of the best projects in the exhibition that year although they did not give us any certificate. We had few bridges with moving parts.
I have done tones of small project with my LEGO RCX and NXT (LEGO MINDSTORMS). I made line follower, automatic car, automatic gear shifting (I made manual gearbox of old LEGO Technics and I made it automatic) and a lot more which I can’t even think of it now.
The other major project I spent a lot of time for it was my junior soccer player robot. I worked on it for few years and happily I have the pictures of my robots. (http://imageshack.us/g/259/cimg0921.jpg/) and ( http://imageshack.us/g/267/cimg2661.jpg/ )
The other project that I did was a system which could produce distilled water, petrochemical and electricity. The inputs of the systems were sunshine, wave energy and ocean water. I chose a place in southern part of my country and I did a lot of calculation to prove that it is possible to bring the project to reality. You can see its pictures here (http://imageshack.us/g/593/cimg1534x.jpg/).
Then there was a gap till the point that I entered Taylor’s University. I started a quad with 8 amazing friends. We have done a lot of research about PID control system, filters and we learned a lot of things. I was in the lab at all the time. They used to say that lab is my first house and sometimes I go to my second house to take shower and personal stuff like that. At first we had some difficulties but after a short while the dean of engineering Associate Professor Dr. Mushtak Al-Atabi and deputy dean Dr. Edwin Chung Chin Yau were supporting us in all ways. Meanwhile we were contacting Prof Dr. Benjamin Koo and he was supporting us and he helped with our trip to China and our preparation for presenting our project in CDIO conference.
We went to CDIO conference. (http://www.taylors.edu.my/download/dl_thankyou.php?src=newsletter/blue_print/TAYLORS_SOE_Blue_Print_2011_May.zip&title=Blue%20Print%20Newsletter%202011%20May%20Issue)
It was an amazing experience with all my friends in china and pressure of presenting our project in front of professors from different parts of the world.
After CDIO conference we started working again and we developed the project to this point:
We attended the engineering fair at Taylors university and we won following awards:
1) 1) The Best Research Project Award (Year 1) by Fibertex Personal Care Sdn. Bhd.
2) 2) The Most Needed Project Award (Year 1) by Rhombus Castors Malaysia Sdn. Bhd./ University of Western Australia
3) 3) The Most Technologically Advanced Project Award (Year 1) by National Instrument Malaysia Sdn. Bhd.
4) 4) Joint Winner of The Best CAD/CAM Design Project Award by University of Birmingham
Now, I am working on new quad, and that is the main reason I have this blog. I will post more pictures of my new quad soon.
Thank you for your time. (there is no technical information in this post)
Subscribe to:
Posts (Atom)