So what I’ve been enjoying doing is going up nice and high and then just turning the motor off and seeing how long I can stretch it out fall before I have to turn the motor on again and one sunny day a while ago, I managed to glide For 11 minutes, so I must have been in some thermals or something in was a lot of fun. But one thing that I’ve kind of wanted to do is I like to switch between line of sight and fpv fairly regularly, just to sort of appreciate the form of looking at the plane flying flying around. I just like to look at it’s a good looking plane. What I notice is that I can’t take my eyes off my goggles for too long, because when I’m, not looking at the fpv screen, the plane will tilt to one side or another, and if I haven’t located it in the sky. By that point, I’m gon na have to quickly look at my goggles again and straighten it up, but before it starts to dive down to the ground. So what I started to think about doing is making a poor man’s flight controller that consists of just the dry row and accelerometer like a MPU 6050, just a simple breakout board and see if I couldn’t get the plane to just just hold itself level for a While 10 20 seconds – maybe something like that – that was always really wanting to do and I’ve been thinking about it for a while.
But what put me off is having to do the sense of fusion between the gyro and the accelerometer to get both of those numbers together to get a good reading on what attitude the plane was actually in and at the same time I discovered a few years After it actually happened that the DMP I think, it’s digital motion, processing documentation for the MPU 6050 is actually released. This used to be some kind of a secret feature, I think, but what it lets you do. Is it basically does all the motion? Does all the sort of calm and filtering kind of thing inside the IMP, you 6050 itself, so that you can just get a quick quaternion out of it and it will save you from having to do all that stuff in your own Arduino sketches or whatever you’re Making it with and it’ll actually give you better results. There’S, a video here I’ll put a link to this in the description and you can see that it gives you more accurate results and faster results, and you can also get a pretty good handle on the your position position. Well, relative position. I guess it is for your. I did not use the your in this experiment that I’ve been doing, which I maybe I should because you’ll see if you watch the rest of this video, that I had a bit of a trouble that this probably could have solved. So that might be something I could do in the future, but for now I’ve started off by keeping it about as simple as I could and yeah.
I had a few little issues that I’ve made some attempts to fix, but I have only done one test fight with it so I’m not going to upload any source code in this video, because I did not keep a copy of the source code that I had. That I tested for this flight. So if I was to upload the code I have now, it would be code that I have not never even tried, so I don’t really want to do that, but I will make a follow up to this unfortunately, was raining today. So I couldn’t do it today, but on the next fine day I will try my new code and if that works better I’ll upload that in a follow up video but anyway, I’ll just show you a little bit about how it works and then we’ll look at The test flight, okay, so I’ve got things into a state which I think is ready to go onto a plane for a test. But just before I do that, I’ll show you a few things at the disc because it’s easier for me to demonstrate it with it. Connected to the computer so that we can see the Arduino serial monitor there, sorry about the noise and the background it’s that noisy power supply that I’m using to supply the five volts for the servos there, but we’ll just have to put up with it. So none of the stuff that I’m using here is actually what I’m going to be using on the plane.
So these servos, I will not be using the receiver. I will not be using actually this transmitter as well. I will not be using, but basically it should all work the same when it goes onto a plane. So what I have running here is pass through mode at the moment, so you can see when I pick up both the servos go. The same way when I roll they go the other way so that’s the Elavon mixing working, although I may actually have to reverse one of them when it goes on the plane, depending on which way the servo is mounted on the plane that I’m going to use It with so let’s just pass through no trims, no special rates. We explore anything it’s just completely passing through this channel to the server directly apart from the Elavon mixing course, and the numbers that we are looking at on the screen on the Arduino serial monitor the current roll angle and pitch angle that the IMU is telling us And you can see that’s it here. It is a little bit off to the side and it’s crooked. If I put that flat onto the disk roughly, we should get about zero and zero in those first two numbers, so just let it sit back up there so that it’s off a bit. Now, if I switch this switch down to the middle position, I will be in attitude hold mode and you can see that the servo suddenly moved over, because the next two numbers on this display are my desired roll and pitch angles and I’ve desired to be keeping The plane perfectly level and since it’s not level, because the sensor is on an angle, these servos have moved to the position that will hopefully bring the plane to level and you’ll.
See that if I put the sensor flat down on the disk again, those sensors, the servo, should move to roughly vertical gain. Well, they’re, not perfectly vertical but pretty close to the vehicle. And if I hold the IMU flat on the disc like that and move my roll stick to the right, you’ll see. I’Ve now said that the angle of the plane should be 20 degrees angle to the right. So that’s well 19. You know so one of those servos arts roll, so both of them are moving and they have to move because it thinks that the plane is not moving. So the servos have to move to make the plane roll to the right, so that’s, say: 35 volts that the degrees or so to the right and the servos have gone off center to make that happen. But it’s not happening because this is stuck to the desk. But if I move it, they roll it that way about 35 degrees, you’ll see that the servos come back to the middle thinking that they have done their job and they don’t need to do anything now and if I shake this around, but you’ll see the servos Moving in that direction, it’s a bit harder to do it with a pitch direction, but you can see that they go the same way when I change it with pitched. So the pitch is responding correctly as well, so that is, attitude hold and I’ve made it so that you can go only 75 degrees over.
I don’t want the IMU. I don’t know what the numbers are going to be like if it actually goes upside down because I’m, not using a proper quaternion, though part of the processing. It uses a quaternion to get these final pitch and roll numbers, but once you get it into a pitch and roll, you might get stuck with some sort of gimbal lock when it goes up completely upside down. So I don’t want it to go more than 75 degrees off level, so that’s that there and it takes that long to go from positive 75 degrees to negative 75 degrees. So it’s a little bit on the slow side. Perhaps there might be might feel strange to fly compared to what I’m used to and pitch pitch limits are to about. So this should be pitching up at 60 degrees and pitching down at 45 degrees. I figured that it probably wasn’t okay, I might’ve got those the wrong way around anyway. I didn’t. I think that the pitch angle limit should be a little bit less aggressive. Then roll you’ll see anyway, it should work out. So I can get that back to have enough precision that I can put it on zero if I’m careful. So I think this should be decent enough to control it in the sky and get the angle to sit exactly what I want now. The third mode here is my failsafe or glide circle mode. So when I switch this down to the bottom position will see that the desired roll and pitch angles will change to a slight bank to the left of five degrees and a slight pitch down of two degrees.
Wait a minute that’s backwards, isn’t it, because when I pitched forwards, I had and you’ll see that when I switch back to the attitude hold mode it’s it’s there, the those 2 0. Just in case, you had the numbers from last time and you suddenly Bank to that angle. Now what do they do push forward? Our pitching forward is positive, so looks like this should actually be a positive for pitching downwards, but anyway, slight bank to the left and a slight pitch downwards is what’s going to happen either. When I put it into this position or when I get a failsafe situation in the throttle, also go to zero at that point as well, but I’m, just not showing any throttle numbers on here. Apart from what I just said about the throttle going to zero in this mode, the throttle is also just passed through directly, and the only other thing to look at is that, when we’re in this attitude hold mode, each plane will be a bit different, and I Don’T really know if this five degrees, roll and two degrees pitch down is actually going to be a good angle for this plane to do a slow spiral Glide. So what I want to do is put it into attitude, hold mode and maybe it’s, maybe the plane that I’m using is more like 11 degrees, left roll and four and a half degrees pitch downwards is a better angle to hold a nice slow downward spiral Glide.
So I consider it to that manually. Whatever I want and then I’ll flip the switch down and you’ll see a little line of text will quickly disappear off the top of the screen, but you should be able to see it and what that did. Is it wrote these two numbers here to the EEPROM so that if I start this program again wonder if I can do that by doing this, No yeah I’ll start the game by reuploading the sketch. Here we go so in this starts. Hopefully the sketch will start there. We go see the store dangles there whoops scroll up, so we have stored angles, it’s just going to print those out when it starts the program. So this is coming from the EEPROM. So now, when I get back inside after determining what does a good glide spiral angle for this particular plane, I can sit there as the angle to use for my failsafe settings anyway, that’s how it’s all going to work so it’s going to put it on a Plane all right, I have everything installed in the actual plane that I’m going to use this with now, and there was a convenient little ledge there for the IMU to go on. It seems to be perfectly level when the plane is pretty much level and there’s a nice left to right. You know flat edge there, that you can press it up against to make sure that the roll Direction is going to be this correct as well or whatever it’s going to be square to the direction that the plane is traveling.
So it’s quite handy and I had to fiddle around quite a bit getting the Elavon mixing correct with the new servos and getting that just getting everything to match up correctly, but pretty sure I have it working now I had to cut hard code, some rate reduction For the pass through mode because it was just obscenely high travel and now this is a 30 reduction, that’s still quite high, but this is when I had it with my normal Elavon mixing with the normal receiver settings before by the way you have to remove the Elavon mixing from this when you’re flying this, you just give it a normal pitch and roll instructions for each channel. So this is passed through and then, if I switch into attitude hold – and I I’ll just flip the stick down a little bit and you can see how the elephant’s will stay there now, but they’ll stay there until I. What did I do down so I wanted to pitch. I wanted to push up right so if I grab the plane and push it up a bit you’ll see that whenever I get when I get to the angle, that was the whatever pitch that I input the Elavon will go back to the neutral position. Put it down flared again, that will come up like that, not quite the same on that side, but I think it’ll be right. So it’s a it’s, a kind of a funny thing.
You you’re not going to be able to use any trims in pass through mode, but when you’re in this attitude hold mode, you don’t need trims, so it’s a kind of a funny thing like that. We still hope that hat works and when I go into the failsafe mode, we’ll see you won’t see much because the plane is kind of level, but it moves a little bit. So if I wanted to get that level, I mean, if I wanted to get it back into the neutral position there. You can kind of see that the plane is gon na. Be about like that. So that’s gon na be my downward spiral. Glide position, a couple of other things I had to change while I was twiddling around today, was that the servos that I’m, having here a little bit different to the ones that I was using while I was testing at the desk, seems like they different servos like To have a different frequency of pulses, usually it can manage with 50 Hertz, but I found that 50 Hertz made these move a little erratically. They moved, but they weren’t very smooth at all and 250 Hertz, which is what I was using with the ones that I showed you at the disc before they moved quite smoothly. But occasionally they get sort of a sort of noise like that and they wouldn’t move at all just for 2 or 3 seconds and then that come right.
I didn’t like that, but I found that at a hundred Hertz they seem to be ok, so they are those servos just in case it makes any difference, and the other thing I found out to my disappointment was that this receiver is only giving 6 pulses. 4 ppm output and I could have sworn that these gave you eight channels, 4 ppm, and this is the radio that has the modification that should give you a challenge for ppm as well. So I don’t know why it was only giving 6 channels for ppm. But what that means is that I’m only going to have my switches, I was planning to be able to use these dials for dialing down the gains just in case the response was too much but I’m, not gon na. Be able to do that so it’s, just gon na be flying with full gains for this run on the bright side, though there’s no wind, so this is going to be great weather for this test. That should go well. I’M, anticipating it will be a roaring success. So let’s go to try Music. Okay! If I let it go. Oh it’s trimmed quite nicely that’s, lucky, okay, so I’ll just put it put it into the attitude hold mode right here and off or the gains are a bit higher. I think not bad. Sorry. Let’S get away from the Sun okay, let’s hand off pitch down a bit, maybe ah it’s, really good, so I’m barely touching the sticks, I’m just sort of tapping it a little bit here in the AC, no hands straighten up a bit oops back the other way.
Oh, that didn’t hold too well, did it. I think it’s climbing it’s not actually holding role very well, yeah, it’s, climbing, but generally what you know the roll is drifting a. I wonder why that is so it’s, not that great. Actually, I mean it’s, nice and smooth, but as far as being fit for purpose for holding a steady angle and doing a long, slow glide, I don’t know all right: let’s try the failsafe mode here, bang motor off gliding, slightly banking to the right left. I mean. Okay, that’s not going to work all right, so that angle was way too steep for a slow, glide oops lots of my orientation Wow. All I could see was the silhouette and I lost my orientation that’s. All it was pass pass through mode at the moment. Okay, back to stabilized back to pass through to pull up, I it’s not that the stabilized motors not working well it’s, just that I’m not used to flying a plane in angle mode, so alright let’s put it over there and let’s. Try the stabilization mode again. Their pictures down a bit much, I think now, it’s pitching up too much all right. Well, I think it’s working nice enough that I’m going to try this fpv and I won’t have any trouble so let’s bring it in for a landing stabilized mode. No, the roll man it’s really not holding the roll at all a little surprise. There just bring it back and pass through mode again nice to have that as a emergency.
Okay, now land in stabilized mode. You know it’s it’s slow too it’s a little bit slow to react in stabilized mode, so yeah. I was hoping that I could do nice long, slow, glide landings and stabilized mode and just you know basically land hands off, but it seems like that might not happen anyway. Let’S try some fpv Music just getting into that nice phase where everything turns red. Just put it here and well: it’s stabilized, though it’s really diving down that’s good. So when you’re, an SPV, now I’m totally hands off for the last 20 seconds or so still hands off. But I’m gon na have to turn around here. Okay, hands off still hands off and straighten up straight okay straighten up, let go yeah, look at it rolling over. That is not good all right! Why is it doing that? Hey, let me just put it straight again and hey hands off seems like it prefers to roll to the right, but I would have thought that at some point the accelerometer would detect that it’s not in the right angle, and it would fix it. But it just seems to keep rolling further and further to the right like this. This is all hands off here right now. Let me switch into my failsafe mode. Oh, nothing change, oh it’s! Turning to the left, yep, okay, okay, that’s, not terrible, but it’s tuning more and more and more to the list. Isn’T it oh that’s, not good, all right back through stabilized mode and better just bring it back over here.
I think there’s a little bit of wind. It may be pushing me over there all right, let’s see if I can record some values into the EEPROM about what I would prefer as a glide mode, rather than those default numbers that I’m using so I’m in stabilized mode or attitude hold mode and I’m gon Na turn the motor off, because that effects the glide slope a bit and it’s. Oh pull! We back on the stick all right and I’m gon na right about there I’m gon na record those numbers. So it should be rolling to the right a little now I’m hands off again gliding yeah, just sort of glides. I mean it rolls further and further to one side, which is not not good at all. Wonder why I guess the accelerometer is not feeling true gravity when it’s riding on the plane like this hey, that might have something to do with it. Maybe it should be paying more attention to the gyro then to the accelerometer. Still, this is pretty good hands off here at times it can hold this level for a long, a long way, starting to get a bit low there. So motor back on get into the small motor okay come back this way, bitch down a little people and center. Please, okay: hands off yeah it’s drifting, bummer there’s, not gon na, be as useful as I thought in fact, it’s not really that much better than having no Auto stabilization at all.
Oh yeah! It is let me just split out of attitude holding them back into it. Again, buy this and see if it straightens up at all, so the role straightens up, which seem to straighten up a little bit after a while. I haven’t touched it since I did that switch flip by the way so it’s, nothing too bad. Well, just looking at it line of sight, it looks really solid and stable, oh good, so I guess it’s like it’s better than not having it. This is all hands off, getting a little bit far away, though. So let me just turn here and there hands off there and straighten up and hands are here, ends off so hopefully I can get back all the way back here, without touching it. No it’s drifting to the right yeah. I wonder so I’m bringing it back myself here now. I’Ll just place it towards me and do that flip in and out of stabilized mode again and okay hands off from here. That looks bitter thank still going to the right, though yeah yeah, I really thought that would work nicely, but yeah handoff looks like it could use a I don’t know. What are you supposed to do about that? If it’s not feeling true gravity, how can you really? I mean you could use the gyro only and just since the gravity at the beginning of the flight and then ignore the accelerometer thereafter, but you’d have to really trust the gyro see every time I let it go.
Who wants to go to the right? Maybe this is just an aerodynamic thing that we can’t fight. Okay, I think it’s enough for this evening. I’Ll, do a little bit more testing tomorrow, maybe and see how it goes with the Sun high in the sky, so that we don’t have this done in the camera like that and off pretty good, sometimes like not sure what the wind is doing up there. I can’t feel any wind up here now, it’s turning to the left see I’m just gon na. Let it turn back. Things like it holds pitch quite well, it’s only the role that that drift hi. This is a good sickle I’m, going to reset my EEPROM values. To this value, whatever it is: okay, we’re going over the neighbor’s property here, so I’m gon na turn back see. If I can’t get it to go straight, hitting straight at me here and and off that’s good. I can feel some wind now so right now, we’re hitting perfectly upwind into the wind letters and probably climbing a little bit here too, because this camera is not exactly pointing level it’s, actually pointing down a little bit due to the way it’s mounted on the top Of the plane that slopes down – oh, this is good – might just bump the pitch down a little bit because getting kind of high here we go hi again I’m gon na cut the motor here see what it does bitches down a bit turns to the left.
Like I’m gon na reset my glide number to this one, my EEPROM values, because this is actually in a glide which is what we want when it’s failsafe thing. Look at that thumpy, probably what it’s doing here is it has the touch stick fully back, because what I’ve noticed with this plane is that when you want to do a long glide, you just pull the pitch. Stick all the way back and it will just sort of float around and you can still steer left and right, but that makes it come down really really slowly so that’s, probably what it’s doing except that’s going the wind is pushing it a little bit further over. In that direction, then I would like so I’ll just have to turn the motor back on and bring it back again. Okay right that was all hands off I’m gon na put the motor back on, lose it just trying to find it line of sight. Oh okay doing well anyway, so back home, wonder if I can glide home from there. Okay motor back on this is all hands off. I think I know what’s going on when I do a role in put the when I take my hand off the stick, it hasn’t actually completed meeting the role angle that I told it to so. When I take my hand off the stick, it’s actually going to be going a little bit further than I wanted. Whereas if I do what I did just now, which was use the switch to reset the role angle to zero, it keeps the role a lot better.
Although it’s still going to the left now, this may be just the wind bit. This way picked up a little well left. Okay, now I’m gon na reset. It here see if it straightens up not really still going to the well that’s going to the right yeah it’s, going with the wind every time. It’S doing this interesting. I wouldn’t have thought that the wind would affect the the your direction of the plane that match, but it definitely does okay, but it comes there and off difficult earn all the way back from the touch down a bit and it’s definitely a lot more relaxing to Fly then having to do the whole thing yourself, all the time, let’s bank a little bit here. We go. Stop right. A little bit lift a little bit pretty good reset to zero pick up a bit. It seems to work fairly well well now, it’s. Turning into the wind yeah, I don’t know it just just doesn’t seem to be able to hold its roll very well, but fortunately the pitch is quite stable, which is probably a bit more important than keeping roll stable. Well they’re, both important. Are they all right, it’s? Getting a bit dark so I’m, going to land now and I’ll see if I can land in stabilized mode, just go all the way up there and I’ll come back, see if I can do a nice long, low, landing, a low landing gear, the landing is always Low, you know what I mean a low wide down to the landing now I’m in stabilized mode here, but I’m continuously giving inputs to reset the role okay, but of shaking there.
Maybe the gains are a bit high it’s going to the lift. Is that still going to the lift it’s a bit of a strange one? Okay, total down model bear gliding, no, not to there yeah it’s a little bit easier to land like that. I guess didn’t really make too much difference anyway. That’S going to do it for today might do a bit more testing of this in the future, probably tomorrow and see if it gets any better if it does I’ll, let you know now, if anybody’s still watching. After all that you are probably quite interested in this, so I thought it would add a little bit of extra discussion of some of the details at the end here in an effort to cut down on the comments that are gon na. Tell me things that I already know so: I’ve changed my mind and I will actually upload this code. That I’m that I have here. This is the untested stuff that I’ve already made a few modifications to. But if you want to know the details, you can look at this and look at it to your heart’s content. You’Ll know everything that’s going on and you won’t need to ask me too much about it for now, but the biggest problem I think I had was that the plane, the accelerometer is not sensing. True gravity: it’s, not sensing, which way it’s directly down anybody who’s flown on a plane in bad turbulence, will know that you don’t always feel the correct the Earth’s gravity when the planes bouncing up and down and doing turns and stuff and like light up light fighter.
Pilots, when they’re doing high J turns they always get pressed down into their seat rather than you know, getting pressed in the direction of the Earth’s gravity. So that was probably the main problem I think which which prevented the plane from being able to hold itself nice and level, not really sure what to do about that. I I don’t have any ideas. Another problem I could have been having was that I did not calibrate this gyro and I’m using the was this here. I squared C Dave library very handy, and this is basically just a little bit cut and cut and paste out of the MPU 6050 DMP example. Mm hmm and there’s a few lines here where you are supposed to set these for your own gyro offsets. I did not do that. I just used those I probably should have set them to zero. I suppose two might have been a little bit closer to what it’s likely to be, but I don’t know so I’ll do that properly next time that might help a little bit and the other couple of things I’ve changed is that when you lit know was it Yeah, when you let go of the stick, what I was doing as we saw in my demo, whereas we were looking at the serial monitor before is. I was just recording the desired pitch, as the user had changed it with the stick. When they let go. The stick: it would just record whatever the desired pitch was, but it would be much much better if the current pitch or pitch or roll whatever.
The current angle was recorded instead of whatever the user was trying to input, because this desired angle would not yet have been reached because it has a bit of a delay. So whatever you see in your fpv goggles is not what you’re going to be setting as the desired angle. Whereas really you should be setting the current angle as what you want to keep because that’s what you’ve already seen in your goggles as you’re flying. So I changed that and also was storing an EEPROM the desired angles instead of the current angles, so I’m storing now it’s during the current angles and EEPROM I’ve changed a couple of other little things here in there too. But those are the main things so yeah. If anybody feels like looking at that and giving me some tips, especially what to do about not feeling the true gravity, because I’ve noticed that the einav flight controller does a pretty good job of that somehow and I haven’t really bothered to look into it. Maybe I should look into it properly anyway, that’s going to be the end of this video.
arduino round Video
arduino round news
Posted on Saturday April 20, 2019[Project] Wi-Fi Round LED Clock All 3DPThis stylish clock not only shows you the current time but is also an eye-catcher in your room. With a 3D printer, a couple of electronics and a free weekend, you … … Continue Reading »
Posted on Tuesday July 16, 2019Daily Deal: SunFounder Robotic Arm Edge Kit for Arduino TechdirtThe SunFounder Robotic Arm Edge Kit for Arduino is designed for DIY electronics hobbyists to learn robot arm control. With the open-source MCU Arduino UNO … … Continue Reading »
Posted on Wednesday August 07, 2019New Teensy 4.0 Blows Away Benchmarks, Implements Self-Recovery, Returns To Smaller Form HackadayPaul Stoffregen did it again: the Teensy 4.0 has been released. The latest in the Teensy microcontroller development board line, the 4.0 returns to the smaller … … Continue Reading »
arduino round Social