TWIST- DIY Tweeting Weather Station

TWIST- DIY Tweeting Weather Station

Show All Items

TWIST- DIY Tweeting Weather Station



Ever wanted to monitor your city’s Current Weather Conditions, Carbon Footprint, Noise and Pollution levels? Do you want be a Climate Change Crusader or set-up your own Tweeting Weather Station and share your local weather conditions with the world?

Meet Tweeting Weather IoT Station aka TWIST – a DIY, Open-Source Environmental Monitoring and Meteorological Data Acquisition Platform. The purpose of TWIST is so that individuals and communities can collect data of what’s actually happening in their environment and share this data on social media such as Twitter.

TWIST- DIY Tweeting Weather Station

  • TWIST is an Internet of Things (IoT) powered platform.
  • The brain of TWIST is an Intel Edison Board.
  • TWIST is compatible with a variety of sensors.
  • All code, design files(schematics & PCB layout) are Open-Source. This means that anyone can contribute to the TWIST platform by sharing code and schematics for different sensors.

TWIST- DIY Tweeting Weather Station

TWIST consists of three technological layers:

The first layer is a hardware board that contains all the weather and environmental sensors known as the ‘Sensor Board’. As the name suggests, it carries sensors that measure air composition, temperature, humidity,rain. Additional sensors like seismic activity, UV index, barometric pressure, altitude, lux(luminosity), sound levels, wind speed & direction,etc can also be added. Once it’s set up, the Sensor Board is able to stream data measured by the sensors to the second layer. The second layer is the Intel Edison Board that receives data from the Sensor Board, processes it and sends it to the next layer. The third layer connects your Edison Board to the Internet over Wi-Fi using the wireless module on the Edison board and Tweet’s the Current Weather & Environmental conditions.

Power to the device can be provided by a solar panel or an AC Adapter.

Version controlled repositories

All three technological layers of TWIST are Open-Source, and thus all the files we use for code, PCB development, mechanical design,etc are readily available on our Github repository.

TWIST- DIY Tweeting Weather Station

Contest Entries

Intel IoT Invitational

I would like to thank Intel+Instructables for providing me with the Intel Edison Board. I plan on making many more IoT related Instructables using the Edison board.

#iotweatherstn

If you make TWIST, don’t forget to tweet the weather using #iotweatherstn. #iotweatherstn can be a hashtag used by all IoT powered Tweeting Weather Stations.

Step 1: Parts and Materials

TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station

Show All Items Quantity Part Details 1 Intel Edison with Arduino Breakout Board 1 MQ2 Combustible Gas Sensor 1 YL-83 Rain Sensor 1 SL-HS-220 Temperature & Humidity Sensor 1 Resistor 32K 1 Resistor 4.7K 2 Wood Sheet A4 Size(Can later be cut into size) 3 Metal Standoff 1inch

Step 2: Electrical Design

TWIST- DIY Tweeting Weather Station

Power

The entire system is powered from a 5V 1A power supply. The sensors(Temperature,Humidity,Rain,Gas) draws approximately 200 mA, the Edison around 500 mA, Since the total current required is less than 1amp, a 1 amp supply should work just fine. The inbuilt green LED on digital pin 13 of the Edison Board is used to show the power status.

Control
An Intel Edison runs the show for TWIST. The Edison is mounted on an Arduino breakout board, which makes it easy to read the digital & analog signals from the sensors. The Edison is connected to the 5V rail via a micro usb cable. The Edison has a built-in Wi-Fi radio, which allows it to connect to the Twitter without the need for any additional hardware.

Real Time Clock(RTC)

Since the time-stamping automatically carried out by Twitter for each tweet has a resolution limited to the number of total days since the time of Tweeting, a real time clock is used to accurately time stamp the date and time in the Hour-Minute-Second format. The real time clock used in the TWIST platform is the DS-1307 RTC module.

Sensors
The most basic setup of this system has four sensors(Temperature,Humidity,Rain,Gas) that connect to the Edison. Additional sensors can be added such as Noise, Wind,etc. Each sensor is directly powered from the 5V rail and has its signal pin connected respectively to analog pins A0 through A2 and digital pin 2 on the Edison breakout board. The sensors also each have a sensitivity adjustment potentiometer mounted on each sensor board; The MQ-2 is a combustible gas sensor (liquified petroleum gas, propane, hydrogen, and methane) that outputs an analog voltage proportional to the concentration of gases in parts per million. The SL-HS-220 has a thermistor that gives the temperature value. Since the output of the thermistor is non-linear, the corresponding temperature table is given in the sensor repository. The thermistor requires a voltage divider circuit when connected to the Edison Board as shown in the circuit diagram. The SL-HS-220 also has an inbuilt hygrometer which measures humidity and outputs an analog voltage that corresponds to a fixed humidity value. The humidity-voltage table is also given in the sensors repository. A common substitute to the SL-HS-220 is the DHT11 sensor. The rain sensor/water sensor has a potentiometer which is adjusted to give a digital output for a certain amount of rain whose sensitivity can be adjusted by the user.



