Wednesday, 19 April 2017

Arduino powered GSM weather station VERSION 2



Hello and welcome to version 2 of my Arduino GSM weather station.

This new version uses the Adafruit wind speed sensor, with analogue output.  This isn't susceptible to interference like the old wind speed system.   I also use 2 INA219 current sensors in parallel in this version.  This allows me to measure twice the current (6.4amps)  You may not need this, I have a 75watt solar system but it doesn't need to be this big. (also powers an electric fence - sheep)

Here's a rough drawing of how its all connected...




The system runs off a 12v 90ah car battery.  The power for the arduino and GSM shield comes from the Turnigy BEC (bottom left of above)  This kicks out upto 5amps at 5v so more than enough to run all of the 5v stuff.



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 main board.  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.

The SIM900 board is the main board's connection to the internet.  The main board has to send AT commands over a virtual serial port.

The light sensor is used to detect when the lock out box is opened. If its open - someone is flying.
The LED lights up while an update is being sent to dweet over GSM
The BEC converts 12v to 5v
The temperature sensor is a thermistor and a voltage devider to give analogue voltage.
The INA219 is current/voltage sensor over I2C.  Each one needs its own address (solder pad)

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
flyingfield.co.uk


Parts List...
Arduino Mega 2560  - eBay - £11 - £45(Clone or Genuine)

SIM900 GSM Module - eBay - £13 - £50(China or UK Sellers)
                                       (There are a few versions of this module.  The one in the picture above 
                                        definitely works with arduino.  Some other versions use a different serial 
                                        interface and don't work with arduino)
INA219 Current Sensor - eBay - £2.50 - £7 (China or UK)
Adafruit Wind Speed Sensor W/analogue output - Mouser -£32
WindDirection N96FY - eBay - £9.99
5v Power supply - eBay - £6.50 - Also hobbyking sell these
Resistors and wire

Here is a table of connections...


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.
All the latest VERSION 2 code can be found here Now each line is explained in the file.
(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 >


I will update this later with what you might want to change in the code to suit your needs.

Please leave a comment if this was helpful.

Russ