Any Arduino Gyro Projects

Any old or new electronic projects on the go
Post Reply
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

The CSM gyros, from Colin Mill, were amongst the first heading hold gyros. The early ones were enormous by today's standards, but still lighter, better performing, and much less battery hungry than the mechanical gyros with spinning flywheels that they quickly replaced.

The early ones did suffer from quite a bit of drift - mainly temperature dependent in my experience - but more modern ones are amazingly stable once you've set them up properly and isolated them as far as possible from any vibration.

I've considered using a MPU6050 for a novelty transmitter project with no sticks (except perhaps for the throttle). You would control the plane by simply rotating the whole transmitter slightly around its three axes for roll, pitch, and yaw control. Biggest problem would be if you accidentally flew back over your head, as turning around to face the plane would result in a sudden massive rudder control input :lol: That wouldn't matter if you had a plane with just ailerons (or just rudder for the main steering control, which would then work from the 'aileron' roll transmitter tilt). If I could think of a clever way to control the throttle too, without needing a stick or pot, then I might just do it!
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: Any Arduino Gyro Projects

Post by bluejets »

Martin,
Would that not be similar to a fpv headtracker..?? Granted it is just 2 axis.

Pete,
I did refer to the drift car single axis gyro back in #2 and wondered the same.
Never considered the Arduino as an overkill given they are but a couple of dollars each for the pro mini and I am fairly familiar with them these days.
As for the sensor I also had the MPU6050 in mind as in #1.

Cheers Jorgo
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

Yes, just like a headtracker, or some of the games on mobile phones.

Since I wrote that post I thought of building a strain gauge sensor into the case, so you'd control the throttle by how hard you squeeze the case, and you'd control the elevator and other controls by tilting the case. Only visible control on the case would be an on/off switch. Any other controls for selecting model memories and configuring throws and mixes could be hidden inside or underneath a cover or flap.

Anyone interested? Or am I the only person mad enough to want such a thing? :lol:
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: Any Arduino Gyro Projects

Post by Tobe »

Several years ago I actually connected a Wii handle to a transmitter via an interface as a buddy box to try to fly/control that way..it was never really my cup of tea but the younger one used to gaming did pretty well.
Cheers,

Tobe
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

bluejets wrote: 01 Jul 2020, 11:48 Never considered the Arduino as an overkill given they are but a couple of dollars each for the pro mini and I am fairly familiar with them these days.
As for the sensor I also had the MPU6050 in mind as in #1.
Its not so much the cost I was thinking of as the size. The last gyro I bought was a Futaba GY430 (now superceded by the 440) Its only the size of a postage stamp, has gain control and optional heading hold! Also switchable for high-rate servos! Lovely little gyro, but around £80! And again, something of an overkill for a Lark, or any other vintage machine.

All we need is a basic gyro, preferably with remote gain adjustment, but not necessarily heading hold!

--
Pete
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

You probably do want some of the features though - like the setup mode for adjusting the servo travel limits, directions (without having to turn the whole gyro upside-down) and such. Those would take the most time to code.

I could copy Collin Mill's method of using one auxilliary channel to control gain and mode - one side of zero selects heading hold mode, and the other side selects rate mode. The distance from zero on each side sets the gain for that mode. You just set the end points on a two-position transmitter switch. If you want, you can have both points on the same side of zero - say if you wanted high and low gain rate modes, but no heading hold mode. Of course, with a modern transmitter, you can switch to more than two points.

The bits are cheap enough. Couple of quid each for on Ebay for the MPU6050 which has good three axis gyro and three axis accelerometer inside. And a suitable Arduino like the Digispark costs another couple of quid. It makes you wonder why the commercial offerings are so expensive - I suppose there's a limited market and everyone wants to make a profit.
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Any Arduino Gyro Projects

Post by Pchristy »

If I was setting up an aerobatic machine, then yes, I would agree. But here we are talking about a basic sport / vintage / maybe scale machine. If you look at what we used to use for those, back in the day, then a lot of the modern "clutter" can be removed!

The CSM 180 I use in the Larks has no remote gain control (useful, but not essential!) nor does it have reversing or end point adjustment. (You reverse it by mounting it the other way up!)

Yet for a Lark, or an old Schluter / Kavan / Graupner it is perfect! And the simpler you make something, the less there is to go wrong! (That includes reversing switches!)

