I was thinking about openwave again recently and have started making moves to give it a go again.

The short version of the project is this:

- Ocean wave sensors are placed on ocean data buoys to measure wave height and direction
- The hardware these sensors use is very inexpensive. The PCB with all the parts assembled costs around 50 euros depending on volume of the order.
- The magic sauce is in the algorithm
- Algorithm hard, lots of maths, Shane bad at maths

So yeah basically the reason I gave up last time is the maths got too hard for me basically. But now ChatGPT exists so it will be interesting to see if I’ll be able to use it to get this going.

So far I’ve got a borrowed ESP32-S2 TFT Feather board hooked up to a BNO055. I’ve got code working that can record linear acceleration at a set sample rate and duration. This then gets saved to a file on the ESP32 flash that I can then access by connecting it to my computer via USB. I’ve got about 2MB of flash which with my sample size should let me sample at 0.2ish Hz for around 15-20 minutes which is just what I want.

I’ve also bought this linear rail from openbuilds.com

This will be mounted vertically and let me move the accelerometer up and down . I think the trick to solving this is to know what the input displacement is – this way I can actually verify any algorithms I test out.

## The Plan

It’s not possible to re-create the input displacement data exactly. Lets take some example ocean waves, say we had this combination of waves:

- 25 second period (0.04Hz) , 0.5 meter wave
- 15 second period (0.06Hz), 0.3 meter wave
- 7 second period (0.14Hz), 0.2 meter wave

The algorithm is just looking at acceleration data and from that it should be able to tell me that the wave has a 0.04, 0.06 and 0.14Hz component and also give me an idea of wave size at each component. The wave periods being so long is why we need like 15-20mins worth of data to perform the analysis on. Any less and the sample size is too small.

Some of the output parameters I’m interested in are:

- Significant wave height (take the highest 3rd of waves and get their average value)
- Direction data – this is a goal for after I get significant wave height working. It will also require updating my linear rail rig to also tilt the accelerometer. This direction data will let me produce wave rose diagrams like this:

Significant wave height is a nice starting point because it should be the easiest of the parameters to calculate. (not saying it is easy)

Also if you are going out on a boat and want to know if the waves are too high or not. Significant wave height is a good indication of how high the waves are so the sensor would have some utility with just this measurement alone. To really compete with actual commercial wave data sensors I will need direction data also.

You would need wind sensor real-time data. You would need to tilt compensate wind data from real time IMU data.

Same as with compass.

Tilt (attitude) is itself product of Kalman filter which gives you attitude quaternion and Euler angles. IMU only measures 9 dof 3D magnetic field, 3D angular velocities, 3D accelerations.

For waves directions you might consider adding more parameters to Kalman filter

like wind reading, 3D accelerations, angular velocities.

You would also need fast Fourier transform to find out waves frequently to use it as reference point to give Kalman integration filter initial velocity and speed to converge better. You can get it from trochoidal waves model.

Also buoy will have a drift through water due to windage which needs to be accounted for.

Accelerometer needs to in center of buoyancy of buoy.

Also accelerometer is kind of noisy (high frequency) so there is need for some kind of low pass filter.