TWIST- DIY Tweeting Weather Station

Weather Station.fzz

Step 3: Mechanical Design

TWIST- DIY Tweeting Weather Station



TWIST- DIY Tweeting Weather Station

The body of the TWIST is made out of two plates of wooden sheets. Although I used 1/4″ plywood , the design can be assembled out of any sheet material as the spacing (maintained by 1″ aluminum standoffs) is the only critical element. I’ve attached the vector files for download above.

Laser Cutting

For all those who wish to laser cut the two plates, I have attached the laser cutter files for download below. It also includes an additional air quality sensor in its design. So you can either use an MQ2 sensor module or air quality sensor module depending on your choice.

  • TWIST- DIY Tweeting Weather Station

    Weather Stantion Vector.dwg

Step 4: Frame Assembly: Face & Base

TWIST- DIY Tweeting Weather Station

Faceplate

The Sensors fit into their matching holes and cut-outs and can be fixed using screws or glue.

TWIST- DIY Tweeting Weather Station

Baseplate

The standoffs of the Edison board are screwed on to the Baseplate. The analog-to-digital-converter(ADC) which is connected to the rain sensor can also be screwed on to the Baseplate.

Additional components like buzzers or the voltage regulator circuit for the solar input can also be screwed on to the Baseplate.

The Baseplate and the Faceplate are both separated by 1″ standoffs.

Step 5: Electronics & Sensor Assembly

TWIST- DIY Tweeting Weather Station

Power

The power for the system is provided by a wall adapter with a standard barrel jack which is connected directly to the Edison’s Barrel connector. The system can also be powered through the USB port on the Edison board. You can also power the board from an external Solar panel.

TWIST- DIY Tweeting Weather Station

Sensors

The sensors are attached to breakout boards with male headers and hence they can be directly connected to the Edison via male-to-female jumper wires.

Step 6: Twitter Configuration

TWIST- DIY Tweeting Weather Station

Inorder to Tweet, we are using a third-party app developed by NeoCat that gets the Twitter token you will need to Tweet with your Edison board. Tokens can also be sourced from Twitter’s Developers webpage.

So, to get started, visit NeoCat’s website, follow his/her tutorial to get the twitter library and your twitter token. As NeoCat mentioned on their site, please don’t abuse the service. Keep your tweets sparse. If you need something that tweets every 6 seconds, you should set up your own server and twitter app and hence the code that I wrote ensures that NeoCat’s server doesn’t overload(TWIST tweets every 6 hours).

The library uses this NeoCat’s website as a proxy server for OAuth stuff. Your tweet may not be applied during maintenance of this NeoCat’s website. Twitter seems to reject repeated tweets with the same content (returns error 403).

TWIST- DIY Tweeting Weather Station

Twitter Token

Arduino Tweet Library

Step 7: Software & Configuration

TWIST- DIY Tweeting Weather Station

Follow Intel’s setup guide for the Intel Edsion before you start coding.

The program is an Arduino sketch running on the Edison. I have explained each of the main blocks of code below.

The code includes some predefined constants, pin declarations and a couple of serial print statements that help in troubleshooting.

Tweet Delay

Since Twitter filters out tweets that have the same content and are tweeted within short periods of time between each of them, a standard 3 hour (10800000 milli second) delay between each tweet has been set.

tweetMessage(); delay(10800000);

Type Casting

A lot of the readings we get from the sensors are in the ‘int’ or ‘float’ datatype. But since we are tweeting these values, we need to convert them into a ‘String’ datatype. For this we use a special Type-casting technique.

char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { char fmt[100]; sprintf(fmt, “%%%d.%df”, width, prec); sprintf(sout, fmt, val); return sout; }

Twitter Token

The twitter token is created on NeoCat’s website and should be pasted into the token space here.