In many ways, that old RCM&E gyro amp was as close to perfect as you could wish, yet there wasn't a micro-processor of any kind in sight! Admittedly it used a mechanical gyro, but it did the job. If we could devise something like that, with a solid state sensor - much like the CSM-180 - I would be in hog heaven! ;)

--
Pete
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

I suppose if we're basing it on an Arduino of some kind, then we could do any custom set-up by editing the Arduino sketch and uploading it again. That would greatly simplify the code.

And with a reasonable set of defaults that suit a basic helicopter, then there would often be no need to even do that...

Any preferred Arduino? The Digispark AtTiny85 is the most compact one that's cheaply available, but realistically, you have to use a programmer such as a USBASP to upload the sketch to it.

The Nano is more user-friendly for beginners, but much bulkier...

The Pro Mini falls somewhere between the two... slightly less bulky than the Nano, but still twice as big as a Digispark - and you still need some kind of programmer...
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: Any Arduino Gyro Projects

Post by bluejets »

Hehehe...love the "squeeze the case" throttle.
Can see a learner with a "death grip" on the case though..... :D :D :D
Seen it many times in light aircraft only on the joystick.
Only cure there was a rag with ether... :shock: :shock: ...maxing out the volume on the headset didn't achieve much.

Like the Arduino pro mini or the ATtiny and MPU6050 approach.
Easy enough to plug in a USB/TTL adaptor for a couple of dollars.
Similar for the ATtiny.
Heading hold/ rate mode ideas seem good to me.

Looked at more detail on the drift car gyro but it seems as well as heading, there is a built in throttle cut back when cornering.
Whether or not it could be dialled out is another thing as there is no reference to it in the limited details.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Any Arduino Gyro Projects

Post by Martin »

Here we go.



Only working on 328mega (Nano, Pro Mini, etc.) at the moment. Next step is to migrate the code to an ATtiny85 so it will run on the smaller Digispark board. (Edit: now the same version of code works on both 328mega and ATtiny85).

The sketch is attached. The configuration settings are in their own config.h file - you should only normally need to edit the options between the two comment lines that have lots of 'equal signs' ===== to mark the start and end of the section.

Code: Select all

// ================ edit the #defines within this section, to configure custom settings ================
// which input and output pins to use (choose numbers from 0 to 7):
// input pins connect to receiver outputs.  the output pin drives your rudder servo
// if you don't want to use the AUX_INPUT, still define the pin, but leave it disconnected
#define  RUDDER_INPUT_PIN 2
#define     AUX_INPUT_PIN 3
#define RUDDER_OUTPUT_PIN 4

// output (rudder servo) travel limits (microseconds)
#define MIN_RUDDER_OUTPUT 1000
#define MAX_RUDDER_OUTPUT 2000

// operating sense NORMAL or REVERSE
#define DIRECTION NORMAL

// default operation mode (if AUX_INPUT_PIN not connected)
// choices are RATE_MODE or HEADING_HOLD_MODE
#define DEFAULT_MODE RATE_MODE

// default gain (if AUX_INPUT_PIN not connected)
// range is 0 (gyro off) to 100 (ridiculously high gain)
#define DEFAULT_GAIN 25
// ====== end of custom settings defines - only edit the other code if you know what you're doing! ======
Connections should be obvious from the code. Edit: there is now a manual to download, and some schematics further down this thread - these concentrate on the ATtiny85 version, but if you want to make a 328P version, the 'connections explained in the code' comment still applies!
Attachments
gyroMPU6050.zip
Updated July 31. Bug fix for heading hold mode and new parameters to support faster update rates when digital servos are used.
(19 KiB) Downloaded 271 times
Fusion360boxDesign.zip
Enclosure 3D drawings - Fusion 360 format
(152.09 KiB) Downloaded 165 times
boxSTLfiles.zip
3Dprint enclosure files (STL)
(5.32 KiB) Downloaded 139 times
manual.pdf
Manual. Work in progress, but does currently cover how to set up your Arduino IDE to support the ATtiny85. Update: also now USBasp connections.
(276.55 KiB) Downloaded 260 times
Last edited by Martin on 31 Jul 2020, 13:57, edited 9 times in total.
Post Reply