Rotation sensor from IMU?

I'm looking for ideas for developing a rotation sensor for a sailboat, to measure a) mast rotation and b) rudder angle. Both rotate through approximately 100-150 degrees and require around 1 degree resolution and 10Hz sampling. I currently use a Honeywell rotation sensor that works OK but is expensive and requires a lot of manual calibration.

I would like to use two 6DOF or 9DOF IMUs; one attached to the boat and one connected to either the mast or the rudder.

One option is to use an IMU with built-in fusion like this: Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 : ID 2472 : Adafruit Industries, Unique & fun DIY electronics and kits, and simply compare the relative yaw from the two sensors.

Another option is to use two 6 DOF IMUs and compare the readings from each. My question is, if I do this, can I simply discard the pitch and roll output? Since they're both attached to an object that's moving in the x,y, and z axes, presumably it doesn't matter if the boat's pitch or roll impacts the yaw measurement, since I'm only looking for yaw difference between the two sensors (using e.g. Madgwick filter). This seems like the simplest and most robust solution, if it won't introduce a lot of error.

I would also like to avoid calibration, if possible, or at least calibrate once and save to flash, which probably means not using magnetic sensors.

I've already tried a couple of solutions with Hall effect sensors and TOF sensors but nothing has worked as well as the Honeywell sensor.

A bad idea there will be too much drift on any device like this to make it work.

I would recommend a continuous rotation potentiometer, the types used in servo motors. These are not cheap, but are robust and require calibration only once.

I considered that, but the problem with a pot is that, unlike on a motor, I don't have access to the center of rotation. This means I would have to connect the pot with some kind of belt. Even a gear drive isn't feasible because the mast does move in 3 dimensions relative to the deck (it sits on a ball). The roll/pitch is slight compared to the yaw, but a system like that would resemble a derailleur and probably wouldn't last long on a boat. But I'm open to ideas for better mechanical solutions than what I've considered.

Belt, gear, ... everything is better than a IMU or this part. YOu might get away with a magneto if you don't have magnets on the boat.

For absolute yaw or Z angle determination, a horizon reference is required. On a 9DOF IMU, that is the job of the magnetometer, and those have to be calibrated.

For mast rotation and rudder angle, you need a relative horizon reference. See post #4 above.

Measuring sailboat mast rotation has been discussed on this forum. Use the search box to find the posts.

Can you use a string potentiometer/string encoder approach where you wrap a cable around the mast or rudder stock and measure rotation with a spring loaded potentiometer or encoder?

That's one of the current solutions, but costs $1k, and the strings tend to get yanked and break because they're on deck. It works well for below-deck rudders though.

Impressive price for a string pot!

So I wonder if you were to place two magnets in a line on either side of the IMU, if the magnetic lines between them wouldn't overwhelm the local Earth magnetism, causing the IMU magnetometer to react to your magnets instead. If so, that should provide a stable, non-contact rotation detection.

When I was in nautical school, after taking the ship out of mothballs for the year, one of the first things we'd do on our way out to sea was to "swing for deviation" to adjust the magnetic compasses to cancel out local magnetic fields. This would be the opposite, where we only want to react to those local fields.

I think the theory sounds reasonable, but I'm out of my depth here...

If I had a real 9250 on hand, I'd give it a shot, but as I mentioned in a post earlier this week, all of mine turned out to be fakes.

That's not a bad idea, and I might try it out. One of the solutions I tried was putting a rare earth magnet on the mast and two Hall Effect sensors, so I could triangulate using spherical geometry. The problem was that Hall Effect sensors are really binary; there's just far too much noise to try to get an accurate "distance from magnet" reading. But an IMU might be better. Not sure how I would interpret x-y-z as distance from magnet, though.

No.
There are two basic types of Hall Effect sensors.

  1. The digital type you speak of.
  2. The analogue type that give you a proportional reading. Like these:-
    Ratiometric sensors

Please take a look how it's done in real live:
https://ams.com/position-sensors

I am aware of those sensors, and have indeed used four of them in a project.
The range you get from these sensors is very very small, and totally unsuitable for what is required in this case.

This is the project I used the on.
https://vimeo.com/manage/videos/95955945

Sure the distance is small. But the sensors are small, too, and you usually place them exactly where you need them without gears, strings, whatever. And they are not vulnerable to water :slight_smile: For the hobby market you find them e.g. on Makerbase Servo boards https://www.youtube.com/watch?v=R1TghZmE6Gs

???

What world do you live in, I know it is not the real one.

Your advice I reject, but maybe the OP would want to explore this as after all he is the one that matters.

This post showed up as similar: Using two compass/magnetometers to measure relative rotation (yaw) - #14 by RyanN

Maybe you can contact him to see if his idea worked.

Hello all, thanks for the advice and links.
Current state is that I have a working system. One ESP32 is attached to the mast. It has a Bosch IMU (BNO085). It has a web interface for configuration and reports mast heading using both ESPNOW and NMEA2000 (CAN bus). Most of the time its reported accuracy is <1 degree, which is fine for my application. The Adafruit library makes it very easy to get a tilt-compensated heading from a quaternion. I will publish my code on Github eventually but right now it's working but still a dumpster fire.

The other compass is either another ESP32 with a Robotshop CMPS14 (which is also based on the BNO085) or a RPI running an open-source autopilot called pypilot, which uses more traditional methods such as Kalman filtering on an older IMU to get high accuracy. This one is fixed to the boat so I can compare the readings.

I haven't had enough run time to determine whether the dual compass setup is comparable to the Honeywell rotation sensor mounted under the mast. If anyone is curious I will report back when I get more data. Everything is going into InfluxDB on the Pi.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.