Windmeter with smartphone sensor


Does anyone know an example on the internet of a smartphone anemometer with magnets (aia file)
Or how to start programming and how to use the magneto sensor
Measure wind speed and or wind direction
Who can help me please

Hai ,

who can help with the mobile magnet sensor in a smartphone
I want to read the rotation speed of a magnet above the mobile. Thank you in advance

Show us this magnetic device that uses the magnetic sensor from your smartphone.

Start from here:


The magnet device needs to be near the top of the phone/device

Here's a starter .aia for you, to show that your sensor is working ...

magnetic_strengths.aia (3.5 KB)

The data accumulated has relative time in the x axis, and the chosen magnetic axis strength in the y coordinate, for each of the 3 available sensor axes.

My test rig consisted of clipping a refrigerator magnet clip to a pencil, laying the phone flat, and twirling the pencil in my hand above the phone.

My graph was noisy, so it would make zero crossings hard to detect.

You may have to run your data through a Kalman Filter to smooth it first.

I remember some one on this board once mentioned one.

1 Like

Wind Magneet Meter
there are 2 options to place the magnets in the center and off the center
Made with my Vertex mini 3D printer

1 Like

When I try this with my windvane the counter goes to [0.00031,0.00031]
at start the data fluctuates [-154.98,288.84]
I just want to measure the speed
Dis it what i fond:
The formula for the RPM calculation depends on the radius of the magnet and can be as follows: RPM = (X^2 + Y^2 + Z^2)^0.5 / (2 * pi * magnet radius). The wind speed formula depends on the RPM and radius of the magnet and can be as follows: wind speed = RPM * magnet radius * pi / 30. And finally, the wind direction formula can be calculated by taking the arcsin of the ratio of Y and X, followed by a conversion to degrees.
But i don't know how to translate this in mit app inventor

Which way is the magnet pointing, N/S, you may need to turn by 90 degrees.

There are 2 separate magnets
Or else I should try this one this is a wind vane with a magnet in the middle
tried it but is the same as with the 2 magnets

RPM = Rotations Per Minute, right?

So where is the time factor in your calculations?

Before you convert anything, you need to check whether any data changes linearly with the increase in turnover. You need to find some dependencies, we won't do it for you, because we don't have such a device. We don't even know if something like this will work with the sensor in the phone. I think you are the first in this community who wants to use a magnetic sensor in this way.

magnetic_strengths.aia (6.8 KB)

This sample calculates cycles per second based on local peaks.
Multiply by 60 to get RPM.

My video is too big to upload, so I may need to stash it on the Web.
Video link:screen-20230510-141048.mp4 - Google Drive

(link corrected.)

This was done holding my phone up in front of my face, on its charger cable connected to one of my PC's front USB3 ports, midway between my face and my LED monitor, just sitting still.

Apparently, I have a magnetic personality.


The time factor is present in the calculations in two ways.
First, the length of time between the last and penultimate passage of the magnet past the sensor is used to determine the rotational speed of the magnet. This is done by the formula:
rotation speed = 1000 / (time difference between last and penultimate pass)
Here time is expressed in milliseconds and rotational speed is expressed in rotations per minute (RPM). This means that the shorter the time between two passes, the higher the rotational speed of the magnet and thus the higher the wind speed.

Second, the time between two measurements is used to determine the distance traveled between measurements. This is done by the formula:
distance = (velocity x time) / 3600
Here the time is expressed in seconds and the distance in kilometers. By measuring the time between two measurements, we can calculate the distance traveled by the magnet between these measurements. This allows us to determine the wind speed and direction.

1 Like

Thank you all already with the info
With the Vaavud android app this is possible, I already tried that, only you can not save the data ,but I would like an aia file myself to see how everything works in mit app inventor

I have asked ChatGPT this, but I do not understand how to write this correctly in mit app inventor, especially I do not know how to place the formulas

Here is a detailed step-by-step guide to writing an MIT App Inventor program that measures wind speed and direction using a magnetometer sensor:

