Software apps and online services
Use the Sugar Grayscale sensor to detect the sticker marked with 8 gray scale intervals, and judge the current wind direction according to the different marked positions where the arrow stays.Hardware
- Micro:bit V2 * 1
- SugarBox Expansion Board * 1
- OLED Module * 1
- Sugar Grayscale Sensor *1
- Mini Compass
- 3D Printed Part
- Building Blocks
First, a piece of paper with a gradual change from white to black is made and fitted on the parts of the rotating shaft. At the installation place of the structure, the gray module can detect the intensity of light irradiation return, and judge the general position according to the intensity.
In the local area, first define the standard azimuth of the four positions, and then dial to each position by hand. At this time, record the reading value of each gray sensor, mark the corresponding position by oneself, and then fill in the value in the program.Due to the different position of each person, the values may be different. Take my model as an example, the values of each Angle are as follows.
From these values, we can roughly judge the wind direction.The values in the pictures are only for demonstration and may not be suitable for everyone.Step 3: Program task
Calculate the value by oneself, write the wind direction program, and display the value of gray sensor in real time on the OLED screen.
Determine the wind direction every 0.5 seconds according to the value (just mark East, South, West and North)Step 4: Task resolution
①The program's pins and screens are initialized first.
②Real-time display grayscale tracker sensor value.
③The wind direction display is refreshed every 0.5 seconds, and the absolute value is calculated according to the measured value in advance. Certain errors are allowed when judging the wind direction.If the value is not in the range, the wind direction is not displayed
Since the principle is based on grayscale detection rather than magnetic field detection, it cannot be moved arbitrarily. It is recommended to first find the desired placement location, then use a compass to calibrate the direction, and adjust the corresponding direction of the grayscale return value.
Here, for demonstration purposes, only recognition for 4 directions has been implemented. In reality, the color wheel has 8 grayscale intervals, allowing for the recognition of 8 directions in total.