11months on battery at 87%... still working!
palmerfarmer
@palmerfarmer
Best posts made by palmerfarmer
-
RE: Clock Sketch (RTC) modified for 1.8" LCD
Thanks for the speedy reply, I owe you a beer! works perfectly.
-
RE: My 2AA battery sensor
I got it from CPC in the UK which are owned by Farnell
https://cpc.farnell.com/hammond/1593qgy/case-with-bat-compart-110x66x28mm/dp/EN82140
You may have to make a slight mod to the board or enclosure to make it fit.
good luck -
RE: Multiple BME280 sensor for Domoticz
Thanks for the reply and spotting one of my many errors (now corrected amongst others!).
Managed to get one of them showing up in Domoticz, lets see if i can get them both in there without the temp hum being crossed over between physical sensors. There seems to be a few posts about this problem.
Latest posts made by palmerfarmer
-
RE: My 2AA battery sensor
I got it from CPC in the UK which are owned by Farnell
https://cpc.farnell.com/hammond/1593qgy/case-with-bat-compart-110x66x28mm/dp/EN82140
You may have to make a slight mod to the board or enclosure to make it fit.
good luck -
2 or more DHT22 on 1 node with Domoticz
I wonder if any one can help with my (hacked and borrowed) sketch that inlcudes x2 DHT22 sensors on one node. Before I start I think my problem is the way Domoticz handles the data so this post probably shouldn't even be on here.
My sketch below works in the Mysensors serial monitor and i even have a version with a TFT lcd display, all correct. The problem is when it appears in domoticz the humidity from one sensor appears on the other and the 2nd hum is ignored.... for a few seconds it then randomly appears on the correct sensor. There seems to be a few posts problems but with no solution. Can anyone help?Mysensors 2.3.1
Domoticz 4.11506
Tested on Arduino nano and NodeMcu (same results)#define MY_RADIO_RF24 #define MY_RF24_PA_LEVEL (RF24_PA_MIN) #define MY_NODE_ID 114 //taken from the original and mysensors forum //http://forum.mysensors.org/topic/1393/2-or-more-dht11-sensors-on-one-arduino-nano-mysensor/8 //http://forum.mysensors.org/topic/1462/getting-node-id-0-after-erasing-eeprom #include <SPI.h> #include <MySensors.h> #include <DHT.h> //dht22 //Definition of sensor #define CHILD_ID1_HUM 1 #define CHILD_ID1_TEMP 3 #define CHILD_ID2_HUM 2 #define CHILD_ID2_TEMP 4 const int HUMIDITY_SENSOR1_DIGITAL_PIN = D0; const int HUMIDITY_SENSOR2_DIGITAL_PIN = D1; unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) //MySensor; DHT dht1; DHT dht2; float lastTemp1; float lastHum1; float lastTemp2; float lastHum2; boolean metric = true; MyMessage msgHum1(CHILD_ID1_HUM, V_HUM); MyMessage msgTemp1(CHILD_ID1_TEMP, V_TEMP); MyMessage msgHum2(CHILD_ID2_HUM, V_HUM); MyMessage msgTemp2(CHILD_ID2_TEMP, V_TEMP); void setup() { // begin(); dht1.setup(HUMIDITY_SENSOR1_DIGITAL_PIN); dht2.setup(HUMIDITY_SENSOR2_DIGITAL_PIN); // Send the Sketch Version Information to the Gateway sendSketchInfo("2DHT22_ESP8266", "V2"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID1_HUM, S_HUM); present(CHILD_ID1_TEMP, S_TEMP); present(CHILD_ID2_HUM, S_HUM); present(CHILD_ID2_TEMP, S_TEMP); // metric = getConfig().isMetric; } void loop() { //DHT 11 Sensor 1 delay(dht1.getMinimumSamplingPeriod()); float temperature1 = dht1.getTemperature(); if (isnan(temperature1)) { Serial.println("Failed reading temperature from DHT 1"); } else if (temperature1 != lastTemp1) { lastTemp1 = temperature1; if (!metric) { temperature1 = dht1.toFahrenheit(temperature1); } send(msgTemp1.set(temperature1, 1)); Serial.print("T1: "); Serial.println(temperature1); } float humidity1 = dht1.getHumidity(); if (isnan(humidity1)) { Serial.println("Failed reading humidity from DHT 1"); } else if (humidity1 != lastHum1) { lastHum1 = humidity1; send(msgHum1.set(humidity1, 1)); Serial.print("H1: "); Serial.println(humidity1); } delay(500); // DHT11 Sensor 2 { delay(dht2.getMinimumSamplingPeriod()); float temperature2 = dht2.getTemperature(); if (isnan(temperature2)) { Serial.println("Failed reading temperature from DHT 2"); } else if (temperature2 != lastTemp2) { lastTemp2 = temperature2; if (!metric) { temperature2 = dht2.toFahrenheit(temperature2); } send(msgTemp2.set(temperature2, 1)); Serial.print("T2: "); Serial.println(temperature2); } float humidity2 = dht2.getHumidity(); if (isnan(humidity2)) { Serial.println("Failed reading humidity from DHT 2"); } else if (humidity2 != lastHum2) { lastHum2 = humidity2; send(msgHum2.set(humidity2, 1)); Serial.print("H2: "); Serial.println(humidity2); } sleep(SLEEP_TIME); //sleep a bit delay (2000); } }
-
RE: Why are the measured values so different? Are my humidity sensors faulty?
@benhub do you have the code the links seem dead? Ive been trying to get 2 temp/hum sensors (DHT22) working in domoticz for quite a while now with no luck. The temp/hum data in domotcz keeps swapping around from one sensor to the other and i cant work out why.
-
RE: Multiple BME280 sensor for Domoticz
Thanks for the reply and spotting one of my many errors (now corrected amongst others!).
Managed to get one of them showing up in Domoticz, lets see if i can get them both in there without the temp hum being crossed over between physical sensors. There seems to be a few posts about this problem. -
Multiple BME280 sensor for Domoticz
Hi,
I'm trying to build a node that uses x2 BME280 sensors for a whole house fan controller, one inside temp/hum and one outside. The BME280 has a selectable I2C address by grounding the SDO pin on the sensor. I have successfully tested this using the BlueDot_BME280.h library and sketches.
Problem I am having is turning this sketch into a working Mysensors node I can use in domoticz. I think I'm almost there but cannot see why i am getting an 'invalid use of non-static member function' message.
here is my hacked code...I thought i would try and get it working with one BME280 first..
/*************************************************************************** Example for BME280 Weather Station using two Sensors with I2C Protocol written by Thiago Barros for BlueDot UG (haftungsbeschränkt) BSD License This sketch was written for the Bosch Sensor BME280. The BME280 is a MEMS device for measuring temperature, humidity and atmospheric pressure. For more technical information on the BME280, please go to ------> http://www.bluedot.space ***************************************************************************/ #define MY_DEBUG #define MY_RADIO_NRF24 //#define MY_RF24_CE_PIN 49 //only required for Mega //#define MY_RF24_CS_PIN 53 //only required for Mega #define MY_RF24_PA_LEVEL (RF24_PA_MIN) #define MY_NODE_ID 57 #include <SPI.h> #include <Wire.h> #include "BlueDot_BME280.h" #include <MySensors.h> #define BARO_CHILD 0 //these will appear in domoticz child list for this node #define TEMP_CHILD 1 #define HUM_CHILD 2 long interval = 60000; // interval at which to send (milliseconds) long previousMillis = interval; // will store last time data was sent BlueDot_BME280 bme1; //Object for Sensor 1 BlueDot_BME280 bme2; //Object for Sensor 2 int bme1Detected = 0; ///int bme2Detected = 0; float dP_dt; boolean metric; MyMessage tempMsg(TEMP_CHILD, V_TEMP); MyMessage humMsg(HUM_CHILD, V_HUM); MyMessage pressureMsg(BARO_CHILD, V_PRESSURE); void setup() { metric = getControllerConfig().isMetric; // was getConfig().isMetric; before MySensors v2.1.1 Wire.begin(); // Wire.begin(sda, scl) // use the 1.1 V internal reference #if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif Serial.begin(115200); bme1.parameter.communication = 0; //Setting communication for Sensor 1 (bme1) // bme2.parameter.communication = 0; //Setting communication for Sensor 2 (bme2) bme1.parameter.I2CAddress = 0x77; //I2C Address for Sensor 1 (bme1) // bme2.parameter.I2CAddress = 0x76; //I2C Address for Sensor 2 (bme2) bme1.parameter.sensorMode = 0b11; //In normal mode the sensor measures continually (default value) // bme2.parameter.sensorMode = 0b11; bme1.parameter.IIRfilter = 0b000; //factor 0 (filter off) // bme2.parameter.IIRfilter = 0b000; //factor 16 (default value) bme1.parameter.humidOversampling = 0b101; //factor 16 // bme2.parameter.humidOversampling = 0b101; //factor 16 bme1.parameter.tempOversampling = 0b101; //factor 16 // bme2.parameter.tempOversampling = 0b101; //factor 16 bme1.parameter.pressOversampling = 0b101; //factor 16 // bme2.parameter.pressOversampling = 0b101; //factor 16 bme1.parameter.tempOutsideCelsius = 10; //default value of 15°C // bme2.parameter.tempOutsideCelsius = 10; //default value of 15°C if (bme1.init() != 0x60) { Serial.println(F("First BME280 Sensor not found!")); Serial.println(F("Please check your connections.")); bme1Detected = 0; } else { Serial.println(F("First BME280 Sensor detected!")); bme1Detected = 1; } Serial.println(); Serial.println(); } void presentation() { sendSketchInfo("BME x2 I2C master ", "V2.a"); // Register sensors to gw (they will be created as child devices) present(BARO_CHILD, S_BARO); present(TEMP_CHILD, S_TEMP); present(HUM_CHILD, S_HUM); } void loop() { Serial.print(F("Duration in Seconds:\t\t\t\t")); Serial.println(float(millis()) / 1000); if (bme1Detected) { Serial.print(F("Temperature in Celsius from Sensor 1:\t\t")); Serial.println(bme1.readTempC()); Serial.print(F("Humidity in % from Sensor 1:\t\t\t")); Serial.println(bme1.readHumidity()); Serial.print(F("Pressure in hPa from Sensor 1:\t\t\t")); Serial.println(bme1.readPressure()); } else { Serial.print(F("Temperature in Celsius from Sensor 1:\t\t")); Serial.println(F("Null")); Serial.print(F("Humidity in % from Sensor 1:\t\t\t")); Serial.println(F("Null")); Serial.print(F("Pressure in hPa from Sensor 1:\t\t\t")); Serial.println(F("Null")); { send(humMsg.set(bme1.readHumidity, 1)); wait(50); // send(humMsg.set(humidity, 1)); //wait(50); delay(5000); } }}
-
RE: Clock Sketch (RTC) modified for 1.8" LCD
Thanks for the speedy reply, I owe you a beer! works perfectly.
-
Clock Sketch (RTC) modified for 1.8" LCD
Just embarking on making the 'Real Time Clock Module, LCD Display and Controller Time' sketch to use with a 1.8" lcd 128x160 ST7735. Problem i have is trying to get it to display the correct format of time.
eg I would like to display:-
06:03:09 instead of 6: 3: 9 for the time and equivelant for the date too. This is a problem when the numbers reach double figures as you get false times because it doenst clear.I think i need to use something similar to this;
if (digits < 10)
myGLCD.printNumI('0');I am using the UTFT libraires but cannot work out the correct syntax.
the pic below is not a great example as the time when i took this was all double digit numbers the date and month are single. but need it to say 06/01/20
below is my code/** The MySensors Arduino library handles the wireless radio link and protocol between your home built sensors/actuators and HA controller of choice. The sensors forms a self healing radio network with optional repeaters. Each repeater and gateway builds a routing tables in EEPROM which keeps track of the network topology allowing messages to be routed to nodes. Created by Henrik Ekblad <henrik.ekblad@mysensors.org> Copyright (C) 2013-2015 Sensnology AB Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors Documentation: http://www.mysensors.org Support Forum: http://forum.mysensors.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. ******************************* NB uses 1.8inch LCD rememeber to edit the memorysaver.h file and only leave ST7735 REVISION HISTORY Version 1.0 - Henrik Ekblad DESCRIPTION Example sketch showing how to request time from controller which is stored in RTC module The time and temperature (DS3231/DS3232) is shown on an attached Crystal LCD display Wiring (radio wiring on www.mysensors.org) ------------------------------------ Arduino RTC-Module I2C Display ------------------------------------ GND GND GND +5V VCC VCC A4 SDA SDA A5 SCL SCL http://www.mysensors.org/build/display */ // Enable debug prints to serial monitor //#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 #define MY_RF24_PA_LEVEL (RF24_PA_MIN) #define MY_NODE_ID 40 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensors.h> #include <TimeLib.h> //this is where tm.Hour tm.Min comes from #include <DS3232RTC.h> // A DS3231/DS3232 library #include <Wire.h> #include <UTFT.h> extern uint8_t BigFont[]; //extern uint8_t SmallFont[]; extern uint8_t Grotesk16x32[]; UTFT myGLCD(ITDB18SP, 5, 4, 8, 7, 6); //remember to edit the memorysaver.h file and only leave ST7735XX bool timeReceived = false; unsigned long lastUpdate = 0, lastRequest = 0; void setup() { // the function to get the time from the RTC setSyncProvider(RTC.get); // Request latest time from controller at startup requestTime(); // initialize the lcd fort myGLCD.InitLCD(LANDSCAPE);// or PORTRAIT myGLCD.clrScr(); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Clock Basic Master", "2.0"); } // This is called when a new time value was received void receiveTime(unsigned long controllerTime) { // Ok, set incoming time //Serial.print("Time value received: "); //Serial.println(controllerTime); RTC.set(controllerTime); // this sets the RTC to the time from controller - which we do want periodically timeReceived = true; } void loop() { myGLCD.setColor(255, 255, 255); unsigned long now = millis(); // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every hour if ((!timeReceived && (now - lastRequest) > (10UL * 1000UL)) || (timeReceived && (now - lastRequest) > (60UL * 1000UL * 60UL))) { // Request time from controller. //Serial.println("requesting time"); requestTime(); lastRequest = now; } // Update display every second if (now - lastUpdate > 1000) { updateDisplay(); lastUpdate = now; } } void updateDisplay() { tmElements_t tm; RTC.read(tm); // Print date and time //lcd.home(); myGLCD.setColor(80, 80, 200); myGLCD.setFont(Grotesk16x32); myGLCD.printNumI(tm.Hour, 10 , 20); myGLCD.print(":", 45, 20); myGLCD.printNumI(tm.Minute, CENTER, 20); myGLCD.print(":", 100, 20); myGLCD.printNumI(tm.Second, 115, 20); myGLCD.setFont(BigFont); myGLCD.setColor(255, 255, 0); myGLCD.printNumI(tm.Day, 15 , 65); myGLCD.print("/", 45, 65); myGLCD.printNumI(tm.Month, CENTER, 65); myGLCD.print("/" , 90, 65); myGLCD.printNumI(tmYearToCalendar(tm.Year) - 2000, 110, 65); myGLCD.print("T: ", 30, 95); myGLCD.printNumI(RTC.temperature() / 4, CENTER, 95 ); myGLCD.print("o", 95, 90); // Degree-sign myGLCD.print("C", 107, 95); } /* void print2digits(int number) { if (number >= 0 && number < 10) { myGLCD.print("0",CENTER, 65 ); } // myGLCD.print(number); } /* void printNumI(int digits) { if (digits < 10) myGLCD.printNumI('0'); myGLCD.print(digits); /* original sketch had this below for 16x4 LCD void printDigits(int digits) { if (digits < 10) lcd.print('0'); lcd.print(digits); } */
-
RE: Multiple DHT22 in one sensor for greenhouse (newbee question)
Is there a way i could display the temp and hum for each sensor on an lcd screen?
I know how to do this for data that is not using pointers.
below is my sketch that flips between 2 sensors on the LCD/* test modified from a v1 basic mutliple multi dht22 sketch Gives correct temp and humidity readings for each dht22 in domoticz (ie not crossed between 1 and 2) Not displaying properly on the LCD yet Domoticz ver 4.11558 beta Gateway 3.2.1 node 3.2.1 09/12/2019 Arduino Mega 1.8 inch TFT LCD Display 128x160 8/16Bit ST7735S x2 DHT22 NRF24 */ #define MY_DEBUG #define MY_RADIO_NRF24 //Mega Pins 49 CE, 53 CSN/CS, 52 SCK, 51 MOSI, 50 MISO #define MY_RF24_CE_PIN 49 #define MY_RF24_CS_PIN 53 #define MY_RF24_PA_LEVEL (RF24_PA_MIN) #define MY_NODE_ID 103 #include <UTFT.h> //LCD 1.8 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define RELAY1 44 #define RELAY2 45 //static const uint8_t FORCE_UPDATE_N_READS = 10; extern uint8_t BigFont[]; extern uint8_t SmallFont[]; #define NUM_SENSORS 2 unsigned long SLEEP_TIME = 6000; // Sleep time between reads (in milliseconds) //MySensor gw; MyMessage tempMssg(0, V_TEMP); MyMessage humMssg(NUM_SENSORS, V_HUM); byte tempID[NUM_SENSORS] = {0, 1}; byte humID[NUM_SENSORS] = {2, 3}; DHT* dht[NUM_SENSORS]; byte sensorPin[NUM_SENSORS] = {40, 42}; float lastTemp[NUM_SENSORS] = {0.0, 0.0}; float lastHum[NUM_SENSORS] = {0.0, 0.0}; boolean metric = true; //LCD setup UTFT myGLCD(ITDB18SP, 11, 12, 8, 9, 10); // lcd pins 3,2,6,5,4 void setup() { myGLCD.InitLCD(LANDSCAPE);// or PORTRAIT myGLCD.clrScr(); myGLCD.setColor(200, 255, 255); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(SmallFont); myGLCD.print("Version & Sketch", LEFT, 3); myGLCD.print("V.2 TEST5", LEFT, 16); delay(1000); myGLCD.clrScr(); myGLCD.setFont(SmallFont); myGLCD.setColor(255, 255, 255); myGLCD.print("TH1 OUTSIDE", 2, 2); myGLCD.print("o", 67, 12); myGLCD.print("C", 74, 15); myGLCD.print("%", 150, 15); myGLCD.print("TH2 INSIDE", 2, 36); myGLCD.print("o", 67, 46); myGLCD.print("C", 74, 49); myGLCD.print("%", 150, 49); Serial.begin(9600); // begin(); for (int i = 0; i < NUM_SENSORS; i++) { dht[i] = new DHT; dht[i]->setup(sensorPin[i]); } sendSketchInfo("DHT22 Humidity test5", "2.0"); for (int i = 0; i < NUM_SENSORS; i++) { present(tempID[i], S_TEMP); present(humID[i], S_HUM); } metric = getControllerConfig().isMetric; Serial.println(F("Setup Complete.")); } void loop() { for (int i = 0; i < NUM_SENSORS; i++) { delay(dht[i]->getMinimumSamplingPeriod()); float temperature = dht[i]->getTemperature(); if (isnan(temperature)) { Serial.print(F("Failed reading temperature from DHT")); Serial.println(i); } else if (temperature != lastTemp[i]) { lastTemp[i] = temperature; if (!metric) { temperature = dht[i]->toFahrenheit(temperature); } send(tempMssg.setSensor(i).set(temperature, false)); // no ack Serial.print(F("T")); Serial.print(i); Serial.print(F("= ")); Serial.println(temperature); } myGLCD.setFont(BigFont); myGLCD.setColor(100, 255, 255); myGLCD.printNumF(temperature, 1, 1, 15); // this where something needs to be changed to get it to display each temp separately float humidity = dht[i]->getHumidity(); if (isnan(humidity)) { Serial.print("Failed reading humidity from DHT"); Serial.println(i); } else if (humidity != lastHum[i]) { lastHum[i] = humidity; send(humMssg.setSensor(i).set(humidity, false)); // no ack Serial.print(F("H")); Serial.print(i); Serial.print(F("= ")); Serial.println(humidity); // this where something needs to be changed to get it to display each hum separately myGLCD.setFont(BigFont); myGLCD.setColor(100, 255, 255); myGLCD.printNumF(humidity, 1, 85, 15); } } sleep(SLEEP_TIME); //sleep a bit }```
-
RE: Anyone help with 4 relays please?
Ah ok, good to know. I also spoke too soon....
Today they were unstable, I noticed that some of the on /off commands were not being recieved (small LED flash on the arduino) looked at the logs on domoricz they were fine, however the serial monitor on the arduino node confirmed they weren't always being seen.
Have changed the mysensors libraries on the node to be the same as the usb gateway and its all stable again.
next action will be to monitor the logs on the gateway, node and domoticz at the same timeI have one of those blue 4 relay units from ebay, the jumper has been removed so only the LED lights when i activate the channel.