Remote temperature and humidity sensor (Sodaq) - Receiver Help

I am working on building a remote temperature and humidity sensor that displays data locally on an OLED screen and also transmits wirelessly, via Xbee, to another Arduino with an OLED via Xbee.

I am currently able to display data locally, but am not sure how to code the receiver.

(I have set up the Xbee’s in AT Mode and one is the coordinator and the other is the router. I can successfully send “Hello World!”, but that is the extent of what I am able to do…)

Your help and guidance is really appreciated! :slight_smile:

Below is the parts list and transmitter code (which resides on the transmitter Arduino).

2- Sodaq Kits
http://store.manylabs.org/products/k0120

2- OLED Displays 128x64
http://store.manylabs.org/collections/devices/products/g0101

1- Digital temperature and humidity sensor (DHT22
http://store.manylabs.org/collections/devices/products/g0102

2- XBEE PRO S3B 900HP RPSMA

Code Below:

#include <dht.h>
#include <Wire.h>
#include <SeeedOLED.h>

dht DHT;

#define DHT22_PIN A0
#define AREF 3.3
#define BATVOLTPIN A7

void setup()
{
    Serial.begin(9600);
    Serial.println("DHT TEST PROGRAM ");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT_LIB_VERSION);
    Serial.println();
    Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (F)\tTime (us)");
    
    Wire.begin();
    SeeedOled.init();  //initialze SEEED OLED display
    DDRB|=0x21;        
    PORTB |= 0x21;

    SeeedOled.clearDisplay();          //clear the screen and set start position to top left corner
    SeeedOled.setNormalDisplay();      //Set display to normal mode (i.e non-inverse mode)
    SeeedOled.setPageMode();           //Set addressing mode to Page Mode
    SeeedOled.setTextXY(0,0);          //Set the cursor to Xth Page, Yth Column  
  

}

void loop()



{
    // READ DATA
    Serial.print("DHT22, \t");

    uint32_t start = micros();
    int chk = DHT.read22(DHT22_PIN);
    uint32_t stop = micros();

    switch (chk)
    {
    case DHTLIB_OK:
        Serial.print("OK,\t");
        break;
    case DHTLIB_ERROR_CHECKSUM:
        Serial.print("Checksum error,\t");
        break;
    case DHTLIB_ERROR_TIMEOUT:
        Serial.print("Time out error,\t");
        break;
    default:
        Serial.print("Unknown error,\t");
        break;
    }
    // DISPLAY DATA
    Serial.print(DHT.humidity, 1);
    Serial.print(",\t");
    Serial.print(DHT.temperature * 9.0 / 5.0 + 32.0, 1);
    Serial.print(",\t");
    Serial.print(stop - start);
    Serial.println();

    SeeedOled.setTextXY(1,0);
    SeeedOled.putString("Temp (oF): ");
    SeeedOled.putFloat(DHT.temperature * 9.0 / 5.0 + 32.0 , 1);

    SeeedOled.setTextXY(3,0);
    SeeedOled.putString("% Humidity: ");
    SeeedOled.putFloat(DHT.humidity, 1);

/*
* This pin is connected to the middle of a 10M and 2M resistor
* that are between Vcc and GND.
* So actual battery voltage is:
* <adc value* AREF * (10+2) / 2 * 1023
*/
//battery (raw value)
int batteryRead = analogRead(BATVOLTPIN);
float voltage = batteryRead * AREF * 6.0 / 1023;
Serial.println(voltage);

    SeeedOled.setTextXY(5,0);
    SeeedOled.putString("Voltage: ");
    SeeedOled.putFloat(voltage);    
    delay(2000);
    
}
//
// END OF FILE
//

Photo of project:

Friday Bump! :grin: