Jattie van der Linde

Shoe string engineering

User Tools

Site Tools


projects:anemometer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
projects:anemometer [2023/10/02 18:23] – [Calculating wind speed] jattieprojects:anemometer [2024/02/18 19:54] (current) – [Important notes about reed switches] jattie
Line 10: Line 10:
  
 Where: Where:
-D is the diameter of the cups (in meters) + 
-RPM is the revolutions per minute +  * D is the diameter of the cups (in meters) 
-C is the distance from the cup center to the rotation point (in meters)+  RPM is the revolutions per minute 
 +  C is the distance from the cup center to the rotation point (in meters)
  
 In your case: In your case:
-D = 80mm = 0.08m +  * D = 80mm = 0.08m 
-RPM = 60 (revolutions per minute) +  RPM = 60 (revolutions per minute) 
-C = 155mm = 0.155m+  C = 155mm = 0.155m
  
 Plugging in the values into the formula: Plugging in the values into the formula:
Line 28: Line 29:
  
 Therefore, with a rotation speed of 60 RPM, the resulting wind speed would be approximately 7.307 meters per second. Therefore, with a rotation speed of 60 RPM, the resulting wind speed would be approximately 7.307 meters per second.
 +
 +===== interrupt-driven counter =====
 +
 +
 +To create an interrupt-driven counter on a Raspberry Pi using GPIO pins, you can follow these steps:
 +
 +==== Import the required libraries ====
 +
 +<code python>
 +import RPi.GPIO as GPIO
 +import time
 +</code>
 +
 +==== Set up the GPIO mode and initialize the counter variable ====
 +
 +```python
 +GPIO.setmode(GPIO.BCM)
 +counter = 0
 +```
 +
 +==== Set up the GPIO pin for input and configure the interrupt ====
 +
 +
 +<code python>
 +GPIO.setup(pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
 +GPIO.add_event_detect(pin_number, GPIO.FALLING, callback=increment_counter)
 +</cpde>
 +
 +**Note:** Replace ''pin_number'' with the GPIO pin number you want to use.
 +
 +==== Define the callback function to increment the counter ====
 +
 +<code python>
 +def increment_counter(channel):
 +    global counter
 +    counter += 1
 +</code>
 +
 +==== Create a loop to keep the program running ====
 +
 +<code python>
 +try:
 +    while True:
 +        time.sleep(1)
 +except KeyboardInterrupt:
 +    GPIO.cleanup()
 +</code>
 +
 +This code sets up the GPIO pin as an input with a pull-up resistor and detects falling edge interrupts. When the interrupt is triggered, the ''increment_counter'' function is called, which increments the counter variable. The program then enters an infinite loop, waiting for interrupts.
 +
 +Remember to replace ''pin_number'' with the desired GPIO pin number for your application.
 +
 +===== Important notes about reed switches =====
 +
 +The  sensitivity of a REED switch is characterized by the value of the magnetic field which is required to 
 +change its state. The magnetic field is expressed in Ampere-turns  (or ampere/meter). In order to close a normally open switch, for instance, a certain number of Ampere-turns, called **CAT**, are required (**c**losing **A**mpere-**t**urns). To open the same switch the magnetic field must be reduced down to an **o**pening value in **A**mpere-**t**urns **OAT**). 
 +
 +<WRAP center round tip 60%>
 +OAT<CAT is always true
 +</WRAP>
 +
 +Order of magnitude OAT-CAT :
 +
 +^For standard switches^^
 +|CAT |12 and 50 Ampere-turns| 
 +|OAT |5 and 30 Ampere-turns|.
 +^For standard or mercury wetted switches^^
 +|CAT |35 and 150 Ampere-turns| 
 +|OAT |10 and 80|
 +
 +<WRAP center round important 60%>
 +NOTE : if the leads on a switch are cut, the CAT and  OAT values will increase
 +
 +Bending modifies the CAT and OAT values of a switch
 +Cutting the leads on a REED switch has the effect of increasing the CAT and OAT ratings in a significant manner. 
 +</WRAP>
 +
 +The figure below illustrates this variation.
 +
 +{{:projects:screenshot_2024-02-18_195106.png?400|}}
 +
 +===== Reed Reference Documents =====
 +
 +
 +  * {{:projects:ap-interen.pdf|}}
 +  * {{:projects:notes_reed_switch_modifications.pdf|}}
projects/anemometer.1696270980.txt.gz · Last modified: 2023/10/02 18:23 by jattie