Open MIT App Inventor and create a new project.
Drag a "Screen" component onto the screen and give it an appropriate name, for example "Measure Wind Speed".
Drag two "Label" components onto the screen and place them in a convenient location. Name one label "Wind Speed" and the other label "Wind Direction".
Drag a "MagnetometerSensor" component onto the screen and name it "magnetometerSensor".
Go to the "Blocks Editor" and drag a "When Screen1.Initialize" block onto the stage. This block is executed when the screen is initialized.
Within the "When Screen1.Initialize" block, add a "Set" block to set the magnetometer sensor values to zero (0).
Drag a "When MagnetometerSensor.MagneticFieldChanged" block onto the Stage. This block is executed when a change in the magnetic field is detected.
Inside the "When MagnetometerSensor.MagneticFieldChanged" block, add a "Set" block to store the values of the magnetometer sensor in three variables: "x", "y" and "z".
Drag a "Calculate" block to the work area and add the formula to calculate the total magnetic force: magnetic force = √(x^2 + y^2 + z^2).
Inside the "Calculate" block we just created, add a "Set" block to store the value of the total magnetic force in a variable, for example "MagneticForce".
Drag another "Calculate" block onto the work area and add the formula to calculate the wind speed: wind speed = magnetic force * magnet radius * pi / 30. You will need to enter the magnet radius you used to place the magnet on top of the phone. to place.
Inside the "Calculate" block we just created, add a "Set" block to store the wind speed value in a variable, e.g. "wind speed".
Drag another "Calculate" block onto the work area and add the formula to calculate the wind direction: wind direction = arctan2(y, x) * 180 / pi. Here the "arctan2" function is used to determine the angle between the y-axis and x-axis, and the result is converted to degrees.
Inside the "Calculate" block we just created, add a "Set" block to store the wind direction value in a variable, e.g. "wind direction
Drag a "Label1.Text" block onto the Stage and place it inside the "When MagnetometerSensor.MagneticFieldChanged" block. Set the value of the "Text" property of this block to "Wind speed: " + wind speed + " m/s". This ensures that the wind speed is displayed in the corresponding label on the screen.
Drag a "Label2.Text" block onto the Stage and place it inside the "When MagnetometerSensor.MagneticFieldChanged" block. Set the value of the "Text" property of this block to "Wind direction: " + wind direction + " °". This ensures that the wind direction is shown in the corresponding label on the screen.
Add extra functions if necessary, such as a button to stop the program or a timer to repeat the measurements at set times.
Test the program on your own mobile device and make sure it works correctly.
It is important to note that the accuracy of the measurements depends on the quality of the magnetometer sensor and the distance between the magnet and the sensor. To improve accuracy, it may be necessary to calibrate the magnet and/or sensor. This can be done using a special calibration app or program.

It is also important to observe safety regulations when working with magnets. Make sure that the magnet is not too strong and that it does not come close to sensitive electronics or magnetic storage media such as credit cards and hard drives.

This part sounds like it needs the orientation sensor?

The ChatGPT paragraph sounds very realistic.
(I voted for a Congressman like that recently, to my regret.)

But I don't see how you could get wind direction without a weathervane in addition to the speed whirlygig.


1 Like

I had this in mind and now found it on the internet

It's about halfway through the magazine
It is in Dutch maybe you can translate it with google
It's a hardware project but it's the principle that counts that might be useful for the project
But first start with an ordinary anemometer

Can someone translate ChatGPT's story into mit app inventor please , or partially especially the formulas and such
Seems like a great and educational project to me

To measure wind direction with your phone:

Place the phone in a plastic sandwich bag to protect it from the rain, opening downwards.
Staple the bag at the bottom to stop the phone from falling out.
Insert a long pencil or dowel into the bag to the side of the phone, to form a handheld flag.
Raise your flag, dowel perfectly vertical, and let the wind turn your bag flag freely.
Set your phone to record its Orientation Sensor readings along with the Clock.SystemTime for each reading into a global table.

At end of run, convert the global table to CSV and save it to a File, with an appropriately formatted file name built from the first reading timestamp.