Alexander
Published © MIT

Wireless Stunts

Make receiver for Oregon thermo-hygro sensor.

BeginnerProtip1 hour5,793
Wireless Stunts

Things used in this project

Hardware components

Oregon Thermo-Hygro Sensor THGN123N
×1
Arduino Nano R3
Arduino Nano R3
×1
Superheterodyne RXB6 sensor
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The receiver schematics

Code

Receiver sketch

C/C++
#include <WlessOregonV2.h>

#include <LiquidCrystal.h>

// The LCD 1602 parallel interface
const byte LCD_RS_PIN     = 12;
const byte LCD_E_PIN      = 11;
const byte LCD_DB4_PIN    = 5;
const byte LCD_DB5_PIN    = 4;
const byte LCD_DB6_PIN    = 3;
const byte LCD_DB7_PIN    = 13;

 
OregonDecoderV2 orscV2;
LiquidCrystal lcd(LCD_RS_PIN, LCD_E_PIN, LCD_DB4_PIN, LCD_DB5_PIN, LCD_DB6_PIN, LCD_DB7_PIN);

void setup () {
  Serial.begin(115200);
  lcd.begin(16, 2);
  lcd.clear();
  orscV2.begin(0);
  lcd.print(F("Please, wait..."));
}
 
void loop () {
  static char bOK[] = "batt OK  ";
  static char bNO[] = "batt NoOK";

  int  temp   = 0;
  byte humm   = 0;
  byte ch     = 0;
  byte id     = 0;
  bool battOK = false;
  if (orscV2.receiveData(ch, id, temp, humm, battOK)) {
      lcd.clear();
      char buff[16];
      char minus = ' ';
      if (temp < 0) {
        minus = '-';
        temp *= -1;
      }
      sprintf(buff, "T %c%d.%d %X %X", minus, temp/10, temp%10, ch, id);
      lcd.print(buff);
      lcd.setCursor(0, 1);
      char *p = bNO;
      if (battOK) p = bOK;
      sprintf(buff, "H %d%c %s", humm, '%', p);
      lcd.print(buff);
      Serial.print("Channel = ");   Serial.print(ch, HEX);
      Serial.print(", Sensor ID = "); Serial.print(id, HEX);
	    Serial.print("; Temp = ");     Serial.print(minus); Serial.print(temp/10); Serial.print("."); Serial.print(temp%10);
	    Serial.print(", Humm = ");    Serial.println(humm);
  }

}

Credits

Alexander

Alexander

31 projects • 292 followers
Where is John Galt?

Comments