mini-project about reception of datas for weather station.

:slight_smile:
Hi everyone, greetings to all.

I ´m new with the programmation in Arduino, I have worked with Micro-Controller but no with this beatiful hardware (Arduino ). Now, I´m trying making a mini "weather station", but i want work with modules RF for send the variables such as temperature, wind velocity, altitude and other, in this moments only have DTH11, for measure the temperature.

But how I´m dont know much about this programmation, I've seen some tutorials in the web about this project. I take several examples and I edited for see what is the result. And I failed to get a good result. When send the numbers with the information such as temperature and humidity all good, I watch the Monitor serie and all well it appreciated as it should be.

But, in the Rx, when I watch the Monitor serie, appear strange symbols how if the communication is failed, I match the communication speed ( Baudes ) and the error continues..

Also, there is some sentences than I unknown and I would like to know who help me.

These are the codes. The Tx and the Rx. And the messages with the error.

TX

#include <VirtualWire.h>
#include "DHT.h"

#define DHTPIN 8                
#define DHTTYPE DHT11           
DHT dht(DHTPIN, DHTTYPE);
int ledPin = 13;
char Msg[30];                  


void setup(){
dht.begin();                    
pinMode(ledPin,OUTPUT);
// VirtualWire
vw_setup(2000);                   
vw_set_tx_pin(12);                
Serial.begin(19200);
}


void loop() {                                                
int humidity = dht.readHumidity();
int temp = dht.readTemperature();
int f = dht.readTemperature(true);
int hi_f = dht.computeHeatIndex(f,humidity);                   
int heat_index =(hi_f-32)*5/9;                                  
sprintf(Msg, "%d,%d,%d", humidity,temp ,heat_index);



digitalWrite(ledPin, HIGH);
delay(100);
Serial.print("About to send message");
vw_send((uint8_t *)Msg, strlen(Msg));
Serial.println("");


//print message
Serial.print("The message is");
Serial.println("");
Serial.print(Msg);
vw_wait_tx();                                       
Serial.println("");



digitalWrite(ledPin, LOW);
Serial.print("Message sent!");
Serial.println("");
Serial.println("");
Serial.println("");
}

RX

#include <VirtualWire.h>                 


int humidity=0;
int temp=0;
int heat_index=0;
char MsgReceived[21];
int led = 13;                         //pin para LED

void setup(){
Serial.print("Variables");
Serial.print("loading...");
pinMode(led, OUTPUT);
delay(2000);


vw_set_rx_pin(9);
vw_setup(2000);
vw_rx_start();

Serial.begin(19200);
}                                   // END void setup


void loop(){
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;


Serial.print("Getting datas");
Serial.println("");
if (vw_get_message(buf, &buflen)){
Serial.print("Get it!");
Serial.println("");
digitalWrite(led, HIGH);
delay(100);
int i;


for (i = 0; i < buflen; i++){
MsgReceived[i] = char(buf[i]);
Serial.print(MsgReceived[i]);
}
sscanf(MsgReceived, "%d,%d,%d",&humidity, &temp,&heat_index); // Converts a string to an array
digitalWrite(led, LOW);
memset( MsgReceived, 0, sizeof(MsgReceived));
}

Serial.write(1);
Serial.print(temp);
Serial.print("C");

Serial.write(2);
Serial.print(humidity);
Serial.print("%");

Serial.write(3);
Serial.print(heat_index);
Serial.print("C");
}

and this is the message.

I appreciate any help. Thanks to all.

The DHT sensor should only be read at 1 second intervals, minimum, so add a 2 second delay at the end of the TX loop

Also need to know for sure which VW and DHT libraries you have used ?

Which RF modules are you using, how are they wired and have you done any basic comms tests with them before these TX/RX sketches, typical test program here -