measuring wind speed using optocoupler sensor (anemometer)

Support, advice and resources for the Raspberry Pi Oracle Weather Station for schools
ilman
Posts: 22
Joined: Wed Mar 08, 2017 5:08 am

measuring wind speed using optocoupler sensor (anemometer)

Postby ilman » Mon Mar 20, 2017 6:48 am

hello, i have a project to build an anemometer using raspberry pi. sensor that i plan to be use is optocoupler sensor. i've read a lot of references but all heading me to arduino. could somebody tell me about a python script to use optocoupler sensor in my case. i really appreciate to your answer. :)
Attachments
sensor-anemometer.jpg
this is the hardware
sensor-anemometer.jpg (34.96 KiB) Viewed 825 times
User avatar
DougieLawson
Posts: 28456
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact:

Re: measuring wind speed using optocoupler sensor (anemomete

Postby DougieLawson » Mon Mar 20, 2017 7:45 pm

https://github.com/raspberrypi/weather- ... _daemon.py
https://github.com/raspberrypi/weather- ... _client.py

The daemon counts ticks on GPIO05 with a 9cm anemometer which I think does two ticks per revolution.

The client program gets the data from the interrupt daemon.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.
willip5
Posts: 59
Joined: Wed May 29, 2013 11:55 am
Location: France

Re: measuring wind speed using optocoupler sensor (anemomete

Postby willip5 » Mon Mar 20, 2017 7:51 pm

Can you post a link to the data sheet for this item, it looks quite interesting. An optocoupler is essentially an electronic reed switch probably driven by a coded disk of some kind. If the output is a series of pulses then it will just mean a slight modification of the Python script used for the RPi Weather Station.

The Vaisala WAA151 outputs 14 pulses per revolution rather than the 2 pulses for the Maplin item.

Pete
ilman
Posts: 22
Joined: Wed Mar 08, 2017 5:08 am

Re: measuring wind speed using optocoupler sensor (anemomete

Postby ilman » Wed Mar 22, 2017 7:04 am

willip5 wrote:Can you post a link to the data sheet for this item, it looks quite interesting. An optocoupler is essentially an electronic reed switch probably driven by a coded disk of some kind. If the output is a series of pulses then it will just mean a slight modification of the Python script used for the RPi Weather Station.

The Vaisala WAA151 outputs 14 pulses per revolution rather than the 2 pulses for the Maplin item.

Pete
optical sensor which i used is MOC-70T3. here the link related to datasheet http://www.datasheet.hk/download.php?id ... 777154.pdf
thanks for your help buddy. can you post an usual script to using optocoupler sensor for measuring wind before.
willip5
Posts: 59
Joined: Wed May 29, 2013 11:55 am
Location: France

Re: measuring wind speed using optocoupler sensor (anemomete

Postby willip5 » Thu Mar 23, 2017 8:02 pm

can you post an usual script to using optocoupler sensor for measuring wind
You don't need any code to use the opto coupler just connect the output pulse to the code that Dougie linked to above and modify the code as required.

Pete
ilman
Posts: 22
Joined: Wed Mar 08, 2017 5:08 am

Re: measuring wind speed using optocoupler sensor (anemomete

Postby ilman » Fri Mar 24, 2017 6:28 am

willip5 wrote:
can you post an usual script to using optocoupler sensor for measuring wind
You don't need any code to use the opto coupler just connect the output pulse to the code that Dougie linked to above and modify the code as required.

Pete
which one the link code that i must use to my project pete?
User avatar
DougieLawson
Posts: 28456
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact:

Re: measuring wind speed using optocoupler sensor (anemomete

Postby DougieLawson » Fri Mar 24, 2017 10:32 am

Both.

One runs as a long running daemon. The other reads the data from the daemon.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.
ilman
Posts: 22
Joined: Wed Mar 08, 2017 5:08 am

Re: measuring wind speed using optocoupler sensor (anemomete

Postby ilman » Fri Mar 24, 2017 3:02 pm

DougieLawson wrote:https://github.com/raspberrypi/weather- ... _daemon.py
https://github.com/raspberrypi/weather- ... _client.py

The daemon counts ticks on GPIO05 with a 9cm anemometer which I think does two ticks per revolution.

The client program gets the data from the interrupt daemon.
i've tried to read the script. is the script using local host?
is it work if i just want displaying wind record to terminal raspberry?
User avatar
DougieLawson
Posts: 28456
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact:

Re: measuring wind speed using optocoupler sensor (anemomete

Postby DougieLawson » Fri Mar 24, 2017 3:21 pm

Yes.
client code:

Code: Select all

self.client.connect(("localhost", port))
server code:

Code: Select all

self.skt.bind(("127.0.0.1", self.port))
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.
ilman
Posts: 22
Joined: Wed Mar 08, 2017 5:08 am

Re: measuring wind speed using optocoupler sensor (anemomete

Postby ilman » Fri Mar 24, 2017 4:39 pm

DougieLawson wrote:Yes.
client code:

Code: Select all

self.client.connect(("localhost", port))
server code:

Code: Select all

self.skt.bind(("127.0.0.1", self.port))
thanks before dougie, but in my project i dont use a local host. my project is just read wind speed and display it to terminal emulator pi. it is too complicated for me. do you have a simple code for measuring wind and display it to terminal emulator that i mean? thanks dougie
User avatar
DougieLawson
Posts: 28456
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact:

Re: measuring wind speed using optocoupler sensor (anemomete

Postby DougieLawson » Fri Mar 24, 2017 9:09 pm

The stuff I've given you is about as simple as it gets (and it's ready to run and it's free software). You can always use localhost to get TCP/IP comms going between one process and another on any single machine.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.