ThingSpeak IoT Weather Station Update

About four years ago, I published a post on reading meteorological data from a Netatmo weather station. Since then, Netatmo has changed the authentication process. Here is an update of my MATLAB scripts for the weather station.

Reading meteorological parameters through a weather station connected to the Internet has gained great popularity. We use the inexpensive and very popular Smart Weather Station from Netatmo in this experiment. The experiment, first published here on my blog, later also in Chapter 8.6 of my book “Signal and Noise in Geosciences” (Trauth 2021) achieved great popularity among my readers.

Unfortunately, the manufacturer deprecated the client_credentials grant type (username/password) in October 2022. Since then you must implement the authorization_code grant type to authenticate. In addition, the Netatmo website gets explicit user’s consent at least once when generating tokens to access the weather station, which makes it even more difficult, but not impossible, to generate tokens via a MATLAB script.

This is achieved by logging in to the website to generate an access token and a refresh token. We use the refresh token because the access token loses its validity after about three hours. Below is a downloadable zip file containing the updated versions of the three scripts from Chapter 8.6 of the book, both for accessing the data via MATLAB Desktop and via ThingSpeak.

Download MATLAB Script to be used with ThingSpeak and to be used with MATLAB Desktop.


Trauth, M.H. (2021) Signal and Noise in Geosciences, MATLAB Recipes for Data Acquisition in Earth Sciences. Springer International Publishing, 343 p., ISBN 978-3-030-74912-5