Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. Add radio NRF24 to sketch

Add radio NRF24 to sketch

Scheduled Pinned Locked Moved Domoticz
2 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jordantheripper
    wrote on last edited by
    #1

    Hi people. I have a little question to ask. Today I made this sketch for arduino uno. This sketch let me read temperature and humidity on a lcd i2c and it works great. But in this way, it works alone. I would like to connect it to domoticz. So I have to add radio and relative child id
    (#define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1)
    to the sketch to connect it in Domoticz.
    this is the sketch:
    //Libraries
    #include <DHT.h>
    #include <Wire.h>
    #include <LCD.h>
    #include <LiquidCrystal_I2C.h>

    //Constants
    #define DHTPIN 4 // what pin we're connected to
    #define DHTTYPE DHT22 // DHT 22 (AM2302)
    DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

    //ALWAYS USE THIS WITH LCD I2C and Addres 0x3F
    #define I2C_ADDR 0x3F
    #define BACKLIGHT_PIN 3
    #define En_pin 2
    #define Rw_pin 1
    #define Rs_pin 0
    #define D4_pin 4
    #define D5_pin 5
    #define D6_pin 6
    #define D7_pin 7
    LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

    //Variables
    int chk;
    float hum; //Stores humidity value
    float temp; //Stores temperature value

    void setup()
    {
    Serial.begin(9600);
    dht.begin();
    lcd.begin(16,2);
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);
    }

    void loop()
    {

    delay(2000);
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp = dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");

    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Temp: ");
    lcd.print(temp);
    lcd.print(" ");
    lcd.print((char)223);
    lcd.print("C");
    lcd.setCursor(0,1);
    lcd.print("Hum: ");
    lcd.print(hum);
    lcd.print(" %");

    delay(2000); //Delay 2 sec.

    }

    so, can you help me to add radio NRF24 and connect it to domoticz?
    Thanks so much from Italy

    S 1 Reply Last reply
    0
    • J jordantheripper

      Hi people. I have a little question to ask. Today I made this sketch for arduino uno. This sketch let me read temperature and humidity on a lcd i2c and it works great. But in this way, it works alone. I would like to connect it to domoticz. So I have to add radio and relative child id
      (#define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1)
      to the sketch to connect it in Domoticz.
      this is the sketch:
      //Libraries
      #include <DHT.h>
      #include <Wire.h>
      #include <LCD.h>
      #include <LiquidCrystal_I2C.h>

      //Constants
      #define DHTPIN 4 // what pin we're connected to
      #define DHTTYPE DHT22 // DHT 22 (AM2302)
      DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

      //ALWAYS USE THIS WITH LCD I2C and Addres 0x3F
      #define I2C_ADDR 0x3F
      #define BACKLIGHT_PIN 3
      #define En_pin 2
      #define Rw_pin 1
      #define Rs_pin 0
      #define D4_pin 4
      #define D5_pin 5
      #define D6_pin 6
      #define D7_pin 7
      LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

      //Variables
      int chk;
      float hum; //Stores humidity value
      float temp; //Stores temperature value

      void setup()
      {
      Serial.begin(9600);
      dht.begin();
      lcd.begin(16,2);
      lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
      lcd.setBacklight(HIGH);
      }

      void loop()
      {

      delay(2000);
      //Read data and store it to variables hum and temp
      hum = dht.readHumidity();
      temp = dht.readTemperature();
      //Print temp and humidity values to serial monitor
      Serial.print("Humidity: ");
      Serial.print(hum);
      Serial.print(" %, Temp: ");
      Serial.print(temp);
      Serial.println(" Celsius");

      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Temp: ");
      lcd.print(temp);
      lcd.print(" ");
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0,1);
      lcd.print("Hum: ");
      lcd.print(hum);
      lcd.print(" %");

      delay(2000); //Delay 2 sec.

      }

      so, can you help me to add radio NRF24 and connect it to domoticz?
      Thanks so much from Italy

      S Offline
      S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      @jordantheripper Hi!
      Check this out: https://www.mysensors.org/about/arduino#basic-structure-of-sketches

      You can also check out any example in https://www.mysensors.org/build to get an idea how it should be written.
      Its very easy, just give it a try.

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      1 Reply Last reply
      1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      16

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular