EdgeTX / edgetx

EdgeTX is the cutting edge open source firmware for your R/C radio
https://edgetx.org
GNU General Public License v2.0
1.59k stars 338 forks source link

IMU/TX16S: support for LSM6DSOX #3164

Open Kevltan opened 1 year ago

Kevltan commented 1 year ago

Is there an existing issue for this feature request?

Is your feature request related to a problem?

I would like to be able to use the tiltX and tiltY on my TX16s. There is firmware produced in the past by Risto, which proved this to work using the LSM6DS33. The problem is that the Adafruit LSM6DS33, which is used has been discontinued. Adafruit does a current LSM6DSOX that has similar characteristics. Would it be possible to address and code this IMU to use with the TX16S on Aux1 using I2C communication? Risto has managed to restore power to the +5v pin using forked firmware, which I have now been able to get it to communicate with an LSM6DS33 module from my old X12S mother board. But saying all that, we need new firmware to support a currently available IMU (such as the one above) please 👍😉

Describe the solution you'd like

as a above

Describe alternatives you've considered

Adafruit LSM6DSOX LSM6DS3

Additional context

No response

raphaelcoeffic commented 1 year ago

We would basically need to order one and test with it, should be fairly easy.

raphaelcoeffic commented 1 year ago

I ordered a LIS3DH as well, so I can check whether or not it would be sufficient, as it is much cheaper than the LSM6DSOX.

Kevltan commented 1 year ago

Yes Raphael, there are loads of options out there, and you're probably right the cheapest would probably be adequate for the TX16S etc.

The LSM6DS33 works fine in my X12S and now I have one working inside my TX16S. The LSM6DS33 is off an old X12S board but needed 2 off 4K7 resistors on the PCB module to pull up the SDA and SCL to +3.3v. The IMU is mounted on the motherboard PCB.

Risto uploaded a new version of his firmware yesterday for the IMU integration into the TX16S, but this was somehow messed up in the compiling process.

On Sat, 11 Feb 2023, 14:54 Raphael Coeffic, @.***> wrote:

I ordered a LIS3DH as well, so I can check whether or not it would be sufficient, as it is much cheaper than the LSM6DSOX.

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/issues/3164#issuecomment-1426791148, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAWYQ4WOI2JSDFONDI53WW6R3VANCNFSM6AAAAAAUWYWWZA . You are receiving this because you authored the thread.Message ID: @.***>

Kevltan commented 1 year ago

I ordered a LIS3DH as well, so I can check whether or not it would be sufficient, as it is much cheaper than the LSM6DSOX.

Is this just an accelerometer?

pfeerick commented 1 year ago

Yes. Which I think for the purposes of this is all that is actually needed?

Kevltan commented 1 year ago

Yes, just for screen wake up then, I guess? How would you hold a position on the tltX and tltY without the gyro input, wouldn't they just return to zero when the transmitter held stationary at any angle?

On Sun, 12 Feb 2023, 08:19 Peter Feerick, @.***> wrote:

Yes. Which I think for the purposes of this is all that is actually needed?

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/issues/3164#issuecomment-1426969912, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAW5ZBHIPELAVHSRY5NTWXCMK5ANCNFSM6AAAAAAUWYWWZA . You are receiving this because you authored the thread.Message ID: @.***>

raphaelcoeffic commented 1 year ago

Yes, just for screen wake up then, I guess? How would you hold a position on the tltX and tltY without the gyro input, wouldn't they just return to zero when the transmitter held stationary at any angle?

Accelerometers can measure the earth gravitation field very reliably, so no problem here.

pfeerick commented 1 year ago

So would a gyro, no? Since it's only measuring the rotational force, rather than linear acceleration. A compass/magnetometer is what returns an absolute position at all times. Looking at the LIS3DH a little more (as I was wondering if it would be sensitive enough here), ST does specifically talk about it being specifically for tilt sensing (both as a simple "portrait or landscape" detection and also for one, two or three axis tilt angle sensing). If you have access to a betaflight or inav flight controller, and look at the values from the accelerometer and gyro, you'll notice it can always tell the orientation via the accelerometer, but the gyro is only active as you apply rotational force.

Kevltan commented 1 year ago

OK that's very interesting didn't realise that. Always thought that an accelerometer worked in conjunction with a gyro for example gyro for rate control and accelerometer for hold control once position established. But then I am talking from a model helicopter point of view with heading hold control as apposed to rate mode control using just a gyro.

pfeerick commented 1 year ago

Gyro behaves performs the same function in a heli... once it starts rotating, the gyro senses the rotation and how much, and then a counterforce is applied. In the case of a gyro, it's dumb, it's just trying to counter the rotational force and stop that tail spinning. Once you add an accelerometer, now you can self-level, as now you can determine relative position (based on the assumption that when you powered it on, it was on a level surface while it self-calibrated on power on/calibration procedure, etc). They can certainly be fun to play with... one of these days I'll get around to a self-levelling robot using exactly that... works like those hoverboard things that were (are?) all the rage.

Kevltan commented 1 year ago

Clever things and a great addition to TX16S and should have already been on the main board as standard like in the X12S.

Kevltan commented 1 year ago

All makes sense now the IMU unit knows its horizontal attidude perpendicular to earths gravity. A 3 axis gyro wouldn't know this only rotational movement relative to its axis's.