Anemometer, Windvane and Raingauge - 3D Printed and ESP8266 Enabled. Internet Connected and Logging.
by wt29 in Circuits > Microcontrollers
2120 Views, 9 Favorites, 0 Comments
Anemometer, Windvane and Raingauge - 3D Printed and ESP8266 Enabled. Internet Connected and Logging.
STL files are available in the STL folder of the Github project.
This is a 3D printed, Internet-connected (logging) anemometer (wind speed measurement device), Rain Gauge and Wind Vane
It features a Wemos D1 Pro ESP8266 device contained in a separate Electronics Box. All components are designed to clamp on a 25mm (1") mast. The Pro version is used as it has an external antenna which makes WiFi connection simpler. If you have good Wifi at the site where you are locating this a Wemos/Lolin D1 R2 should be sufficient
The D1 monitors the sensors in the 3 components and uploads to an EmonCMS cloud instance. The D1 also presents a local web server for querying directly from your local devices (phone, laptop etc). Full code for the D1 is provided at https://github.com/wt29/anemometer. The STL files are also loaded there in the STL folder. The sketch is also "OTA" (Over The Air) update enabled. Once connected to your WiFi network, you can modify the sketch and upload it without needing to remove the devices from the pole.
I've printed all these components in ABS on an Ender 3 V2. I haven't tested PLA but suspect that the UV and heat resistance wouldn't be sufficient.
I use 4G x 20mm screws to hold clamps on with 2G x 10mm screws to hold the tops on the 2 electronic boxes/
Supplies
- Wemos D1 - Lolin store on Alibaba or local suppliers
- 4 x 4mm ID x 8mm OD x 3mm high bearing. Ebay - these are common hobby grade bearings
- 4mm rod x 25 mm long. Ebay
- 2 x 3144 Hall effect devices - these are about $5 for 10 on Ebay
- 1 x 10K Ohm 1/4 watt resistor as a pull-up resistor for the Hall effect device.
- 3D printed components as above
- Miscellaneous wire for hook up, a short piece of heat shrink, and zip ties. Soldering iron and skills.
- Super Glue to glue the Hall effect into its slot.
- 4G x 20mm screws to hold the clamps together.
- 2G x 10mm screws to hold 2 lids on.
- 5V power supply and cabling to pole.
Assembly
Anemometer
The anemometer utilises a 3144 Hall Effect sensor and 2 x 5mm x1mm magnets in the rotor.
There are 8 3D-printed components.
- Rotor arms - 3 of these needed
- Rotor - holds the arms, 2 support bearings, and 2 small rare earth magnets.
- Rotor Cap - snaps on and covers the top bearing
- Base Cap - holds the 4mm shaft and the Hall effect device. Snaps onto the base
- Base - holds the Wemos, and supports the base cap and rotor assembly. Holds one side of the clamp
- Clamp outer - the other side of the clamp assembly
Everything just snaps together with the exception of the 2 clamp screws which self-tap into the clamp fixture and the Hall effect device which is super-glued into position. Assemble the 3144 Hall effect sensor into the base cap first. The sensor has 2 bevels marked on the front. We are exposing the back of the 3144 to the magnets in the rotor. Solder 3 fine wires onto the 3144. These should be different colours if possible. Place a small length (about 12mm) of heat shrink onto the centre terminal and offer the 3144 and the wires up to the base cap. Bend the leads of the 3144 close to the body so the 3144 sits flush, in its recess, into the base cap. Glue it in place. I used some ordinary superglue which seems to work well.
Once the glue is dry, route the signal & power leads out the hole in the base and connect the 3 leads to the Wemos D1 using the diagram above. Don't forget the 10K ohm pullup resistor and the power input leads. Although the Wemos is a 3.3V device, it seems to tolerate the 5V 3144 OK. If you are nervous about this, you can use a small 2-resistor divider combination to cut the pulse size and pull up the output of the 3144.
There is a cutout provided in the arm to hold the wires. Secure with small zip-ties.
Before you push the magnets in, follow the instructions in "Final" and flash the Wemos with the sketch. Check the correct polarity of the magnets by moving them across the 3144 and check that the onboard LED flashes as you do. The 3144 is polarity sensitive. The bearings and magnets then just push into the rotor and shouldn't need any support. The shaft also simply pushes into the base cap.
The rotor arms just push into the rotor. If they are a bit tight, sand them lightly until you have a snug fit. You might like to use superglue however my prototype didn't. Mount the rotor on the shaft and check that it spins without drag. It might need a small 4mm washer or two on the shaft to ensure clearance.
Wind Vane
The wind vane has 7 3D components, 4mm ID bearings and a CJMCU-103 single electronic device. The 103 is about $2 on AliExpress.
- Vane
- Rotor support
- Shaft
- Electronics Box
- Box cover
- Support Rod
- Outer clamp
The sensing element is a CJMCU-103 rotary angle sensor. It is essentially a rotary potentiometer. It is driven by the vane/shaft and connected to the D1 via a limiting resistor to an analog input. Once the D1 knows the orientation of the supporting rod (due North is recommended) it can transmit the actual direction of the vane.
The Support Rod is screwed onto the electronics box as I didn't want to have to print supports inside the box. It can be printed on its back to eliminate this.
The shaft can, if you wish, be a 4mm steel rod with a notch filed in one end to engage the CJMCU however, I've found that the 3D printed one is adequate.
Assemble by pushing the bearings into the electronic box. Put the vane into the rotor and then push the shaft in to locate it. Mine didn't need any glue. Your mileage may vary.
The CMJCU is wired to the D1 with 3 wires
- Ground
- Power
- Signal
On the D1 end, use a 10K pullup resistor connected between the signal (A0 on the D1) and 5V. To calibrate this there are a couple of value in the data.h which needs to be set.
#define WINDVANE
// Use the "VaneCalibrate.ino" Sketch to get these values
#define WV_ANALOG_MAX 557
#define WV_ANALOG_MIN 19
#define WV_ROD_OFFSET 70 // actually a combination to the zero on the VR and the actual orientation
These values can be derived using the .ino at https://github.com/wt29/VaneCalibrate. Download this and load into the D1. Start a Serial Monitor and swing the vane slowly around by hand. It will write out the MAX and MIN values. Transpose the Max and Minimum values back into the data.h as above.
Rain Gauge
The rain gauge is a "Tipping bucket" design and uses a 3144 Hall Effect sensor with a 5mm x 1mm magnet in the bucket. It consists of the following parts.
- The bucket - the bit that tips
- The barrel - caches the rain into an internal funnel for dropping into the bucket.
- Frame - this holds the bucket and 3144 device. It screws into the bottom of the barrel with 4 x 2G screws
- 2 Clamp inners - screwed to the barrel. I make these seperately as I couldn't figure out how to print these directly on the barrel without excessive support material. They hold on with 2G screws
- 2 Clamp outers - screw to the inners 4 x 4G x 20mm screws.
Assembly is easy. Wire and attach the 3144 to the frame using the same method as in the anemometer above. Again, the "back" ( not the face with the chamfers) faces the magnet. Push the magnet into the recess on the bucket. The bucket just sits in the 2 U shaped rails on the inner sides of the frame. Once the frame is screwed to the barrel, the bucket is trapped and shouldn't fall out easily.
Wire the RG to the D1. The signal cable connects to the D5 pin but, like the Anemometer, you will need a 10K pullup resistor to the +5V pin.
Screw the 2 clamp inners to the barrel.
Final
ownload the anemometer.ino sketch and start the Arduino IDE. Configure for the D1 and flash the Wemos with the "anemometer.ino" sketch from the git repository. If you cannot see the "LOLIN(Wemos) D1 R2 & Mini" in the boards, open File, Preferences, and add http://arduino.esp8266.com/stable/package_esp8266... to the "additional boards" dialogue. Restart the IDE and it should then load and add LOLIN(Wemos) boards to the Arduino boards manager. The Wemos can be configured, scan and connect to the strongest WiFi Access Point (AP).
The sketch also requires a "data.h" file in which details which of the 3 sensors you are connecting and your WiFi access. The sketch uses the "WiFiMulti" library which allows the D1 to connect to the strongest signal. Note: the Access points and passwords are cAse SenSitiVe. It also contains your "API Write key" to update EmonCMS. An example of the data.h requirements are in the comments at the top of the sketch
You will need an EmonCMS account to log output. This can also be a local instance but that is beyond the scope of this instructable.
The sketch also configures a small web server so you can query the devices locally.
To mount the devices, you will need a length of 25mm aluminium pole. Use 4g x 20 mm screws to secure the devices using the clamps. Another alternative is to delete the external clamp and use screws to mount the base directly to timber such as your barge board. Run your power leads to the base of the pole then out to your chosen power supply. You could use a 2S LiPo cell however it will need a "buck" regulator to bring the Wemos input voltage to down to 5V.
Power it up and you should be able to see the webserver. You may need to get the IP address of the device from your DHCP server on your local router.
Note: the anemometer is not calibrated. It returns "revolutions per minute) (RPM). If you need it in km/h, m/s or some other measurement you will need a handheld anemometer and then apply a correction factor to your feed in either the sketch and/or your EmonCMS instance. I've attached a graph of mine logging to EmonCMS.