Hi, I have decided to create a blog page to help if you have a similar project in mind.
I am part of a model flying club and for years we have had to guess and hope the weather was right to fly. Some people have to travel a long way to find that its too windy or the wind is going the wrong way.
I have built a weather station that has wind sensors and sends the information from these sensors to a website where the other club members can see the weather conditions at the field. There is no mains electricity or internet connection so the system has to be self sufficient. There is a solar panel on site that runs the electric fence (animals not people) so there is a 12v supply there.
How the system works...
The main board is an Arduino Mega 2560. I chose this bard because earlier versions of the code were too big for the Arduino UNO, although now an UNO would probably work just as well.
This Mega is the master. Its job is to collect information from the sensors and send this over the GSM network, using the SIM900 board, to a website called dweet.io.
There is a slave Arduino, connected to the master using I2C. This is a bit like a USB cable for machines. The slaves's job is to calculate wind speed and send this, when asked, to the Master. The slave also resets the Master board every 1.5 hours. This is because I have had some issues where there are no updates being sent and this solved that somehow.
The SIM900 board is the Master's connection to the internet. The master has to send AT commands over a virtual serial port.
The system sends an update every minute to...
http://dweet.io/follow/cmfc16
This site is really just for raw information. It all gets collected and displayed for the club members at...
https://freeboard.io/board/mGCvqi
or
tinyurl.com/cmfc16
Here's how its all connected...
Parts List...
Arduino Mega 2560 - eBay - £11 - £45(Clone or Genuine)
Arduino Uno - eBay - £4.50 - £15
SIM900 GSM Module - eBay - £13 - £50(China or UK Sellers)
(There are a few versions of this module. The one in the picture above
definately works with arduino. Some other versions use a different serial
interface and don't work with arduino)
INA219 Current Sensor - eBay - £2.50 - £7 (Chia or UK)
WindSpeed Sensor N25FR - eBay - £2.50
WindDirection N96FY - eBay - £9.99
5v Power supply - eBay - £6.50 - Also hobbyking sell these
Resistors and wire
Here is a table of connections...
FUNCTION | Mega Port | UNO Port | SIM900 Port | INA219 Port |
+5v | 5v | 5v | UNO Equiv. 5v | VCC |
-ve | GND | GND | UNO Equiv. GND | Gnd |
Sda | 20 SDA | A4 | - | Sda |
Scl | 21 SCL | A5 | - | Scl |
RX | 10 | - | UNO Equiv. 7 | - |
TX | 11 | - | UNO Equiv. 8 | - |
Wind Speed | - | 2 | - | - |
Wind Direction | A2 | |||
Master Reset | RESET | 8 | - | - |
Slave Reset | - | RESET - 9 | - | - |
GSM Status | - | 6 | UART - 2v8 | - |
GSM Power | - | 7 | UNO Equiv. 9 | - |
Light Sensor | 2 | - | - | - |
Status LED | 3 | - | - | - |
Solar Panel + | - | - | - | Vin + |
Main Battery + | - | - | - | Vin - |
Ground(B-ve) | GND | - | - | - |
Wiring the Wind Speed Sensor...
The wind sensor is just a reed switch that closes when the magnet passes it. Wire it as above with a 4k7 ohm resistor or as close as you can get. This will keep 5v on digital pin 2 on the Uno until the switch is activated and then 0v for a split second.
Wiring the Wind Direction sensor...
The wind direction sensor is made up of 8 reed switches and a magnet on the vane. Each reed switch has a different resistor in series with it so as the magnet passes over a reed switch, it changes the resistance of the circuit.
We then use a voltage divider to turn this resistance into a usable voltage that the main board can use. To do this we need a resistor around 9kOhm and wired as the picture above.
The code...
It has taken a long time to get this to where it is now. I am not trained in writing in C and everything here is a result of extensive googling and trial and error. If you can improve this in any way please let me know.
(Open the link and then click the download button - top right of the new page)
To open the code you will need the latest Arduino software. Its free from here...
Once you have installed Arduino, you will need the libraries that I have used in my code installed. This is like installing drivers on a computer.
Here's how to do it...
Download the libraries.zip file from here... (Download button - top right of new page)
Unzip the files in the following location...
My Documents > Arduino > Libraries >
Thats it. I would love to hear how you get on or answer your questions, just comment :)