arduino 9 axes motion shield
As far as the hardware that I’m using it’s based on a Arduino microcontroller on top of the Arduino, I have a shield that is connected to a radio, so that can send the data to and from the computer, through this little XD radio. As far as the inertial measurement unit itself, I am using a three axis accelerometer from Adafruit that LLS m30 3d failed HC and I’m. Also that has a three axis acceleration and also a three axis magnetometer and then I’m, also using that l3 g zero, two zero. Three axis gyro from Adafruit. With these two chips, I get the full nine degree of freedom well I’m, showing these actually, if you’re, just getting started with inertial measurement. One player out that it’s cell wrong, or I really recommend the three axis accelerometer from virtue of boat X, it’s, a very simple chip. You can get it up and running with about five to ten lines of code, very simple, digital, read and it’s. The easiest way to start playing around with these these are on the at UC bus there’s, some advantages of that, but it also slows you down a little bit if you’re just getting started. So let me go ahead and show you some of the results right now and I’ll start kind of the simplest thing, which is just the accelerometer and I’m just going to show you the raw signals coming off the x axis y, axis and z, axis acceleration, and What you can see is the pink as the x axis.
The green is the y axis in the blue is the z axis, and these things are really easy to get going, and you can see that you just get data string off this thing very nicely and if you start playing around with it, for instance, if I Go like this, you can see that that is the x axis, which is pink. You can see that I get a nice big acceleration signal. As I move the device now you might see a little bit of noise and the other two axes come to find out. These chips have very good cross access isolation, but it just as I’m playing with it’s hard for me to move it precisely in the x axis. And so, if you see noise on one of the other axis signals that’s more how I’m moving it and not a fundamental limitation of the chip. If I can align it better, I can do better, but you can see we’ve got x axis and then in green. We have y axis and you can see it’s working well and in the z axis and blue up top is like this okay, so you play around with these a little bit. You start getting real excited about how easy it is to get this fairly. Nice acceleration data and the first thing that you start thinking is wow. If I integrate acceleration twice, I can get positioned and I could actually start measuring position of things with these.
Well, you can try doing that, but real quickly. What you find is integration works much better in calculus class than it does when you’re working with microcontrollers and sensors, and what you find is the noise in the signal by the time you integrate this twice. Your system has such an enormous drift. That is pretty much completely useless, and so it is an accelerometer it’s, a great accelerometer, but it’s not good for measuring position, so you play around with a little bit more and what you see is if you watch the z axis. This is just the raw data coming off the accelerometer. If I turn it upside down. I get a very large change in signal and similarly I can tilt the y axis screen is up now green is down or the x axis, the pink is up, and now the is down, and once you start saying is, is that it might not be very Good for measuring position, but you can kind of start seeing that you’re getting something that looks like it might be. Just a really nice tilt, sensor, I’m, going to turn the other accesses off and just look at the z axis. Then. What you can see is is that you can start very nicely looking at tilt, okay and right now, I’m, just looking at the raw signals coming off the accelerometer. What you want to do is kind of calibrate this. This would be if it’s sitting perfectly still with the X, with the z axis I’ve pointed up.
That should correspond to one G and then, if I turn it down, that’s a motion corresponding to negative 1 G. So I can take my two raw readings and I can map those between 1 and minus 1g and I can actually get a calibrated signal out fairly easy. And so let me turn on my calibrated signals x, axis y axis and z, axis accelerometer and now you can see up here. I had 1 G minus 1g on the y axis plus 1 G minus 1g and then finally on the x axis and Luth plus 1 G minus 1g, and so I’ve got this very carefully calibrated and very accurately. Measuring that vertical vector to the force of gravity. Well, actually, if I look at this, let me just look at a couple of accesses. Let me look at the yampz and if I try to spin this very carefully, what you can start seeing is is that I should have done probably X and Z okay. So if I spin it like this very carefully and if the better, the smoother I can spin it the better, you can see it that by spinning it at a constant rate, it looks like that we’re pretty much putting a sign in a cosine wave and that Sort of as a clue, if you go in and actually do the trigonometry, you can see that you can get a fairly accurate angle of tilt. If you just do the arc sine, you know, if you take into account all the three dimensional effects, the tilt angle and if you’re tilting along two accesses is a little bit more complicated than that.
But the simple equation is just take the arc sine of the acceleration signal and that’s a pretty darn good indication of the tilt. And so what you can see in doing that is is that you can get a very nice and accurate measure of tilt using an accelerometer. Now you play around with that a little bit and you get real excited, because you can very accurately measure that tilt just using a three axis accelerometer. But what you end up doing is. Is you start thinking that you have a tilt meter one day while you’re tilting it? You shake it a little bit and you’re reminded that these are not tilt meters. They are, in fact accelerometers and they’re tiltmeters only if you’re very smoothly tilting, but if you have any other type of motion on there, you get large errors and that tilt. Because of the acceleration signal that you have. In addition to take just the 1g vector that you get from gravity okay, so you sort of we’re excited there for a little while, but then you kind of got hung and then you realize is that there’s really something better to measure tilt that it’s so longer? And that’s a gyro and basically the gyro measures and your velocity, the nice thing about that is, if you want to get from velocity to angle, you just have to do one integration and that can be maybe a little bit more tractable and also the ISO.
The gyros have fairly low noise and so let’s just look at this x axis gyro I’ll turn it on and it’s from the other chip. This is auto scaling, and so, when it doesn’t get a signal a little while it just amplifies the noise, and so actually this is a very clean signal and I can show that. But basically, what I’m going to do is I’m going to rotate in the x axis, and you can see that if you look carefully and think about it that this is measuring angular velocity, because when I’m still it goes back to zero. And what you’re looking at is you’re looking at the angular velocity as I’m moving it, but you can see that it actually works pretty well, and if I look at all three axes, its gyro y axis and z axis you can see. If I move along Y, you see a signal in the green. If I move along X, you see a signal in the red and then, if I just move it around Z, you see a nice signal in the blue, so I can measure angular velocity in all three directions or around all three axes. So with that, why don’t we give it a try and see if we can measure our rotational position by integrating these gyro signals in and so I’ll take these raw, data’s and numerically integrate them, and I can show that here and show the integrated signal where I Integrate the angular velocity into an angle and then you can see.
I get three nice signals and if I move like this or move like this, you can see that I’m getting a signal. Let me just put one so you can see it a little bit more. Clearly, let’s see yeah that’s the X and you see now it actually measures the position it’s, not measuring velocity it’s measuring the thoth okay, very nice. I can turn that off and turn the Y on and see. I get a Y signal and look how nice and smooth that data is one of the issues with the accelerometer was the amount of noise in it, and you can see that the jaw doesn’t have noise, it’s kind of very clean signal and almost no noise. Now, that’s the good news, what the bad news is you’re, starting to see here: okay, even though there’s, not noise, there’s drift and what you can see is, if I just set it down and leave it at a very fixed angle. I have this rather significant drift and probably within a few minutes, you could get a couple hundred degrees of drift and then something will happen like right. There. It picked up a little bit of a signal announced a little bit like off to the races on drift notice. That it’s still got a real clean signal on the change, but you just have this overwhelming background drift problem, so you can see. Kind of what you’re up against here is. Is that you love the accelerometer, because there is no drift in the accelerometer at all, but the accelerometer is noisy, which makes it difficult to integrate and, besides being noisy, it also is an accelerometer and therefore, if you’re trying to use it for tilt – and you get Some vibration, that is a mess.
So, if you think about it, what you would like is you would like to sort of get your steady state value from the accelerometer, because there’s no drift so in steady state conditions. You want to kind of trust that reading from the accelerometer, but under a changing signal, you want to trust the changing signal of the gyro, because the gyro is not sensitive to acceleration. When you see a changing signal on the gyro, you know that it’s a real, a real signal, but you can sort of track where you should be that that baseline number, you should get from the acceleration. And so basically, you can do some math, where you’re integrating the values coming off the accelerometers and the gyros and your weighting, the value of the accelerometer, to give you a stable, baseline value and then you’re waiting. The change signal more coming off of the gyro, and so by fusing these two data streams between the it so longer in the gyro, you can actually get a very accurate signal now. The nice thing is is that I have an egg axis, accelerometer and rotation about the x axis. I have a y axis accelerometer and rotation around the y axis. The challenge is, is that with the accelerometer with the gyro? If I look at this other signal, the nice thing is with the gyro. I can see this rotation that is parallel to the earth. The problem is, the accelerometer cannot see this one because the gravity vector is coming straight down, and so I can compensate the other two accesses with the X accelerometer and the X janna row gives me one axis.
The Y celebration and the y Charro give me another axis. Those work well, but I don’t have an accelerometer that I can pair up with this z, axis gyro and so I’ve sort of got a problem because I would still have tripped in the z axis. But what you can do is remember this first chip actually has a three axis axis magnetometer and I have this vector that’s coming of the magnetic field of the earth, and that gives me a signal that I confused with the gyro signal and by doing that, there’s. No drift in the magnetometer, because north is north, that vector is very stable and the sensor is very stable, but I can use that for that other sensor in place of the place of the accelerometer. So basically I end up using the three axis of magnetometer. The three axis of acceleration and the three axes of gyro, and when I do that, what I can end up with is a measurement of roll and pitch and heading, and these are those data that are coming from the fusion. Between these nine nine accesses and let’s. See here it looks like the this one, the roll it looks like the roll is on here. Let’S see let’s, see if I get this right, yeah, okay, and what you can see is is that I can very accurately measure this roll okay and I have one that is a little bit of a cleaner signal where we’ve got the gyros helping out a little Bit more let’s, look at this okay, so that is the pitch.
You can see a very nice signal on the pitch, and what I want you to see is is that now that I have combined the accelerometer and the gyro that you’ve got something that if I just put it there, that is not drifting. The other thing that you see is is that there’s virtually no noise in the data, so by fusing that accelerometer and the gyro I’m able to have the best of both worlds and to not have drift and to not have noise either and so that’s. Just very very nice, and so that is the pitch now let’s turn on the roll. Just look here at the roll, so that would be there and there let’s see just real nice. I can kind of go in small steps. You can see how well it tracks. My motion and how cleanly signal is looking, ok and now let’s look at roll and pitch together. Ok, so you can see if I roll my pitch is staying steady right. This is my pitch. If I change the pitch, my role is staying constant and then, if I change my role, my pitch is well behaved and both of these signals are real clean. Now the yaw is the one like this, and so, if I turn the yaw on again, the yaw is the magnetometer combined with the gyro and that one you’re looking in in the purple, you can see I’m pointing north east south and there’s a place that it Jumps from positive 180 to minus 180, so you have that discontinuity is you’re going around the 360 degrees.
You can see really nice left and right, yeah, really nice pitch it really nice roll and the nice thing is, is that you can do this and the accesses are well behaved, you can tell roll and pitch or you can do the yaw and it all works, Saw it all works very, very well together, and so that is basically how I’ve combined the roll, the pitch in the yaw created from three axis accelerometer, three axis gyro and a 3 axis magnetometer. But what I want to show you is that things getting really fun. Now, if you start taking that and start trying to more accurately or more precisely use it as an indication of your actual position, and we see, I have to upload a different program and so it’ll. Take me just a second here: I’ve got to fill a few of these windows, and then I had to call it my Arduino and we’re going to load different program and let’s see sometimes it’s a little tricky to do this with the radio on it. But if I have my jumpers in the right position, I just do it: Oh cereal, pork, okay, but what I’m doing is you want to actually take this data to a row program and so the program that I’m going to be taking it to is a very Nice program, which is called the Python Indy Python, has some very powerful, very powerful graphics capabilities and it’s fairly easy to get the data and over the sea port over the serial port.
A lot of people really like C C is a hard program to learn to program an and I’m, not very good at C and Python it’s a little bit easier and a little bit more a little bit more. Our Python is a little easier to learn a little bit more intuitive. Those of us who learned on basic Python is a lot more like a lot more like a lot more basic so anyway, let me let me take this and fire up this program and let me see if I can I’m going to need to move these jumpers Back to turn the radio back on no matter what you do, these jumpers are always in the wrong spot. Okay, close that close that and let’s try. This again I’ve got the choppers in the right spot windows. I probably just need to kill it and try again, and these radios really don’t like going from being programmed to communicating. So what you can see here is is that I’ve got a model of my circuit and that model is responding to my hand, motion. Okay, so I’ll tilt it towards you. You can see the X beam, radio. You can see the interface. You can see the Arduino symbol, I can rotate it around, bring it back. This way you can see, we even got the red blinking line, and so let’s look at this would be pitch up and pitch down. You can see that it’s smooth with your roll left.
Alright, you can see underneath it we can look at the young. I got in a little trouble area there, but let’s try it this way. Okay, you can see the gyro chip and neat cell wrong or chip there, and so let’s go up and down down it up, left right quickly, okay, coming down this way that way that way, and so basically this is working really well all the way around and It’S very responsive and it’s very accurate notice. If I hold it still my hand, is twitching a little bit like if I set it down. Okay, you see it stabilizes there’s, just no drift at all in that and there’s really not very much noise at all. Very very stable when it’s sitting up when it’s sitting still and then it just traps tracks. My my motion very well now let’s talk about for my problem area areas are that I am still working on. Remember I’m doing this filter and and fusing of data between for this it’s between the magnetometer and the gyro, and so basically what happens is when I get to this positive 180 degrees, and I move it a little bit further it’s got to jump to negative. A hundred eighty degrees, well, the problem is, is that when you get that large change, the filter thinks it’s noise and wants to filter it out so, rather than just popping over it rotates the other way, and if I turn the filter off, it will make this Transition from here to here without doing that, but then I get more jitter all the way around, and so I need to figure out a way to turn that filter off to go smoothly from the positive 180 to just a degree over or you know, positive, 179 And minus 179 and have it make that transition a little bit more a little bit more smooth, so that’s a problem.
I still have to work on now. Another one – and this is a general problem with Euler angles – is that I come up here when I get absolutely vertical. The yaw doesn’t have any meaning anymore, and so the thing just kind of starts wandering around and it’s kind of, like a singularity, it’s equivalent it’s. The mathematical equivalent of gimbal lock in a physical system, and so it doesn’t it doesn’t, really work at these singularity points. I probably need to go in and see if I can put some special cases in, but the same thing happens here. Sometimes it will flip around at these various 90 degree points, although it seems to kind of be a haven there. Okay, so it doesn’t work at the 90 degree points, and also it doesn’t work upside down, and this is all the kind of ambiguity with the arc. The arc trig functions that, if you look I come up here and if I tilt it past 90 degrees. It starts coming back other way because of that ambiguity and the art trig functions. And so I need to try to see if I can do some special cases for that a little bit better, but you can see here that as far as any position an airplane would be – and this is working very great also if you made it smaller – you You know, use a PC board and some stuff that you could very accurately track your hand position.
arduino 9 axes motion shield Video
arduino 9 axes motion shield news
Posted on Tuesday July 23, 2019China’s Dissidents Can’t Leave Foreign PolicyIn early July, the New York Times broke the news that the Chinese government has stepped up its use of exit bans against U.S. citizens. As trade tensions … … Continue Reading »
Posted on Thursday December 20, 2018An FPGA for DIY Electronics DesignNewsSince its introduction in 2011, the Arduino low-cost electronics prototyping platform has allowed engineers, designers, educators, and makers to create new … … Continue Reading »
Posted on Tuesday December 26, 2017Fast 3D Printing With Raspberry Pi — But Not How You Think HackadayAlthough we tend to think of 3D printers as high-tech toys, most of them are not especially powerful in the brain department. There are some exceptions, but most … … Continue Reading »
arduino 9 axes motion shield Social