Going to go dig in my old PC drawers tonight and see what i can dig up, was planning on a DC brushless fan motor but could not get it to give me anything usefull, perhaps a DVD/CDrom motor may also work.
Going to go dig in my old PC drawers tonight and see what i can dig up, was planning on a DC brushless fan motor but could not get it to give me anything usefull, perhaps a DVD/CDrom motor may also work.
DC brushless fan motors often have tachometers. The tachometer is open-collector (you MUST have a pull up), and is powered by the + input.
If you want to use a DC brushless fan only for its bearings and tachometer:
Take the label off the motor (on the hub)
Remove the snap-ring off the shaft to allow the rotor to be removed
Pull off the rotor (blades)
CUT one wire on each of the windings (there will be 4, 6 or 8). This will prevent the fan from running.
Re-assemble
GND the BLACK wire
Put a 2.2K resistor from the TACHOMETER wire (usually white, yellow or blue) to 5V
Connect the RED wire to 5V
Use the signal on the TACHOMETER wire. It will be 5V p-p. and will give 2 cycles/revolution. The duty cycle may not be
exactly 50%. If you use PULSIN you should measure a LOW half-cycle and a HIGH half cycle and add them together.
I suppose if you had a big enough fan, you could use it to measure wind directly. It won't start
spinning in a gentle breeze, however.
Charles Linquist
Anemometers may be constructed by a variety of means. I have made them from cups, propellers, and pendulums (hanging and inverted). My favorites are the pendulums for their simplicity and ability to give direction as well as speed. A 2-axis accelerometer gives tilt numbers, is easily calibrated, and is without the need to count pulses. The “X”, “Y” offset ratio makes wind direction clear with near infinite resolution. My first pendulum was inspired by finding an old copper toilet float at a garage sale! Inside I put a Memsic 2125 (http://www.parallax.com) and left it hanging from a gimbal, so that it would not rotate and give erroneous direction. Later, I built one with a transmitter and a compass inside a large plastic egg (16” tall) for my R/C flying club. It was set on a table, or directly on a smooth ceramic floor tile near the runway–though not so accurate it was a sturdy unit that may still be in use today. It took only a moment to calibrate itself and gave accuracy and direction akin to a windsock; the separate display could be located some distance away.
Were you interfacing the Memsic to a pic or into something like an Aurdino / Propeller / Stamp? I've used the 3-axis versions quite a bit in my Tri-copter build, but was hoping to interface to a PIC, for one thing they are a lot cheaper in SA and also easier to come by.
You Can use Hall Sensor
By read of North and South of the magnet it account 1 return for each turn of the shaft.
My Hobbies is PicBasic PRO
You could use the internal timer of the PIC to measure the time between pulses. I have done something similar to measure the frequency of an AC supply.
You dont need to use interrupts either just a loop waiting for your input signal. In fact not using interrupts might be better. You could sort out your calculations and displaying the result without worrying about being interrupted.Code:define OSC 40 INCLUDE "DT_INTS-18.bas" ' Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts 'set up timer T0CON = %00000001 '1/4 prescale fosc/4 not running (40MHz) TMR0H = 0 ;Clear registers TMR0L = 0 ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler INT0_INT, _ZERO, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE INT0_INT ; enable external (INT) interrupts goto start ZERO: 'we have just detected zero cross signal. 'first job is to sort out the timer @ bcf T0CON,TMR0ON ; Switch off timer period.lowbyte = TMR0L 'Record Result period.highbyte = TMR0H @ clrf TMR0H ; Reset registers to zero @ clrf TMR0L @ bsf T0CON,TMR0ON ;Start timer period = (period / 5) * 2 'Gives period value in microseconds @ INT_RETURN start: 'wait for interrupt to happen goto start END
You would need to set up the timer to give a useable range. I use the "PIC Timer Calculator" to do this, it makes things much easier.
You may need more than one pulse per revolution to give results at low wind speeds.
You may need to use the timer interrupt to flag if the timer has overflowed (got to 65535 & started counting again from zero) otherwise in very low winds you may not get a pulse before overflow, & the results would be wrong. If you get a timer overflow interrupt then you can say that the wind speed is zero.
http://pic-timer-calculator.software.informer.com/
http://darreltaylor.com/DT_INTS-18/home.html
Ofcourse this is all more complicated than using pulsein. But It is sometimes good to play around with more complex answers. It is the only way to learn new things. One month ago I knew nothing about using timers or Interrupts. Now it is second nature, and I wonder how I managed to get by without them.
Regards
Bob.
Bookmarks