Wireless Weather Station Project created by Dejan Nedelkovski

Hi all
I've been working on this wireless weather station project for 2 weeks now and just can't get the sketch to verify without throwing error after error to the point that now i am confused and am really needing some help :o :confused: Now mind ya I am a true noob. I've used this sketch which is the one provided by Dejan Nedelkovski. The Board is the Nano v3, DTH22 Temp-Humidity sensor, DS3231 rtc, and the nRF24L01. and sketch is as follows:

/*
  Arduino Wireless Communication Tutorial
        Indoor unit  - Receiver

  by Dejan Nedelkovski, www.HowToMechatronics.com
 Libraries:
 DS3231 - http://www.rinkydinkelectronics.com/library.php?id=73
 U8G2 - https://github.com/olikraus/u8g2
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <DHT.h>
#include <DS3231.h>
#include <U8g2lib.h>
#include <Wire.h>

#define dataPin 8 // DHT22 sensor
DHT22 dth; // Creats a DHT object
DS3231  rtc(SDA, SCL);
U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

RF24 radio(10, 9); // CE, CSN
const byte address[6] = "00001";

char text[6] = "";
int readDHT22, t, h;
String inTemp, inHum, outTemp, outHum;
String rtcTime, rtcDate;
int draw_state = 0;
unsigned long previousMillis = 0;
long interval = 3000;

#define Temperature_20Icon_width 27
#define Temperature_20Icon_height 47
static const unsigned char Temperature_20Icon_bits[] U8X8_PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00,
  0xc0, 0xe1, 0x00, 0x00, 0xe0, 0xc0, 0x01, 0x00, 0x60, 0x80, 0xf9, 0x03,
  0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x79, 0x00,
  0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0xf9, 0x03,
  0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x8c, 0x79, 0x00,
  0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0xf9, 0x03,
  0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x79, 0x00,
  0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0xf9, 0x03,
  0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x01, 0x00, 0x60, 0x9e, 0x01, 0x00,
  0x70, 0x9e, 0x03, 0x00, 0x38, 0x1e, 0x07, 0x00, 0x18, 0x3e, 0x0e, 0x00,
  0x1c, 0x3f, 0x0c, 0x00, 0x0c, 0x7f, 0x18, 0x00, 0x8c, 0xff, 0x18, 0x00,
  0x8e, 0xff, 0x38, 0x00, 0xc6, 0xff, 0x31, 0x00, 0xc6, 0xff, 0x31, 0x00,
  0xc6, 0xff, 0x31, 0x00, 0x8e, 0xff, 0x38, 0x00, 0x8c, 0xff, 0x18, 0x00,
  0x0c, 0x7f, 0x1c, 0x00, 0x3c, 0x1c, 0x0e, 0x00, 0x78, 0x00, 0x06, 0x00,
  0xe0, 0x80, 0x07, 0x00, 0xe0, 0xff, 0x03, 0x00, 0x80, 0xff, 0x00, 0x00,
  0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


#define Humidity_20Icon_width 27
#define Humidity_20Icon_height 47
static const unsigned char Humidity_20Icon_bits[] U8X8_PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
  0x00, 0x70, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00,
  0x00, 0xdc, 0x01, 0x00, 0x00, 0x8e, 0x01, 0x00, 0x00, 0x86, 0x03, 0x00,
  0x00, 0x06, 0x03, 0x00, 0x00, 0x03, 0x07, 0x00, 0x80, 0x03, 0x06, 0x00,
  0x80, 0x01, 0x0c, 0x00, 0xc0, 0x01, 0x1c, 0x00, 0xc0, 0x00, 0x18, 0x00,
  0xe0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x70, 0x00, 0x70, 0x00,
  0x30, 0x00, 0xe0, 0x00, 0x38, 0x00, 0xc0, 0x00, 0x18, 0x00, 0xc0, 0x01,
  0x1c, 0x00, 0x80, 0x01, 0x0c, 0x00, 0x80, 0x03, 0x0e, 0x00, 0x80, 0x03,
  0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x07,
  0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06,
  0x63, 0x00, 0x00, 0x06, 0x63, 0x00, 0x00, 0x06, 0x63, 0x00, 0x00, 0x06,
  0xe3, 0x00, 0x00, 0x06, 0xc7, 0x00, 0x00, 0x06, 0xc6, 0x01, 0x00, 0x07,
  0x86, 0x03, 0x00, 0x03, 0x0e, 0x1f, 0x00, 0x03, 0x0e, 0x1e, 0x80, 0x01,
  0x1c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0xe0, 0x00, 0x78, 0x00, 0x70, 0x00,
  0xf0, 0x00, 0x38, 0x00, 0xe0, 0x07, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00,
  0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
};

void setup() {
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
  u8g2.begin();
  rtc.begin();
}
void loop() {
  if (radio.available()) {
    radio.read(&text, sizeof(text)); // Read incoming data
    outTemp = String(text[0]) + String(text[1]) + char(176) + "C"; // Outdoor Temperature
    outHum = String(text[2]) + String(text[3]) + "%"; // Outdoor Humidity
  }

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    u8g2.firstPage();
    do {
      switch (draw_state ) {
        case 0: drawDate(); break;
        case 1: drawInTemperature(); break;
        case 2: drawInHumidity(); break;
        case 3: drawOutTemperature(); break;
        case 4: drawOutHumidity(); break;
      }
    } while ( u8g2.nextPage() );
    draw_state++;
    if (draw_state > 4) {
      draw_state = 0;
    }
  }
}

void drawDate() {
  String dowa = rtc.getDOWStr();
  dowa.remove(3);
  rtcDate = dowa + " " + rtc.getDateStr();
  u8g2.setFont(u8g2_font_timB14_tr);
  u8g2.setCursor(0, 15);
  rtcTime = rtc.getTimeStr(); // DS3231 RTC time
  rtcTime.remove(5);
  u8g2.print(rtcDate);
  u8g2.setFont(u8g2_font_fub30_tf);
  u8g2.setCursor(8, 58);
  u8g2.print(rtcTime);
}

void drawInTemperature() {
  read.DHT22 = DHT.read22(dataPin); // Reads the data from the sensor
  t = DHT22.temperature; // Gets the values of the temperature
  inTemp = String(t) + char(176) + "C";
  u8g2.setFont(u8g2_font_helvR14_tr);
  u8g2.setCursor(24, 15);
  u8g2.print("INDOOR");
  u8g2.setFont(u8g2_font_fub30_tf);
  u8g2.setCursor(36, 58);
  u8g2.print(inTemp);
  u8g2.drawXBMP( 0, 17, Temperature_20Icon_width, Temperature_20Icon_height, Temperature_20Icon_bits);
}

void drawInHumidity() {
  h = DHT22.humidity; // Gets the values of the humidity
  inHum = String(h) + "%";
  u8g2.setFont(u8g2_font_helvR14_tr);
  u8g2.setCursor(24, 15);
  u8g2.print("INDOOR");
  u8g2.setFont(u8g2_font_fub30_tf);
  u8g2.setCursor(36, 58);
  u8g2.print(inHum);
  u8g2.drawXBMP( 0, 17, Humidity_20Icon_width, Humidity_20Icon_height, Humidity_20Icon_bits);
}

void drawOutTemperature() {
  u8g2.setFont(u8g2_font_helvR14_tr);
  u8g2.setCursor(12, 15);
  u8g2.print("OUTDOOR");
  u8g2.setFont(u8g2_font_fub30_tf);
  u8g2.setCursor(36, 58);
  u8g2.print(outTemp);
  u8g2.drawXBMP( 0, 17, Temperature_20Icon_width, Temperature_20Icon_height, Temperature_20Icon_bits);
}
void drawOutHumidity() {
  u8g2.setFont(u8g2_font_helvR14_tr);
  u8g2.setCursor(12, 15);
  u8g2.print("OUTDOOR");
  u8g2.setFont(u8g2_font_fub30_tf);
  u8g2.setCursor(36, 58);
  u8g2.print(outHum);
  u8g2.drawXBMP( 0, 17, Humidity_20Icon_width, Humidity_20Icon_height, Humidity_20Icon_bits);
}

When you encounter an error you'll see a button on the right side of the orange bar in the Arduino IDE "Copy error messages" (or the icon that looks like two pieces of paper in the Arduino Web Editor). Click that button. Paste the error in a reply here using code tags.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded the libraries from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

https://howtomechatronics.com/tutoria...
This all that I have now I have attempted to use both arduino libraries and the adafruit contributed libraries. The url provided here will have everything that I have done as far as this project goes. Had to use the attachment option

Thank you for your interest and help in advance

Error_Message12172019.txt (118 KB)

Dougn2ib:
https://howtomechatronics.com/tutoria...

That link is broken.

We still need those library links. I see there are some in the comment at the top of the sketch, but that doesn't cover all the libraries, and I'm also not sure whether you used those libraries. Especially we need the link to the DHT library you used.

The error messages extracted from @Dougn2ib's Error_Message12172019.txt:

Receiver:19:1: error: 'dht' does not name a type

 dht DHT; // Creats a DHT object

 ^~~

Receiver:20:21: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

 DS3231  rtc(SDA, SCL);

                     ^

In file included from C:\Users\Doug\Documents\Arduino\Receiver\Receiver.ino:14:0:

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note: candidate: DS3231::DS3231()

   DS3231();

   ^~~~~~

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note:   candidate expects 0 arguments, 2 provided

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: candidate: constexpr DS3231::DS3231(const DS3231&)

 class DS3231 {

       ^~~~~~

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: candidate: constexpr DS3231::DS3231(DS3231&&)

C:\Users\Doug\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Doug\Documents\Arduino\Receiver\Receiver.ino: In function 'void setup()':

Receiver:83:7: error: 'class DS3231' has no member named 'begin'

   rtc.begin();

       ^~~~~

C:\Users\Doug\Documents\Arduino\Receiver\Receiver.ino: In function 'void drawDate()':

Receiver:113:21: error: 'class DS3231' has no member named 'getDOWStr'; did you mean 'getDoW'?

   String dowa = rtc.getDOWStr();

                     ^~~~~~~~~

                     getDoW

Receiver:115:30: error: 'class DS3231' has no member named 'getDateStr'; did you mean 'getDate'?

   rtcDate = dowa + " " + rtc.getDateStr();

                              ^~~~~~~~~~

                              getDate

Receiver:118:17: error: 'class DS3231' has no member named 'getTimeStr'; did you mean 'getMinute'?

   rtcTime = rtc.getTimeStr(); // DS3231 RTC time

                 ^~~~~~~~~~

                 getMinute

C:\Users\Doug\Documents\Arduino\Receiver\Receiver.ino: In function 'void drawInTemperature()':

Receiver:127:18: error: expected primary-expression before '.' token

   readDHT22 = DHT.read22(dataPin); // Reads the data from the sensor

                  ^

Receiver:128:10: error: expected primary-expression before '.' token

   t = DHT.temperature; // Gets the values of the temperature

          ^

C:\Users\Doug\Documents\Arduino\Receiver\Receiver.ino: In function 'void drawInHumidity()':

Receiver:140:10: error: expected primary-expression before '.' token

   h = DHT.humidity; // Gets the values of the humidity

          ^

This is the link all the info is there libraries and concept it's really a great project just the sketch is kinda not quit right. As far as the libraries like I said earlier Adafruit, Arduino, and I got some of the libraries from the Arduino IDE libraries and there's a few that he said was needed from contributors on GutHub. Now I have posted the url 2 ways first one I typed in because the first time I posted it you are right it seemed to be broken link button must have changed something so i posted it again here by typing it in and using the link button

Hopefully I'll be okay doing this I'm going to attach the .h files that are used the icon code is obtained by using Gimp drawing the icon and opening it with word pad to get the code

DS3231.h (6.02 KB)

DHT.h (2.46 KB)

nRF24L01.h (3.42 KB)

RF24.h (72.8 KB)

U8g2lib.h (956 KB)

Dougn2ib:
The url provided here will have everything that I have done as far as this project goes.

Then why is the code you posted here different from the code in that tutorial?

Also, why does the output you attached not match the code you posted here:

Receiver:19:1: error: 'dht' does not name a type

 dht DHT; // Creats a DHT object

but line 19 of the code you posted is:

DHT22 dth; // Creats a DHT object

I followed that tutorial and it compiles fine for me. I suspect that you have not faithfully followed the tutorial, and then didn't bother to tell us what you changed. Look, we're here to help you, but we can only do that if you give us all the information we need. For now, the only advice I can give is that you delete everything and start from scratch, following the tutorial exactly. If there is some part of the instructions in the tutorial you don't understand, come back here with specific questions and we'll help out.

My suspicion is that you found it difficult to install the DHTlib linked from the tutorial, so you decided that instead of figuring out how to install it you would instead install a completely different DHT library. When you found that didn't work, you made some attempts to modify the sketch to work with the library it wasn't written for.

That change there was where I attempted to get it to move past that point but very next issue was the rtc so not sure how you got it to verify so if your just wanting to criticize one line (19) that you found different and not ask why I changed it don't bother. I only asked for help because I was in need of some input by those I thought might help and know more than I do...it's a hobby for me not a career and this was to give my wife validation for my buying so many Arduino products but hey have a nice life I'll figure it out sooner or later

Dougn2ib:
That change there was where I attempted to get it to move past that point

And you didn't think it was worth mentioning that?

Dougn2ib:
not sure how you got it to verify

By following the tutorial.

Dougn2ib:
I only asked for help

I already gave you as much help as I can based on the information you provided. As I said before:

  • Delete everything.
  • Follow the tutorial exactly.
  • If you get stuck on something, come back here and explain the problem and I'll tell you what to do.

Dougn2ib:
I'll figure it out sooner or later

Whether it's sooner or later is up to you. If you had provided all the information we needed from the start, you would have had a solution within a matter of minutes. But if you want to drag this out over a course of days, that's your prerogative.

Okay now let me first apologize my frustration was high and didn't expect for the reaction that I received all I was looking for was some guidance which in a round about way I got it from Brattian, after your comments and such I watched his video several times stopping it numerous times making notes and comparing his code to what I had and going back forth and I discovered as you said it was in the dht area I had some how copied code from my other wireless weather station that I was working using the 433Mhz module into Dejan's project (I even went as far as screen shutting his video to compare) but anyhow the code had to do with the dht portion. When I was told that I wasn't telling the truth about what I had infuriated me because if I'm seeking help I'm going to withhold info deliberately, it's not like I'm working on a top secret project, but by you saying that it had to be in the dht area that I was having trouble that where I focused on it and it's alive now to figure out how to convert Celcius to Farenheit in the sketch without messing that up is my goal. Thanks for helping me even if your way did make me upset guess that's what it takes to make me think harder.

I'm very glad to hear it's working now. Enjoy!