Introduction
Since I started with the studies of Arduino and the Maker Culture I have liked to build useful devices using junk and scrap pieces such as bottle caps, pieces of PVC, drink cans, etc. I love to give a second life to any piece or any material. A large part of the materials used here are scrap removed from some equipment and recycled
When I started a project of a weather station for my own I realized that the measurement of the intensity and direction of the wind would not be very easy or cheap. After several months I present to you this project that uses mostly recycled materials and very cheap electronic parts easily found in any electronic store.
This post has 2 parts.
Part 1 - Construction of the devices Anemometer and Wind Vane Direction.
Part 2 - The sketch using Arduino IDE for Esp8266 Nodemcu and transmission to ThingSpeak .
See the video to know the final solution.
How to build your own Anemometer using Hall Effect Sensor and Reed Switches
Project description
The anemometer is a device capable of measuring the wind speed and its direction. Using a Hall Effect sensor we will be able to count how many rotations the cups give in a period of time. The intensity of the wind is proportional to the speed of rotation of the axis. With some simple physics equations, you can determine the linear velocity of the wind, at that moment. We will explain all of them in part 2.
And the direction of the wind we will measure through a windshield with a neodymium magnet and reed switches. The vane points in the direction of the wind and the magnet attached to it will connect the reed switches allowing the electric current to pass through the connection (or connections). Circuits that have positive current indicate the direction of the wind, like a compass.
We have 8 circuits that will emulate 16 directions : 4 cardinal and 4 collateral points when 1 switch is activated (N, NE, E, SE, S, SW, W, NW) and when 2 switches are activated simultaneously we have 8 sub collateral points (NNE, ENE, ESE, SSE, SSW, WSW, WNW, NNW).
The wind speed and direction will be calculated and determined by a sketch in the nodemcu. But this will be explained in part 2. Now let's go to the hardware assembly.
Disclaimer: This anemometer should not be used for professional purposes. It is only for academic or home use.
Note: English is not my natural language. If you find grammatical errors that prevent you from understanding the project, please let me know to correct them. Thank you so much.
8 x Reed Switches
8 x 10 k ohms resistors
10 cm PVC pipe
2 PVC caps 5 cm diameter
1 PVC cap 2.5 cm diameter
1 CD4051 Analog Multiplexer
1 plastic disk
20 x 20 strong plastic piece
1 Neodymium magnet (The dimensions of the magnet must allow two switches to be connected simultaneously. Mine is 0.5 x 0.5 cm and it is doing well.)
10 different colors wires
1 Generic PCB
1 ball bearing with the same diameter of the aluminum tubes
1 aluminum tube approx 20 cm
1 aluminum tube approx 10 cm
1 hose clamp
Epoxy Mass
Instant Glue - cyanoacrylate and sodium bicarbonate
2 Ping pong balls
4 wooden or aluminum sticks approx 12 cm
1 ball bearing
1 aluminum tube approx 5 cm
3 pieces of wires different colors
1 hall sensor SS49E
1 neodymium magnet
Epoxy Mass and Instant Glue - cyanoacrylate and sodium bicarbonate
2 plastic taps approx 3 a 5 cm diameter
1 PVC cap and 5 cm PVC pipe
1 PVC cap 2.5 cm diameter
Reed Switches and Resistors mounted on PCB
Cut the generic PCB in the form of a circle with a slightly smaller diameter than the PVC CAP because when it is ready it will be fit into it.
Bend the legs of the reed switch in 90 degrees to fit them into the PCB with care so as not to break the protective glass. The ideal is 3 mm away from the glass. Fit each reed switch according to the diagram. Number each from 0 to 7 as the diagram. Correct identification will be important when connecting the terminals to the multiplexer. Use the soldering iron to solder them on the plate.
Position each resistor as the diagram in which one of the terminals is soldered in one of the terminals of the reed switch and the other will be common to all the resistors, positioned in the center of the PCB.
Solder a copper cable that connects all the external terminals of the reed switches, leaving the last two without connection. Like a ring. The welding order does not matter.
At the junction of each resistor and the reed switch solder wire of each color. They are 8 different. Solder a red wire to the copper ring of the reed switches as a positive and a black wire to the junction of all the resistors in the center of the "rosetta", as a negative.
Look at the diagrams and be careful to keep the numbering of the cables for connection to the multiplexer.
Test the connections before assembly.
Before proceeding with the assembly I suggest testing the connections. Use a led, any 18650 battery 3.7 V, a neodymium magnet and cables with crocodile claws. Connect the battery to the terminals VCC and GND and the crocodile cable in the GND with the other end in the negative of the led (use a blue one that does not need a resistor). Connect the other cable to the positive of the led and the other to each cable connected to the switches. Now pass the magnet through the outer edge of the connected switch. If the led lights up, it is ok. If it does not turn on, check the welds. To test two connections at the same time use another cable and another led simultaneously. When passing the magnet between two switches, the two LEDs should light up. It is essential that both LEDs light at the same time so that the electrical signal can represent sub-collateral points of the compass such as ENE, ESE, SSW, NNW, etc.
CD4051 Analog Multiplexer
Multiplexers are combinational circuits with several inputs and single data output. They are equipped with control inputs capable of selecting one, and only one, of the data inputs to allow their transmission from the selected input to said output.
If you do not know the operation of the CD4051 I recommend reading the datasheet that you can find on the web. In summary, the 4051 has 8 analog inputs numbered from 0 to 7, 3 and pins A, B, and C that combined allow to read the inputs and define which analog output is being connected. At each reading, the software analyzes which connections are with positive current and will indicate the corresponding direction of the wind. This will be explained in detail in part 2 of the post. Look at the diagram to see how the rosetta is connected to the multiplexer.
Connections to Nodemcu
We will need 8 cables to connect the Nodemcu. See the diagram.
1 pair of positive (red) and ground (black) wires that supply current to the rosetta
1 pair of positive (red) and ground (black) cables that supply current to the CD4051
1 cable for analog output A0 (gray)
1 cable for digital input of pin A = D5 (blue)
1 cable for digital input of pin B = D4 (green)
1 cable for digital input of pin C = D3 (yellow)
I used a 10-wire telephone cable of different colors to facilitate the final assembly.
Identify each of the cables with their corresponding address to facilitate the final assembly.
Mounting the support
Take the CAP of 5 cm diameter of PVC, a piece of PVC tube and the CAP of 2.5 cm in diameter and glue them all with instant glue according to the photo. You can also make a hole with the diameter of the tube to improve the connection between the pieces. After all the pieces are glued apply more glue on the glued edges of each piece and immediately cover with baking soda. When drying the glue you will have very good hardness.
You should also stick the silicone on the edge of the CAP that will allow to seal the union between the 2 CAPs and facilitate the fitting of the rosetta. Let them be dry before continuing.
Carefully insert the rosetta already mounted on the support piece and that it fits snugly against the edge of the CAP. Remember that we will mount a second CAP above this. Look the photo with the final solution. And please identify each of the cables to facilitate connections with the nodemcu.
Mounting the structure of the vane
Make a pointer with epoxy mass with the shape shown in the photo. When it is properly dry weigh the piece and save the value.
Take the piece of plastic and cut it symmetrically for the back part of the vane that serves to direct the wind. Weigh also and save the value.
Take one of the aluminum tubes and stick the pointer and the weather vane with instant glue with all the pieces lined up in the middle. Do the same as you did before with baking soda to increase the hardness of each of the glued parts.
Take the second aluminum tube and let's determine where it will be stuck in the other tube. To maintain the equilibrium of the piece, the distance by the weight of the back should be equal to the distance by the weight of the pointer. (See calculations that are shown in the diagram.) Distance measurements should be done more or less to the mass center of each piece. Use instant glue and baking soda.
Make a hole in the center of the CAP with the diameter of the ball bearing. Use instant glue to stick it on the lid. Important to choose the ball bearing that has the same internal diameter of the vertical aluminum tube of the vane.
Finally, take the plastic disk with an approximate diameter of 4.5 cm and stick a small piece of metal on the edge. See the photo In this way you will be able to "stick" the neodymium magnet and adjust it when you calibrate the instrument. It can be moved in several directions to guess the readings of the measurements.
Position the plastic disk with the metal part stuck in the same direction as the horizontal aluminum tube pointer. This is important for the magnet to indicate the same direction as the vane.
To facilitate the final assembly of the anemometer and align the north of the vane with the north geography print a wind rose and paste on the top cap of the CAP. The disc will be stuck in the aluminum tube, but first, insert the aluminum tube into the ball bearing and insert the aluminum tube into the disc. Adjust the height so that the distance between the magnet and the edge of the CAP is between 1 and 1.5 cm. That must be enough for the magnet to correctly connect the reed switch. Stick the disc with instant glue and calcium bicarbonate as horizontal as possible.
Mount the two pieces by directing the north of the wind rose aligned with the switch number 0 (representing the north) and use a clamp to join them. Do not use glue because you will have to fit and calibrate many times before being totally ready.
Look the photos to see the final solution.
Mounting the support
Take the 2 plastic lids and stick with instant glue. Drill 4 holes in the lids as shown in the diagram. Stick wooden or aluminum wands in each hole. Cut the 2 ping pong balls in the middle and stick each one on the extremities of the rods, all with the concave part for the same side. The approximate measurements are shown in the diagram.
Make a hole in the center of the CAP 2.5 cm with the diameter of the ball bearing. Use instant glue to stick it on the lid. Use baking soda as well very carefully.
Insert the aluminum tube into the ball bearing at a compatible height (see photo). If it is not properly adjusted, put a glue drop carefully.
Mounting the Hall Module
At the edge of the CAP, make a small hole in order to pass the head of the Hall sensor.
Glue the neodymium magnet to the side of the plastic caps according to the photo.
Use the 3 different colored wires to connect the sensor module.
Insert the Hall module and point the sensor facing the magnet at a distance of 2 to 4 mm. Test if the rotation of the shaft does not hit the magnet with the sensor.
Use a 3.7 V battery to test if the module responds to the approach of the magnet by turning the led to each contact. If the led turns on, everything is ok. If not, move the sensor closer to the magnet until the LED turns on.
If everything is ok, fix the module in the support using a glue drop.
Finally, the other end of the rod will be stuck in the plastic lid with instant glue and baking soda, adjusting the correct height.
Identifying the wires
Identify all the cables - VCC, GND, and Signal - to facilitate the connection with the nodemcu.
Now you can mount the two devices together using the "T" connection and a piece of PVC tube as shown in the photo. Do not use glue because if there is a need for some adjustment or maintenance it will not be possible. I made small holes and used screws to keep them tight. Pass the cables of the 2 devices through the tube.
As the anemometer will be installed on the roof of the house, I also made 3 meters cables to connect it to the nodemcu that will be installed indoors.
The diagrams show the correct connection of each cable.
To test the operation I used a 0.96 "OLED screen to read the measurements and verify that they are correct, connect the OLED in this way:
D1 - SCL
D2 - SDA
VCC and GND
To install on the ceiling the only care is to keep the whole device at the correct level. For that use a bubble level and many large screws. And do not forget to address the north of your anemometer for the geographical north of your compass. Otherwise, the direction of the wind will not correspond to reality.
And that's all. In the next post, I will explain the sketch to be loaded in the nodemcu using Arduino IDE.
If you have any doubt, do not hesitate to contact me.
Regards