This is the second version of my windvane.
First version still available here : https://github.com/fguiet/windvane
This one has 2 majors improvements:
- New waterproof top design
Now it includes nuts and bolt to tighten the shaft very hard.
- Use an optical method to encode
We are going to use an optical method, a perforated disk which rotates between leds and phototransistors. Each time a phototransistor is lighted by the opposite led, it becomes conductive. We associate bit 1 with the conductive state and bit 0 to the blocking state of each phototransistor.
We therefore need to arrange the phototransistors and the holes on the disk so that we can encode a maximum of positions in a minimum of space. It so happens that a given Bruce Spedding imagined a method, later improved by Alain P. Hiltgen and Kenneth G. Paterson, called "Single Track Gray Code". This method presents two noticeable features: first, generated codes differ only from one bit from one position to another. This is the principle of Gray codes, and this limits the risks of reading errors for intermediary positions. Second, the sensors are located on the same circular track, which enables us to build very compact encoders. The price to pay is that the number of codable positions is smaller than 2n. For example, with 5 phototransistors, we can encode only 30 positions. This provides a precision of 12°, which is largely enough when we need to determine wind direction.
Electronic spare parts needed :
- 3.7v Lithium battery (1000 mAh)
- Solar panel 5V, 110x69mm, 1.25W
- Lithium battery charger module TP4056
- ESP8266 12E
- Home made voltage divider with 2 resitors 51KOhm and 15kOhm
- Solar panel
- XH2.54 connectors
- 30 AWG (0.08mm) silicon wire
- Bearing 608ZZ
- Some resistors
- Some nuts and bolts
- 5 yellow LEDs
- 5 TEPT 4400 phototransistor
- Mosfet 2N7000
- Low Drop Out voltage regulators : HT7333-A (TO92 and SOT89). One for the ESP8266 and one for the leds and phototransistor
- ESP8266 Shield
- Mini on/off switches
- 10uF capacitors
- Rod 8mm diameter
- Brass Hot Melt Insert Nuts
Electronic datasheet is available, here : https://easyeda.com/fguiet/windvane-v2
ESP8266 shield
Careful : the "diode" in the middle should be removed...otherwise vcc is directly connected without going through the voltage regulator !
Minimal pin configuration
- GPIO 15 : GROUND (the shield I am using has a 10k pull ground resistor build-in)
- CH_PC / EN : +3.3v (the shield I am using has a 10k pull high resistor build-in)
- GPIO0 : must be pull low to enter flash mode / must be pull high - I added a switch
- GPIO0 : must be connect to RST pin so deep sleep can work (I added a switch)
You can download STL files here : https://www.thingiverse.com/thing:4700240
- Around 140 mA when reading (65 mA ESP8266 + 75 mA led + photoresistors negligeable...)
- Around 140 uA when deep sleeping (I need to confirm that)
- Around 66 mA when ESP8266 is on and led and phototransistor are OFF
- Around ? when ESP8266 is on and led and phototransistor are OFF and module is connected to Wifi (I have to take this measure)
The device has a 10-bit ADC pin, which uses 0-1V range to convert the analog data to digital data. It may be used either to read voltage at ADC pin.
Using the HT7333-A low drop out voltage regultator. Maximum output 250mA, Dropout 90mV...Nice for a 3.7v lithium battery :) A 10 uF capacitor will be used to stabilize the output voltage.
Considering that one LED forward voltage is 2v and forward current is 20mA, we will need 5 resistors each of 69 Ohm (apply law Ohm here with 3.3v input voltage)
My Current Ranger reports a consumption of aournd 75-80mA ... 16mA per LED (we are not so far from the theory computed just above)
TEPT440 is a phototransitor. Its sensibility ranges from 440 to 800 nm (peak at 570nm).
To program the ESP8266, use a standard USB to Serial converter.
- Pull GPIO0 low via the red button
- Connect the USB to Serial converter - Don't connect Serial convert Vcc but use external power (battery)
- Connect RST pin to ground (in order to enter flash/program mode)
- Led disk holder
- Photoresistors holder
- Measurement current consumption
- Optical encoder in place
- Assembled windvane and PCB ready to be connected