Earth to Accelerometer
Granted, the accelerometer is on Earth, and it’s not Earth communicating with it but my Arduino.
On a very quick side note, I found Medium because I searched for “hipster free blog” in Google’s search engine. I’m pleased.
I am documenting my progress as I build a quadcopter from basic components. I am an intern at the Jet Propulsion Laboratory and a physics student at UCLA. I love astronomy, physics, and EVERYTHING computer engineering related. I’m applying to graduate programs in robotics this fall, so wish me luck.
Today I learned how to convert from binary to hexadecimal. And by learn, I mostly just found a conversion calculator online and let it run its magic. Still, I did learn a few things in the process and mostly cemented some basic knowledge I had already regarding binary numbers. So that was fun.
Empowered with the hexadecimal addresses of each sensor on my sensor stick (using the 9DOF sensor stick from Sparkfun), I was able to write a short “sketch” (why is it called that anyway?) in the Arduino IDE. I can now communicate with the accelerometer using Arduino’s Wire library. Yes, I am using I2C (“Eye squared See”). Why? Well, I found a random final project report from a university student in India who noted that using SPI was a little sluggish in terms of data transfer between sensor stick and microcontroller.
Well, you can see the setup behind my text, here. I’m also using a logic level converter, also purchased from Sparkfun. I’ve read different opinions on the matter, but I would rather be on the safe side and not fry any of my components, so I am converting the voltage between 3.3V and 5V.
Also, I thought I should highlight the fact that I purposely digitally lomo’d the picture of my setup, because after all, this is a hipster blog, so it’s not complete without lomo, right?
Getting the raw output was really exciting. This is not the first time I have attempted communicating with the sensor stick and in the previous attempt I pretty much copied and pasted somebody else’s hard work. That teaches me very little and takes the fun out of exploring the unknown. So I am grateful that I was able to put the code together on my own!
The next step is to get it to read all of the axes, which apparently is just a matter of changing the number of registers it reads in a particular Wire library function (requestFrom() for those wondering). After that, I have to get it to convert the values into something the has meaning in the physical world. In this case, the accelerometer gives values in mgs. Not milligrams, but millig’s. As in gravitational acceleration at the surface of Earth: g = 9.8 m/s^2.
I also have to create an inventory of the various parts, like brushless motors, the chassis, etc. I think ultimately I’ll stick a real brainy-brain onto the device to control a camera and handle wireless internet communication (yup, I own a Raspberry Pi).
Also, maybe this is a really hard thing to do—but it’s really how I dreamed up this project about a year ago (while sitting in my multivariable calculus course no doubt)—I would like to have it ultimately follow a pre-programmed flight path. So that’s the goal. If I can make it get off the ground, though, I suppose I’d call that a job well done.
More in the next post!
(By the way, sorry if it was hard to read the text over the background image, just playing with the cool layout options!)