void tweetMessage() { Twitter twitter(” ENTER TWITTER TOKEN HERE “);

Tweeting Sensor Values

In order to tweet the sensor value we first include the Sensor type; Example: “Humidity”. This followed by a character declaration and a line of code required for typecasting. Next we add a statement for the unit of measurement; Example: “%RH”. We can keep on adding values of other sensors too in a similar manner.

humidity(); float humid; //Twitter message String stringMsg = “Humidity:”; char tmp[10]; dtostrf(humid, 1, 2, tmp); stringMsg += tmp; stringMsg += “%RH”;

Weather Station Location & Tagging

Next we tag the location(City,Locality,etc) and other tags like #iotweatherstn .

stringMsg += ” #Mumbai #Bandra #iotweatherstn “;

Real Time Clock (RTC)

As explained earlier TWIST can also Tweet the Real Time Clock Data. Below is an example of the ‘day’ parameter block of code of the RTC. The Real Time Clock feature is optional in the TWIST platform since the module comes separately. Hence there is a separate branch created in the TWIST repository for the code and schematics of the Real Time Clock branch.

TwistDateTime();
DateTime now = rtc.now(); int twistday, twistmonth, twistyear, twisthour, twistmin, twistsec; String stringMsg = “”; char ds1307day[10]; dtostrf(twistday,1,0ds1307day); stringMsg += ds1307day; stringMsg += “/”;

140 Character Limit

This block of code coverts the string array to 140 character array ready to tweet.

char msg[140]; stringMsg.toCharArray(msg, 140);

Message & Connection Troubleshooting

This block of code prints out a couple of lines of text in the Serial Monitor to help the user check the message and tweet status.

//Tweet that sucker! if (twitter.post(msg)) { int status = twitter.wait(); if (status == 200) { Serial.println(“OK.”); Serial.println(“Message Tweeted”); } else { //Connection Test Serial.print(“failed : code “); Serial.println(“Message not Tweeted”); Serial.println(status); } } else { Serial.println(“connection failed.”); Serial.println(“Message not Tweeted”); }

All the other blocks of code simply converts the analog or digital reading from the sensors into usable data.

The code can be dowloaded from here or from the main repository:

TWIST- DIY Tweeting Weather Station

Weather Station.ino

Step 8: Contributing to the Sensor Repository

TWIST- DIY Tweeting Weather Station

TWIST currently supports the sensors listed below. Follow the instructions below to learn how you can contribute and add more sensors to the TWIST platform. You can also find the Real Time Clock and other features repository status in the table below.

Sensor Type Sensor Model Repository Status Temperature & Humidity SL-HS-220 Completed Gas MQ2 Completed Rain YL-83 Completed Temperature & Humidity DHT11 Completed Digital Luminosity/Lux/Light TSL2561 Completed UV/IR/Visible Light SI1145 Completed Sound Level LMV324 Completed Barometric Pressure & Altitude MPL3115A2 Completed Wind Speed Anemometer Completed Real Time Clock (RTC) DS1307 Completed

The TWIST sensor Repository is Open Source meaning anyone can contribute to the code of existing sensors which are in the repository. Additional sensors can also be added to the repository.

For now the three basic sensors(SL-HS-220,MQ2,YL-83) are in the same repository since they are the basic sensors.

If you have a sensor in mind that is not already in the repository, you can write the code and schematics for it and contribute to the repository. Or else you can simply leave the name and model along with a link to the sensor in the comments section below and I will surely check it out and try my best to add it to the repository.

TWIST Sensor Repository

TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station
TWIST- DIY Tweeting Weather Station

As more people suggest and contribute to the TWIST sensor repository I will update the above table. Completed- indicates that the code and schematics for that particular sensor is fully ready for use and can be implemented into the TWIST system. Beta- indicates that work has been started by either me or another contributor on the code and schematics for that particular sensor. Proposed- indicates that someone has proposed a sensor to be added to the repository & that work hasn’t yet been started on the sensors code or schematics.

Code

If you are contributing towards a particular sensors repository by writing code, ensure that you write it the Arduino IDE or Intel Edison IDE and attach the respective file. The code must include the following features:

Pin Declarations,Libraries, Reading Sensor Values, Serial Printing Sensor Values, Tweeting code for Sensor.

Also include the links to all the additional Libraries used in the code.

Ensure that each block of code has the necessary comments for ease of use.

Also include a possible link to the sensors datasheet for further reference for other contributors.

TWIST- DIY Tweeting Weather Station

Schematics

If you are contributing towards a particular sensors repository by drawing schematics, ensure that you do this in either the Fritzing or Eagle PCB design softwares. A Breadboard view will be really helpful for people who have beginner level electronic skills. You can also include a PCB view for those wishing to make their custom sensor breakout boards or PCB’s. Also include a possible link to the sensors datasheet for further reference for other contributors.

Mechanical Design

You can also contribute to the vector files and laser cutter files for a particular sensor and add those files to the sensors repository. Standard file formats should be used for this purpose.

electronics – TWIST- DIY Tweeting Weather Station, in category: technology