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









Thursday, 8 September 2016

Arduino Based GSM Weather Station For RC Model Flying Club

!!NEW VERSION OF THIS PROJECT HERE!!


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 :)