Project showcase
Weather Station v1.3 with RF Transmission

Weather Station v1.3 with RF Transmission © CC0

A project for small Weather Station with a central HUB for Home and an external part.

  • 6,421 views
  • 1 comment
  • 24 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

Starting from my previous project v.1.0 I added RF communication, a TFT display and a Dallas temperature sensor.

The transmit circuit will be encapsulated inside a Solar Panel that can power the circuit and will be placed out of the window.

For the solar part, I bought an already prepared shield on ebay and I just connect my circuit using USB.

The recover circuit will be encapsulated in a shield (that I didn't create yet) to be added inside the house.

For energy consumption reduction, I will upload my sketch on an Arduino Nano as soon as I will receive it and, I will enable low consumption library.

Code

TX PartArduino
/* ------------------------------------------------------------------------------- */
// Weather Station v1.3
//Receiver code with LCD management
// Andrea Martignoni
// martignoni.a@gmail.com

/* ------------------------------------------------------------------------------- */

#include <LiquidCrystal.h> //Liquid Cristal Mgt Lib
#include <Wire.h> //Management of wire connections
#include <VirtualWire.h> //Virtual Wire for sensor reading
#include <stdlib.h> //Library for string conversion
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

#include <OneWire.h>
#include <DallasTemperature.h> //Dallas Temperature Sensor

// Data wire is plugged into pin 4 on the Arduino
#define ONE_WIRE_BUS 4
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// Pins definition for LCD
#define TFT_CS     10
#define TFT_RST    9
#define TFT_DC     8
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
#define TFT_SCLK 13   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!

const int RX_DIO_Pin = 2; //Pin for RX receiver
int received;
float rec;
static char outstr[10];
String message;
char swith;
char* out;

void setup() {

  Serial.begin(9600);

  sensors.begin();
  // Use this initializer if you're using a 1.8" TFT
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

  uint16_t time = millis();

  tft.fillScreen(ST7735_BLACK);
  time = millis() - time;

  // large block of text
  tft.fillScreen(ST7735_BLACK); //initialize the screen in black
  tft.setRotation(90); //rotate the screen for my convenience
  testdrawtext("Hello!", ST7735_MAGENTA, 0,0,3); //Title of the screen
  delay(1000); //1 sec delay
  initialize_receiver(); //initialize Receiver
  //Create fixed graphic for the screen
  testdrawtext("Pres hPa", ST7735_YELLOW, 0,29,1);
  testdrawtext("OUT", ST7735_YELLOW, 0,37,1);
  testdrawtext("Hum %", ST7735_BLUE, 0,49,1);
  testdrawtext("OUT", ST7735_BLUE, 0,57,1);    
  testdrawtext("Temp F", ST7735_RED, 0,69,1);
  testdrawtext("OUT", ST7735_RED, 0,77,1);
  testdrawtext("Temp C", ST7735_GREEN, 0,89,1);
  testdrawtext("OUT", ST7735_GREEN, 0,97,1); 
  testdrawtext("Temp C", ST7735_MAGENTA, 0,129,1);
  testdrawtext("IN ", ST7735_MAGENTA, 0,137,1);      
}

/* Main program */
void loop() {
  uint8_t buf[VW_MAX_MESSAGE_LEN]; //Buffer for received message
  uint8_t buflen = VW_MAX_MESSAGE_LEN; //lenght of message
  vw_get_message(buf, &buflen); //read message
  message = (char*)buf; //temporary string
  Serial.print(message); //check on serial received message just for wire and soldering check
  swith=message[0]; //check which kind of value has been received
 
  switch (swith) { //based on kind of message pool
    case 'P':
      //clean received string
      message=message.substring(1,7);
      testdrawtext(message, ST7735_YELLOW, 55,30,2);
      break;
    
    case 'H':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_BLUE, 55,50,2);
      break;    
    
    case 'F':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_RED, 55,70,2);
      break;

    case 'T':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_GREEN, 55,90,2);
      break;
      
    default: 
      // if messages are not coming from receiver
      testdrawtext("N/A", ST7735_YELLOW, 55,30,2);
      testdrawtext("N/A", ST7735_BLUE, 55,50,2);
      testdrawtext("N/A", ST7735_RED, 55,70,2);
      testdrawtext("N/A", ST7735_GREEN, 55,90,2);
    break;
  }
  
  sensors.requestTemperatures();  //Read temperature from internal sensor
  testdrawtext(dtostrf(sensors.getTempCByIndex(0),3,2,outstr), ST7735_MAGENTA, 55,130,2);
  delay(200);

}


/* DO NOT EDIT BELOW */

void initialize_receiver() {
  /* Initialises the DIO pin used to receive data from the Rx module */
  vw_set_rx_pin(RX_DIO_Pin);  
  /* Receive at 2000 bits per second */
  vw_setup(2000);
  /* Enable the receiver */
  vw_rx_start();  
}

void testdrawtext(String text, uint16_t color, int x, int y, int textSize) {
  tft.setCursor(x, y);
  tft.setTextColor(color, ST7735_BLACK);
  tft.setTextSize(textSize);
  tft.setTextWrap(true);
  tft.print(text);
}
RX PartArduino
/* ------------------------------------------------------------------------------- */
// Weather Station v1.3
//Receiver code with LCD management
// Andrea Martignoni
// martignoni.a@gmail.com

/* ------------------------------------------------------------------------------- */

