Hey.
If i need change nrf tx power in arduino sketch. This is right ?
#define MY_RF24_PA_LEVEL RF24_PA_LOW
Hey.
If i need change nrf tx power in arduino sketch. This is right ?
#define MY_RF24_PA_LEVEL RF24_PA_LOW
@Richard-van-der-Plas what is this: HASS ?
This is really stupid. RFM69 radio need powered separately ?
This is working with latest mysensors library ?
@gohan said in Moisture sensing + relay. Please help with software.:
I think you forgot to close a parenthesis in the receive function. If you like a more helping programming interface, you can install visual studio and the extension Visual Micro that are much better than Arduino IDE and help you also visually with parenthesis and auto completion of functions and variables names.
I use linux. Ubuntu. For linux what software ?
Line 84 a function-definition is not allowed here before '{' token
I put these 2 line with include after defines.
Arduino/libraries/MySensors/MySensors.h:328:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
I want this for Arduino Nano.
and code is here
#include <SPI.h>
#include <MySensors.h>
#define MY_RADIO_NRF24
#define MY_GATEWAY_SERIAL
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define MY_DEBUG
#define CHILD_ID_BATTERY 0
#define SLEEP_TIME 600000 // Sleep time between reads (in milliseconds)
#define STABILIZATION_TIME 500 // Let the sensor stabilize 0.5 seconds before reading
#define BATTERY_FULL 3000 // 3,000 millivolts when battery is full (assuming 2xAA)
#define BATTERY_ZERO 1700 // 1,700 millivolts when battery is empty (reqires blown brownout detection fuse, use 2,800 otherwise)
// This sketch assumes power from 2xAA on Vcc (not RAW). Remove the power led and the voltage regulator for better battery life.
// Sensors shall be connected to GND and their analog pin. Throw away the middle chip, just use the pitchfork.
// Number of analog pins for each Arduino model can be seen at https://www.arduino.cc/en/Products/Compare
// A5 and A6 on most Arduinos cannot be used because they don't have internal pullups
const int SENSORS[] = {A0, A1, A2, A3, A4, A5}; // Remove the pins that you don't want to use
#define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
long oldvoltage = 0;
#define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 1 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
MyMessage moisture_messages[N_ELEMENTS(SENSORS)];
MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
void before()
{
for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
}
}
void setup()
{
//gw.begin();
sendSketchInfo("Plants moisture w bat", "1.2");
present(CHILD_ID_BATTERY, S_CUSTOM);
sendSketchInfo("Relay", "1.0");
for (int sensor = 0; sensor < N_ELEMENTS(SENSORS); sensor++) {
moisture_messages[sensor].sensor = sensor + 1; // Battery uses child ID 0 so sensors start at 1
moisture_messages[sensor].type = V_HUM;
delay(250);
gw.present(sensor + 1, S_HUM);
}
for (int i = 0; i < N_ELEMENTS(SENSORS); i++) {
pinMode(SENSORS[i], OUTPUT);
digitalWrite(SENSORS[i], LOW);
}
for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
}
}
void receive(const MyMessage &message)
{
{
// We only expect one type of message from controller. But we better check anyway.
if (message.type == V_STATUS) {
// Change relay state
digitalWrite(message.sensor - 1 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
// Store state in eeprom
saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
void loop()
for (int sensor = 0; sensor < N_ELEMENTS(SENSORS); sensor++) {
pinMode(SENSORS[sensor], INPUT_PULLUP); // "Power on" the sensor and activate the internal pullup resistor
analogRead(SENSORS[sensor]); // Read once to let the ADC capacitor start charging
sleep(STABILIZATION_TIME);
int moistureLevel = (1023 - analogRead(SENSORS[sensor])) / 10.23;
// Turn off the sensor to conserve battery and minimize corrosion
pinMode(SENSORS[sensor], OUTPUT);
digitalWrite(SENSORS[sensor], LOW);
send(moisture_messages[sensor].set(moistureLevel));
}
long voltage = readVcc();
if (oldvoltage != voltage) { // Only send battery information if voltage has changed, to conserve battery.
send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts and set wants volts and how many decimals (3 in our case)
sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO)));
oldvoltage = voltage;
}
sleep(SLEEP_TIME);
}
long readVcc()
}
// From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
// Read 1.1V reference against AVcc
// set the reference to Vcc and the measurement to the internal 1.1V reference
#if defined(AVR_ATmega32U4) || defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#elif defined (AVR_ATtiny24) || defined(AVR_ATtiny44) || defined(AVR_ATtiny84)
ADMUX = _BV(MUX5) | _BV(MUX0);
#elif defined (AVR_ATtiny25) || defined(AVR_ATtiny45) || defined(AVR_ATtiny85)
ADMUX = _BV(MUX3) | _BV(MUX2);
#else
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#endif
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Start conversion
while (bit_is_set(ADCSRA, ADSC)); // measuring
uint8_t low = ADCL; // must read ADCL first - it then locks ADCH
uint8_t high = ADCH; // unlocks both
long result = (high << | low;
result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.110231000
return result; // Vcc in millivolts
}
I try but without luck.
My skill in programming is low. I make something for last 2.x library but some errors. Moisture sensors A0-A5 and if possible add relays from relay sketch.
https://pastebin.com/VRXyT8Ut
I want to add same harware these two components.
@gohan
Please help with small errors. https://pastebin.com/VRXyT8Ut I try for library 2.x
@gohan said in Office plant monitoring:
but I'd suggest to stick to the new version
I try but idonotknow.
@gohan I make something this. Please look if all is right. My software writer skill is low. Some small errors.
https://pastebin.com/8LWpgb8L
Please somebody help me add to skech one relay for water pump. I use this in Domoticz. I do not want build other hardware for this.It is possible ?
Hei.
How to connect arduino to electricity meter pulse out. Not to led.
What sketch you use ? I cant get yesterday this working. GW is last 2.1, serial monitor printing fine and all is ok but i do not see this sensor in Domoticz
This pa level is in line 437 #define MY_RF24_PA_LEVEL RF24_PA_MAX ? For serial gateway.
Can i use signal power MAX in mysensors 2.0 library with this wifi module for nrf ? Or nrf need extra power supply ?
I do not understand. My boiler is 3KW. https://1drv.ms/i/s!AtuQgBKT8NIPhi4F_I3mPVYW0S9P
Small question. I want to try this but some errors. Library is installed with library manager. Ubuntu 16.04 and last Arduino ide.
First try IDE not find library and i change in line 29 #include <MySensor.h> to #include <MySensors.h> add only s
and then this error.
motion_dht22_led_dimmer:44: error: 'MySensor' does not name a type
MySensor gw(9,10);
Please look right connection diagram. Not nrf24l01+. and you see how to connect. If you do not see you van watch with glasses.
@xlibor Where these? Stabilizer and diode what needed replace with wire.
#include <EEPROM.h>
#include <SPI.h>
#include <ArduinoOTA.h>
// Enable debug prints to serial monitor
#define MY_DEBUG
// Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
#define MY_BAUD_RATE 9600
// Enables and select radio type (if attached)
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#define MY_GATEWAY_ESP8266
#define MY_ESP8266_SSID "home"
#define MY_ESP8266_PASSWORD "123456789"
// Set the hostname for the WiFi Client. This is the hostname
// it will pass to the DHCP server if not static.
#define MY_ESP8266_HOSTNAME "ota-gateway-CH.100"
// Enable UDP communication
//#define MY_USE_UDP
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 10, 124, 77, 101
// If using static ip you need to define Gateway and Subnet address as well
#define MY_IP_GATEWAY_ADDRESS 10, 124, 77, 176
#define MY_IP_SUBNET_ADDRESS 255, 255, 255, 0
// The port to keep open on node server mode
#define MY_PORT 5003
// How many clients should be able to connect to this gateway (default 1)
#define MY_GATEWAY_MAX_CLIENTS 1
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 10, 124, 77, 46
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
// #define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Flash leds on rx/tx/err
// #define MY_LEDS_BLINKING_FEATURE
// Set blinking period
// #define MY_DEFAULT_LED_BLINK_PERIOD 300
// Led pins used if blinking feature is enabled above
#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED
#if defined(MY_USE_UDP)
#include <WiFiUDP.h>
#else
#include <ESP8266WiFi.h>
#endif
#include <MySensors.h>
void setup() {
ArduinoOTA.onStart( {
Serial.println("ArduinoOTA start");
});
ArduinoOTA.onEnd( {
Serial.println("\nArduinoOTA end");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void presentation() {
// Present locally attached sensors here
}
void loop() {
// Send locally attech sensors data here
ArduinoOTA.handle();
}
I set in sketch static ip aadress and if esp booting and connected to lan i see in serial monitor
Connected with home, channel 1
dhcp client start...
chg_B1:-40
0;255;3;0;9;TSM:READY
f r-40, scandone
...................pm open,type:2 0
......................................................................................................................................................................................................................................................................................................................0๏ฟฝ~?๏ฟฝ4๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝOCAZ๏ฟฝ๏ฟฝ0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGE--,VER=2.0.1-beta
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
chg_B1:-40
I connect this sensor to Arduino Nano and some errors
/home/insippo/sketchbook/libraries/ArduinoMotionSensorExample/inv_mpu.cpp:47:0: warning: "min" redefined
#define min(a,b) ((a<b)?a:b)
^
In file included from /home/insippo/sketchbook/libraries/ArduinoMotionSensorExample/I2Cdev.h:77:0,
from /home/insippo/sketchbook/libraries/ArduinoMotionSensorExample/inv_mpu.h:24,
from /home/insippo/sketchbook/libraries/ArduinoMotionSensorExample/inv_mpu.cpp:25:
/home/insippo/.arduino15/packages/arduino/hardware/avr/1.6.14/cores/arduino/Arduino.h:92:0: note: this is the location of the previous definition
#define min(a,b) ((a)<(b)?(a):(b))
^
/home/insippo/sketchbook/libraries/ArduinoMotionSensorExample/inv_mpu.cpp:50:2: error: #error Which gyro are you using? Define MPUxxxx in your compiler options.
#error Which gyro are you using? Define MPUxxxx in your compiler options.
@AWI said:
@Fat-Fly I would suggest the Actuator to drive solar panels. But it seems like you already found it a while ago...
reply
Yes. I find. I want to test this mpu9250 but some errors.
I make esp8266+nrf24l01+ gateway with library 1.5. If sensor node send data j look from serial monitor, data + version mismatch. This gateway connected right ?
I try with these nodes what was connected over serial gateway. I add esp gateway with same channel and and nothing. I try tomorrow again.
It is possible to add and work wit these. Serial gateway and esp8266 gateway with nrf24l01+. Channels is not need to be same ?
If you sensors working ok than you need to go domoticz hardware-> devices. Marked with green arrow is new node. You need to press to green arrow and....... you see what you want.
Sorry my english. Maybe you understand.
Small question. How to connect this gw to Domoticz ? Over lan and in Domoticz ?
I need measure resistance. If i use 3,3v and 1M photo resistor what size is resistor for measure day light. I want to turn solar panels.
Hi.
Can i use photoresistor instead of lm393 ?
I want drive this tracker with Domoticz. Weather and more options is add
simply. Or 4 ldr-s is separately one by one Arduinos.
![My tracker]( image url)
Time lapse
Can somebody help me add to sketch 4 ldr-s, photoresistors. I want to build solar tracker with domoticz.
Good morning people.
Can somebody help add to this moisture sensing sketch relay ?
2.0 is compatible connect nrf directly to raspberry? I do not know and not read this. Maybe i sleep this moment when somebody writing from this.
Okay. With mysensors 2.0 not working nrf directly. Use 1.5 library.
Connect arduino with nrf to comp. Not raspberry. And check serial monitor.
Connect gateway to comp usb and check what happening with arduino ide serial monitor.
Try with 10ยตF capacitor. 470 is too big .
I connect nrf socket + pin to Nano 5V pin. Working perfect.
How to add energy pulse meter sketch temperature sensor ds18b20 for nrf24l01 node.?This for serial gateway. And this is possible to add relay too ? I want make one node for energy meter, ds18b20 and relay.
Okay. I solder wire from nrf socket power directly to arduino nano mini usb connector power wire.
I need solder power wire to Nano mini usb connector directly? I use for power meter Arduino Nano.
I try. I bought these from China friends 20 pcs.
This ? Power from adapter, not from arduino.
How to connect this module to use max power ? In config i know but voltage from external adapter ?
Okay. But why for this mpu9250? These ldr's not working correctly if cloudy. Turn with sun coordinates is possible but i do not find cheap system. Raspberry PI and with arduino + mpu9250 or 6250 + linear actuators.
How to this sensor knows where is the sun?
MPU 6250 works too. But how to drive linear actuators and how to set and from where get coordinates? Oh. Too many questions.
Can to drive with mpu9250 solar panels ? Solar tracker by sun position coordinates ?
It is possible to send data from modbus electricity meter to Domoticz over nrf24l01 or by other way ?
Yes. I read too. NRF working directly with mysenosrs 1.5x. 2.0 not supported today.
Maybe in scketch needed change measure time? Maybe need use function round ?
My sensors is not good yes. I do not understand what is soil moisture % really. My pepper was overwatering. Very wet and moisture was 80% only.
From temp varies moisture level and from fertilizer too. At the bottom of the bucket was more. Yesterday i install moisture sensor to the greenhouse. Level was 60-70%. This is normal if i check with finger. :). Today i try drive relays and water pump.
Yesterday my sensor reported moisture 80% but soil was very wet. Thoughts.
Great. Nothing to say. But i need build this. 10 pcs first time. I live in farm or how to right say in english. With rubber boots from the land ?
Yes. I use gpio for ds18b20 and relays.
I build moisture sensors from stainless wire. If this in pot at a depth of 1 inch domoticz reported 83% of moistre level.Real plant was dry and needed watering. I put moisture level on the soil
and sensor reported moisture level 43%. I test and put moisture sensor to the soil at depth 1 inch
Sensor reported moisture level 96%.
@Fay Candiliari good morning.
I copied this scketch to my comp and delete all mysensors libraries and install development. After this all in ok.
No. This error if i here try. I install locally development library and all is ok on Arduino Ide. I cant try here at the moment.
Arduino ide 1.6.9. Mysensors library 1.5. I have raspberry pi serial gateway. Arduino Pro mini 5v 328
Looks like your project uses header files or libraries that do not exist in our system, in your personal libraries or in your sketch. More info
(sketch file) RelayActuator.ino:48:1: error: unknown type name 'MyHwATMega328'
MyHwATMega328 hw;
^
One question. This sketch measure moisture every 60000 ms, 10 min.It is possible to measure every 30 min ? Battery power lost is minimal.
If this fork in water domoticz reported 88% of moisture. How to change value?
Today morning i can say : working. I bought arduinos 3,3v 10 pcs from Aliexpress. Yesterday i change this to 5V pro mini and this sensor get work. I take picture from this Arduino. Maybe 5volts not 3,3. Voltage stabilizer on the arduino is S201 ?
I'll change this china moisture fork with something stainless steel
2016-07-04 14:58:10.793 MySensors: Gateway Ready...
2016-07-04 14:58:10.869 MySensors: Gateway Version: 1.4.2
This domoticz log
This from Arduino ide
sensor started, id 0
send: 0-0-1-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.2
send: 0-0-1-0 s=255,c=3,t=6,pt=1,l=1,st=fail:1
send: 0-0-1-0 s=255,c=3,t=11,pt=0,l=8,st=fail:Humidity
send: 0-0-1-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
send: 0-0-1-0 s=0,c=0,t=7,pt=0,l=0,st=fail:
send: 0-0-1-0 s=1,c=0,t=6,pt=0,l=0,st=fail:
send: 0-0-1-0 s=1,c=1,t=0,pt=7,l=5,st=fail:80.2
send: 0-0-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
T: 80.24
send: 0-0-1-0 s=0,c=1,t=1,pt=7,l=5,st=fail:38.7
H: 38.70
send: 0-0-1-0 s=0,c=1,t=1,pt=7,l=5,st=fail:38.5
H: 38.50
send: 0-0-1-0 s=0,c=1,t=1,pt=7,l=5,st=fail:37.8
H: 37.80
send: 0-0-1-0 s=1,c=1,t=0,pt=7,l=5,st=fail:80.1
T: 80.06
This is not moisture sketch. I try with different sketches.
Maybe need change nrf? I try.2016-07-04 15:42:12.816 MySensors: Gateway Ready...
2016-07-04 15:42:12.891 MySensors: Gateway Version: 1.5.3
I deleted all my libaries catalog and unpack mysensors 1.4. Previous was 1.5. Too many options what i do not understand. After work i try again and to let you know from results.
end: 0-0-1-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=fail:1.5.3
send: 0-0-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:1
sensor started, id=0, parent=1, distance=2
send: 0-0-1-0 s=255,c=3,t=11,pt=0,l=21,sg=0,st=fail:Plants moisture w bat
send: 0-0-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:1.2
send: 0-0-1-0 s=0,c=0,t=23,pt=0,l=0,sg=0,st=fail:
find parent
I upload sketch from here and pro mini not connect to gateway. GW from this pro mini away maybe 50 cm.
@mfalkvidd : Maybe change sleeping time to 60 min and STABILIZATION_TIME 1000 to 500 ms or smaller ? This place is pure lost energy. Why not to try without stablization time ?
I correct this and try again after work. Yesterday i do not find time.
@mfalkvidd said:
@Fat-Fly replace
const int SENSOR_ANALOG_PINS[] = { 0 };
with
const int SENSOR_ANALOG_PINS[] = { A0 };
Connect like this, except use D8 instead of A1 (the connection displayed is for a newer version of the sketch, which supports alternating polarity)
Then this error is okay but arduino ide not find DigitalIO.h.
/home/insippo/sketchbook/libraries/MySensors/utility/RF24.h:20:23: fatal error: DigitalIO.h: No such file or directory
#include <DigitalIO.h>
I do not understand why arduino ide not find this.
I copy mysensors library to comp and trying set nrf_gw power to max and these errors. Then verify sketch and arduino ide says this error in myconfig.h line 21 and 22
Yesterday this not working. KW reader is too away from gateway.My house is lenght is 22m. Electricity meter is one end of house and gateway is center house. can i use repeater on something other. I use for this nrf with antenna.