# Smart Buoy — Making Wave and Temperature Measurements 🌊🌡️

Mar 13 · 4 min read

This Smart Buoy series charts our (ambitious) attempt to build a scientific buoy that can take meaningful measurements about the sea using off-the-shelf products. This is tutorial one of four. If you need a swift introduction to the project, check out our summary.

In this tutorial, we show you how we took wave and temperature measurements on our Smart Buoy.

# Supplies

• Arduino Nano — Amazon
• GY-86 (accelerometer, gyroscope, barometer, compass) — Amazon
• Water Temperature sensor — Amazon

# Tutorial 🤖

## Accelerometer & Gyroscope

The main sensor on the buoy is a GY-86, which contains the MPU6050 accelerometer gyroscope, the HMC5883L Magnetometer and the MS5611 barometer. These sensors enable us to measure air temperature, wave height, wave period and wave energy (and wave direction if someone out there is smart enough to help us with the maths).

The GY-86 communicates via i2C — see the schematic. This is the code we used to access the accelerometer and gyroscope readings.

## Magnetometer (Compass)

The GY-86 contains a magnetometer which we used as a compass. You don’t need to change any connections — woo! The code to get the compass value is available below.

Remember to use the value of declination specific for your location, otherwise your results may be inaccurate.

## Barometer and Temperature

Here’s how to get the values from the MS5611 barometer.

## [Crude] Wave Height

Once all those sensors are set up, you can use them to measure wave properties, starting with wave height…

The altitude of the Buoy can be calculated using air pressure. We used the relative altitude of the Buoy over a time period to work out the wave height like this:

## [Crude] Wave Period

Next, wave period. We used airy wave theory — a lovely basic wave theory which says that water surface waves can be described as sine waves. It’s great to use because it makes the maths easier, but it is of course a simplification and does have certain caveats, including that it is inaccurate in shallower water where waves transform and break.

Using the midpoint between our maximum and minimum relative altitudes and finding how frequently the Buoy crossed this point, we figured we would be able to get a value for wave period.

## Wave Direction (HELP!)

We never actually managed to measure wave direction.

However, the sensors aboard the Buoy should be able to do it. It is possible to measure dynamic accelerations with the GY-86 Accelerometer by subtracting the affects of the gravitational force. It is also possible to get the direction of this acceleration. Using the direction of Buoy acceleration, along with the compass value for a given position, should allow you to determine wave direction. We gave it a go in the code below.

If someone out there could help us with this it would be amazing ❤

## [Crude] Wave Energy

One way of defining wave energy is using this friendly equation:

Using our values for wave period and height, we are able to calculate wave energy like this:

## Water Temperature

Finally, we wanted to be able to measure water temperature. The DS18B20 water temperature sensor protrudes from the bottom of the Buoy into the sea and the Arduino communicates with it using 1-wire.

The only modification we made was adding a pull-up resistor on the signal wire, and then we were able to talk to it like this:

Thanks for reading this tutorial, this has been the first step in building our Smart Buoy. Buckle up for the next tutorials!

We hope you enjoyed this article. If you like the style, check out T3chFlicks.org for more tech-focused educational content as well as all the fun stuff we do on YouTube (Instagram, Facebook, Twitter).

## Nerd For Tech

From Confusion to Clarification

## Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Written by

## T3ch Flicks

A tech focused education and services company. Find us at https://t3chflicks.org.

## Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.