#include <LiquidCrystal.h> //Liquid Cristal Mgt Lib
#include <Wire.h> //Management of wire connections
#include <VirtualWire.h> //Virtual Wire for sensor reading
#include <stdlib.h> //Library for string conversion
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

#include <OneWire.h>
#include <DallasTemperature.h> //Dallas Temperature Sensor

// Data wire is plugged into pin 4 on the Arduino
#define ONE_WIRE_BUS 4
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// Pins definition for LCD
#define TFT_CS     10
#define TFT_RST    9
#define TFT_DC     8
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
#define TFT_SCLK 13   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!

const int RX_DIO_Pin = 2; //Pin for RX receiver
int received;
float rec;
static char outstr[10];
String message;
char swith;
char* out;

void setup() {

  Serial.begin(9600);

  sensors.begin();
  // Use this initializer if you're using a 1.8" TFT
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

  uint16_t time = millis();

  tft.fillScreen(ST7735_BLACK);
  time = millis() - time;

  // large block of text
  tft.fillScreen(ST7735_BLACK); //initialize the screen in black
  tft.setRotation(90); //rotate the screen for my convenience
  testdrawtext("Hello!", ST7735_MAGENTA, 0,0,3); //Title of the screen
  delay(1000); //1 sec delay
  initialize_receiver(); //initialize Receiver
  //Create fixed graphic for the screen
  testdrawtext("Pres hPa", ST7735_YELLOW, 0,29,1);
  testdrawtext("OUT", ST7735_YELLOW, 0,37,1);
  testdrawtext("Hum %", ST7735_BLUE, 0,49,1);
  testdrawtext("OUT", ST7735_BLUE, 0,57,1);    
  testdrawtext("Temp F", ST7735_RED, 0,69,1);
  testdrawtext("OUT", ST7735_RED, 0,77,1);
  testdrawtext("Temp C", ST7735_GREEN, 0,89,1);
  testdrawtext("OUT", ST7735_GREEN, 0,97,1); 
  testdrawtext("Temp C", ST7735_MAGENTA, 0,129,1);
  testdrawtext("IN ", ST7735_MAGENTA, 0,137,1);      
}

/* Main program */
void loop() {
  uint8_t buf[VW_MAX_MESSAGE_LEN]; //Buffer for received message
  uint8_t buflen = VW_MAX_MESSAGE_LEN; //lenght of message
  vw_get_message(buf, &buflen); //read message
  message = (char*)buf; //temporary string
  Serial.print(message); //check on serial received message just for wire and soldering check
  swith=message[0]; //check which kind of value has been received
 
  switch (swith) { //based on kind of message pool
    case 'P':
      //clean received string
      message=message.substring(1,7);
      testdrawtext(message, ST7735_YELLOW, 55,30,2);
      break;
    
    case 'H':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_BLUE, 55,50,2);
      break;    
    
    case 'F':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_RED, 55,70,2);
      break;

    case 'T':
      //clean received string
      message=message.substring(1,6);
      testdrawtext(message, ST7735_GREEN, 55,90,2);
      break;
      
    default: 
      // if messages are not coming from receiver
      testdrawtext("N/A", ST7735_YELLOW, 55,30,2);
      testdrawtext("N/A", ST7735_BLUE, 55,50,2);
      testdrawtext("N/A", ST7735_RED, 55,70,2);
      testdrawtext("N/A", ST7735_GREEN, 55,90,2);
    break;
  }
  
  sensors.requestTemperatures();  //Read temperature from internal sensor
  testdrawtext(dtostrf(sensors.getTempCByIndex(0),3,2,outstr), ST7735_MAGENTA, 55,130,2);
  delay(200);

}


/* DO NOT EDIT BELOW */

void initialize_receiver() {
  /* Initialises the DIO pin used to receive data from the Rx module */
  vw_set_rx_pin(RX_DIO_Pin);  
  /* Receive at 2000 bits per second */
  vw_setup(2000);
  /* Enable the receiver */
  vw_rx_start();  
}

void testdrawtext(String text, uint16_t color, int x, int y, int textSize) {
  tft.setCursor(x, y);
  tft.setTextColor(color, ST7735_BLACK);
  tft.setTextSize(textSize);
  tft.setTextWrap(true);
  tft.print(text);
}

Schematics

WeatherStation 1.3 RX part
RX Part
WeatherStationBaseV1.3_RX.fzz
Weather Station 1.3 TX
TX Part
WeatherStationBaseV1.3_TX.fzz

Comments

Similar projects you might like

Weather Station v.1.0

Project showcase by derapados

  • 12,948 views
  • 4 comments
  • 40 respects

Personal Weather Station (Arduino+ ESP8266 + Thingspeak)

Project tutorial by Jayraj Desai

  • 51,533 views
  • 32 comments
  • 107 respects

Weather Station with Thingspeak

Project showcase by Tittiamo

  • 3,011 views
  • 2 comments
  • 6 respects

Arduino UNO Mini-Weather Station

Project tutorial by Igor Fonseca Albuquerque

  • 25,837 views
  • 21 comments
  • 67 respects

Wireless weather station (Arduino + ESP8266 + Thingspeak)

Project tutorial by Alin-Constantin Paun

  • 8,938 views
  • 2 comments
  • 12 respects

Uno Weather Station

Project in progress by wrightmac

  • 7,949 views
  • 4 comments
  • 11 respects
Add projectSign up / Login