Professional Documents
Culture Documents
Using An Anemometer With Raspberry Pi - Odt
Using An Anemometer With Raspberry Pi - Odt
Using An Anemometer With Raspberry Pi - Odt
The GPIO Connection is super simple, anemometer has 2 cables, one would
connect to ground and the other to Pin 3 (the GPIO02), no matter what cable
where. We base ourselves we have a Raspberry Pi with Raspbian installed
and enabled GPIO (sudo Raspi-config…).
Now everyone who is interested modify it as you, If you want to spend
the meters per second to kilometers per hour and put the result in a
MySQL database, add the line around 60 Something like:
1 ...
viento_kmph = actual_windspeed_msec * 3.6 # Convertir metros por segundo a
2
kilometros hora
3 print viento_kmph
4 if vuelta == 30: # Así cada 30 segundos lo mete en BD
5 vuelta = 0
db =
6
MySQLdb.connect("DIRECCION_IP_MYSQL","USUARIO","CONTRASEÑA","BASE_DATOS")
7 cursor = db.cursor()
cursor.execute("""INSERT INTO viento (velocidad) VALUES (%s) """,
8
( viento_kmph))
9 db.commit()
10 else:
11 vuelta = vuelta + 1
12 ...
5 COLLATE='latin1_swedish_ci'
6 ENGINE=InnoDB
7 ROW_FORMAT=COMPACT
8;
Good, I hope you like it, gradually we will be getting more sensors to
our Raspberry Pi to mount a weather station or what pleases us, go!