Maybe you are right and it's the proximity to a switching tranformer like this hlk-pm01 .They are all on same protoboard aprox 50x60mm. i could build a sheld on it but....now its working with the rfm69version W ok for a few days.
The strange part is this combo was very used a few years now on made pcbs the on forum wher they had the maker/developer contest and never seen a line of this problem...
Posts made by Tmaster
-
RE: hlk-pm01 are to noisy for rfm69?
-
RE: hlk-pm01 are to noisy for rfm69?
i believe this problem has to be with rfm69CW and not the rfm69W . i have boot versions 868mhz and normally always the CW cause me this issues if is not batery powered even with 100uf +100nf caps filtering on transformer out, caps on the rfm60 power etc... maybe they are fake or have any problem. . i just ordered new rfm69W board and let me see if get better. right now i have like 10 nodes running outdoor on irrigation ,controlling relays and lights ,and metering temperatures. all with RFM69W ans HW ,this CW always give problems...
-
hlk-pm01 are to noisy for rfm69?
Hello . it's the 3rd node that i build with the combo arduino promini 3.3v + hlk-pm01 + rfm69 and all need wire ground to earth (on wallsocket) to let rfm69 comunicate.
otherwise will fail on every comunication even near Gateway...
Personally i only think in noise.but everyone say that hlk-pm01 are low noise.
I'm not using any cap after hlk-pm01 for snooth voltage but i already try it before without better result.
rfm69 is powered by the pro mini integrated regulator.
Any one had this problem? -
RE: #define DEFAULT_RFM69_IRQ_PIN
Now is working. so what i did is call to children 0 and 1 and #define MY_NODE_ID 101 ,so next node appear on harware/mysensors gw ,and apear on devices as IDX 99 and 100... The auto node idx from domoticz shoud have caused some issue.... now is working
-
RE: #define DEFAULT_RFM69_IRQ_PIN
this is my gw . in fact i never understud very well the child thing. last one is "tanque"( tank) is ths node that we talk and is showing as 13 ?? why?
normally what i do is go to devices ,see what next id is available and atribute it to children..worked until now but i think its wrong
-
RE: #define DEFAULT_RFM69_IRQ_PIN
@zboblamont said in #define DEFAULT_RFM69_IRQ_PIN:
ode sketch to print locally over serial t
this is local log already. thal last line: 11233 TSF:MSG:SEND,4-4-0-0,s=99,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:36.5
is the message sending 36.5 degrees to gateway.domoticz log report message received from this node...but is not even on devices...
-
RE: #define DEFAULT_RFM69_IRQ_PIN
this is the log. everything appear be fine with presetation of gyro termometer .But never show on devices. someting wrong with my gateway...
1282 TSF:MSG:READ,7-7-4,s=255,c=3,t=8,pt=1,l=1,sg=0:1 2050 TSM:FPAR:OK 2050 TSM:ID 2052 TSM:ID:OK 2054 TSM:UPL 2062 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2101 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2107 TSF:MSG:PONG RECV,HP=1 2111 TSM:UPL:OK 2113 TSM:READY:ID=4,PAR=0,DIS=1 2326 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2353 TSF:MSG:READ,0-0-4,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2572 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2 2791 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2828 TSF:MSG:READ,0-0-4,s=255,c=3,t=6,pt=0,l=1,sg=0:M 3250 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=6,sg=0,ft=0,st=OK:TANQUE 3469 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.3 3688 TSF:MSG:SEND,4-4-0-0,s=98,c=0,t=35,pt=0,l=0,sg=0,ft=0,st=OK: 3905 TSF:MSG:SEND,4-4-0-0,s=99,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK: 3911 MCO:REG:REQ 4124 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 4151 TSF:MSG:READ,0-0-4,s=255,c=3,t=27,pt=1,l=1,sg=0:1 4157 MCO:PIM:NODE REG=1 4159 MCO:BGN:STP 10801 MCO:BGN:INIT OK,TSP=1 11014 TSF:MSG:SEND,4-4-0-0,s=98,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:49 11233 TSF:MSG:SEND,4-4-0-0,s=99,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:36.5
-
RE: #define DEFAULT_RFM69_IRQ_PIN
@zboblamont said in #define DEFAULT_RFM69_IRQ_PIN:
So long as these are set before including the MySensors library it should indeed override the defaults.
OMG. this is the problem! i was defining AFTER Including Mysensors library. well i should knew that if i know more about programing
this code now is working comunicating well.
I still having an issue. termometer doesn't appear on domoticz. i think it's well presented... i'm not sure whats happen. but the axel for angle, that i need is , working good already .
The corret statement is .
#define MY_RFM69_IRQ_PIN 3
#define MY_RFM69_IRQ_NUM 1/* -> __ __ ____ -> | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| -> | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ -> |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ -> |___/ 2.3.2 */ #define MY_DEBUG #include <basicMPU6050.h> #define MY_RADIO_RFM69 #define MY_RFM69_IRQ_PIN 3 //!< DEFAULT_RFM69_IRQ_PIN #define MY_RFM69_IRQ_NUM 1 #include <MySensors.h> #include <RunningMedian.h> RunningMedian samples = RunningMedian(100); #define CHILD_ID 98 #define CHILD_ID_TEMP 99 MyMessage msg(CHILD_ID, V_LEVEL); MyMessage msg1(CHILD_ID_TEMP,V_TEMP); // Create instance basicMPU6050<> imu; //credits:https://github.com/RCmags/basicMPU6050 float incl; static uint8_t sentValue; void presentation() { // Send the sketch version information to the gateway and controller sendSketchInfo("TANQUE", "2.3"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOISTURE); present(CHILD_ID_TEMP,S_TEMP); } void setup() { // Set registers - Always required imu.setup(); // Initial calibration of gyro imu.setBias(); } void loop() { // Update gyro calibration imu.updateBias(); incl= imu.ay(); int val = ((incl+1)*50); int x = val; samples.add(x); //long m = samples.getAverage(); int m = samples.getMedian(); delay (200); if (m != sentValue) { send(msg.set(m)); float temp = imu.temp(); send(msg1.set(temp,1)); sentValue = m; delay (5000); } }
-
RE: #define DEFAULT_RFM69_IRQ_PIN
not working.same result .... lets think again.. out of the box... is it possible use same pin form both rfm69 and mpu6050 ? or even not using the int pin on mpu6050... maybe that is the solution...
_IRQ_NUM 1 shoud be the interrupt pin 1. 0 is D2
-
RE: #define DEFAULT_RFM69_IRQ_PIN
@zboblamont said in #define DEFAULT_RFM69_IRQ_PIN:
#define MY_RFM69_IRQ_PIN DEFAULT_RFM69_IRQ_PIN
sory, i couldn't understand, to move it to pin 3 shoud be that?:
#define DEFAULT_RFM69_IRQ_PIN 3
#define DEFAULT_RFM69_IRQ_NUM 1?
i will try and tell if it works. thankyou -
RE: Moisture penetrates my outdoor enclosures...
i use the simplest boxes that you find,that suface mount with 4 screws and ruber on door.
But be carefull with wall mount screws. if you drill the back of the box ,water come in beind this box. so this ones,the scrfew holes are outside the encosure an box is sealed...
another tip is drill on bottom for pass cables but put some neutral silicone. hot glue let water come in with time because expansion coeficient is diferent that the plastic box and open gaps -
#define DEFAULT_RFM69_IRQ_PIN
Good morning . I have a sensor that have an MPU6050 that uses pin 2 for interrupt ,and i need wire the rfm69 for the radio that uses the same pin 2.
i read that i shoud use #define MY_RFM69_IRQ_PIN 3 and #define MY_RFM69_IRQ_NUM 1 , for move interrupt pin for pin D3 ,but isn't working .
Always log that on sensor side and stops:16 MCO:BGN:INIT NODE,CP=RRNNA---,FQ=8,REL=255,VER=2.3.2 28 TSM:INIT 28 TSF:WUR:MS=0 */
already try :#undef MY_RFM69_IRQ_PIN first but the same.. . unce i can't move the pin 2 from mpu6050 library what can i do? thank you
-
RE: 2021 EU customs regulatory changes β where should I buy now?
These extra taxes of 5β¬ or 7.5β¬ that you talk doesn't make sense. There in Portugal ,if we buy from ebay,or other similar website ,we pay vat(iva) on website and up to 150β¬ , we don't pay nothing else.when the goods arrive won't stop on costoms . What sense makes pay 5β¬ on a arduino promini that cost 1.5β¬?
We only pay costoms (mail company) taxes if we do mot pay Vat(iva) on website.
That extra taxes shoud be for you order more stuff toguether in the same order...and the mail companies don't deal with so many small packages
-
RE: domoticz motion(type)sensors don't show battery level
On a new card i updated OS to Raspian Buster and installed latest domoticz V 2.2020. BUT the problem still the same . no battery value present soon as this sensor report a new "data" AND it's as motion sensor and not as any other type of sensor. If it works to others i really don't understand what happens...
-
RE: domoticz motion(type)sensors don't show battery level
My version it's V4.11207 .I can't upgrade more without upgrade Os from "strecht"to new raspbian Os. Shouldn't be the sensor update frequency because if i go to domoticz now and just change sensor type to" on/off switch" ,battery level just appears there on debices.
I think that i have to upgrade everyting...Os and domoticz but its a pain,because i have to pair zwave devices from shutters again...and probably new bugs appear.... My thought is;linux that work...don't touch -
domoticz motion(type)sensors don't show battery level
hello. i build an motion sensors that works great but if i select sensor type on domoticz like "motion sensor", the battery level from "devices" disappear. That only happens on "motion sensor type", if i select other like on/off type ,the level appears but than i can't use the "disable after x seconds" feature present only on motion sensor type.
any one have this problem? i can't find if its an domoticz bug or mysensors , or what what happens
code is bellow but i think it's ok because if i select other type of sensor ,on domoticz, battery status work good. .thanks.void setup() { pinMode(DI_SENSOR1, INPUT); //pinMode(DI_SENSOR2, INPUT); // sets the motion sensor digital pin as input analogReference(INTERNAL); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { int sensorValue = analogRead(BATTERY_SENSE_PIN); float vBat = static_cast<float>(sensorValue * (8.2/1023)); #ifdef MY_DEBUG Serial.print("A0: "); Serial.println(sensorValue); Serial.print("Battery Voltage: "); Serial.println(vBat); #endif delay(500); int batteryPcnt = static_cast<int>(((vBat-6)/(8.4-6))*100.); delay(500); // ((1e3+150)/150)*1.1 = Vmax = 8.43 Volts // 8.43/1023 = Volts per bit = ~0.00804 #ifdef MY_DEBUG Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } //motion bool tripped = digitalRead(DI_SENSOR1) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); sleep(digitalPinToInterrupt(DI_SENSOR1), RISING, 0); }
-
RE: RFM69 Range issues
The best antena that i tried on rfm69 is the dipole. Direct solder to the rfm69 board. One wire 0.8mm with 8.2cm long on Ant pin,and other in ground in oposite Direction,same size.thos for 868mhz.
I have the gate sensor at 50m outdoor and never seen a miss comunication.I tried spring antenna and same dipole with an coax cable and didn't work at that range. And a mono-pole without ground plane(wire) have more lost packets( i just try communicate directly,dont have any signal scanner).
-
RE: Simple irrigation controller
@markjgabb said in Simple irrigation controller:
hey @Tmaster
are you still using this solution?
have you made any improvements or come across any issues with using it over time?Hello.still working good exept on winter that was disabled.
Last summer worked until october without any fail. -
RE: RS-485 to an wireless Gateway
@mfalkvidd said in RS-485 to an wireless Gateway:
Most controllers, including Domoticz, supports multiple gateways. I have 2 gateways on my Domoticz.
That's what i wasn't sure.
Right now i already have a zwave gw(module) hoked to raspberry pins,that controls all windows shutters and an Usb GW (mysensors serial gw) that controls 4 temperature sensors, irrigation valcs from my garden ,solar water panel relay , outdoor lights etc...all on rfm69W and C "transport" 868mhz, but i will consider if i build a second arduino usb GW or i keep the wireless to the gate.
So if i see the zwave module like an GW i already have 2 as well
The true it's that the gate is already "mysensor-rized" with wireless but i keep preferring wired connection for outdoor and once i'm burying the cables for power and doorbell ,maybe i add an Cat6 cable for RS-485 connection. -
RE: RS-485 to an wireless Gateway
So like mysensors is designed right now, it's not possible mix wired and wifi sensors on same gateway...
if was you ,what you do in that situation?
i just don't know what way to do it. Create a new gateway means a new raspberry and a new domoticz instance (in diferent port), or can i create something like this guy did and connect it to the already existing raspberry that it's connected to a wireless gateway(arduino+rfm69) ? i'm a bit confused about this.ps: forguet about new code or change mysensors core code(except sensor sketches that i can change) .i'm not programmer,i'm electronic engineer
-
RE: RS-485 to an wireless Gateway
the fact is ,i don't know what i want!
Once the gate is far from my house(+50m) ,i thought that is good idea use the RS-485 modules for wired connection instead of use the wireless rfm69 that i have implemented in my Domotics/pi already.
but i don't know if that it's possible? basically i want connect an wired sensor connected to my existing wireless mysensors network. -
RS-485 to an wireless Gateway
Hi. like i have explained in other topics , my setup is an usb serial gateway(rfm69) connected to an raspberry pi and Domoticz as controller software .
I have an electric slider gate(for cars) 50 meters away from house,and want domoticz open and close ,as well as an alarm beep and log when some familiar enters.
i have some RS-485 modules that i bought before, ther is any way to use RS-485 serial instead on use an rfm69 at 50meters away ,once i have cables outside buried already ideal for serial communication?
i read , that i need 2 gateways ,one for RS-485 other for wireless(rfm69) but make another gateway just for one sensor its overkill.
Any other away? -
RE: Raspberry PI killing memory cards
my Domoticz its running on a PNY SD card for more than 2 years and didn't die yet. But i almost don't have power cuts . Any case i have another sandisk ultra sd with an clone from the running SD ready to replace this in case of fail.
You can buy and replace an raspberry by an fast and more expensive device...but this sd cards cost 3.75β¬ !!! power consumption of 1.5w- 1.9w in idle... what else can i want from my domotic system!edit: i have 4 or 5 sensors transmitting and writing every 15min, so sd write, it's not too heavy,standart usage.
-
RE: WI-FI IOT modules
I think i touch the rigth spot! WIFI ~
but my initial post was more about if they are reliable than if they are safe...
even a wood door it's not safe...an kick and you are in ... i don't believe someone will start robbing my house ,by entering in the shutter iot module by an wifi hack and open the shutter,brake doble glass windows and enter....
It's more a question if they are pratical and reliable? tey cost less than half of an zwave module..big point here...
and my main concern is ,are they all day comunicating with router or they usualy sleep? i'm not sure how wi-fi devices like esp8266 work. If they ping the router regularly or what? -
WI-FI IOT modules
Hi. recently i start looking more to iot wifi based ,not because it's new but because i see the prices from the shelly wifi modules comparatively with the zwave ones that we are using now.
I never had paying much attention to this wifi modules but by 19$ they are really cheap for shutter or relay modules embedded in wall,and can we can change the firmware to custom one ,once they are esp8266 second i read.
Anyone can explain me the disadvantage? Are this wi-fi modules always transmitting to the router? or they are like our mysensors that only comunicate once per hour or so to saying"i m alive", when they are idle/not sending data.
That is an old care about not fill the house with wi-fi "noisy" devices... -
Simple irrigation controller
Description
This project born from a necessity of water my domestic vegetable garden. Lettuces needs water all day and many times I forgot or donβt have time. There are other projects for irrigation but I have special requirements, itβs just one valve and valves that are sold in my country are AC24V for commercial controllers.
So I build a controller to add to my existing Mysensors/Domoticz network that can handle an AC24V with 12V to 3V volt DC . +/-3 Volts itβs how power this AC24V volts solenoids because AC24V transformers are difficult to find and expensive for what they are(ferromagnetic). And once solenoids(coils) warms up a lot especially with DC,with 3 volt they run cold and its the minimum that my valve requires to stay open.How it works?
Watering can be set on Arduino, 2 times per day ,morning and at evening. Or even once per day.
Or can be added timers on gateway (my case Domoticz) and everything stays remotely. Personally I prefer have it hard coded on Arduino in case of transmission fail.
I add a switch (one per valve) to turn it on every time I want and it automatically shuts down on timer that itβs set on code ,in βVALVE_TIMEβ. 1 hour by default.
So there this timeout work in any of the timers(switch,gateway or internal timer).On code ,I set to β225β(100% or DC12v) on mosfet (IRLZ44N) during 400ms to kick the solenoid to open and then is set to β90β the rest of time to have around 3V on valve terminals. The entire project itβs powered with a standard electronic DC12V/2A transformer that powers the Arduino and the water valve.
There are 2 leds. One "Valve Power On" and other is TX/RX,note that blink time was slowed down for better understand when is communicating or its just retrying in loop and can't reach the gateway (for example). I have really good result with RFM69H(868mhz) communications. My garden its 40m/50m of my house or GW an never realize that were lost communications.
What I used:
Arduino (any 328P), I used pro mini 3.3v because the RFM69
RFM69H
LM2596 Voltage step down 12vβ3.3V (or equivalent)
IRLZ44N or any logic level mosfet that work on 3.3V(one per valve that you use)
x2 leds
x2 screw terminal (2 wires)
Push Switch (Normally open)
Resistors x2 - 10K and x2 β 220ohm
Protoboard (that green ones from ebay are awesome)
wireβ¦Some thoughts : On my prototypes, I rarely make a dedicated pcb, I use thin ,wire to bridge components on protoboards. They are easy to build and easy to repair or remake in case of some issue. Never had an unexpected shot-circuit. And when my board are outdoor ,I use nail polish or transparent spray paint to cover the entire board. that makes an water prof board. And believe me even ip67 outdoor cases sometimes let water get in.
This is an example of wiring , of course in this our project we have many less wires :exampleSchematic
Note: each extra valve(Zone) needs an extra led, switch and mosfet.
Donβt let your garden dry!
Code
// Set blinking period (in milliseconds) #define MY_DEFAULT_LED_BLINK_PERIOD 500 #define MY_WITH_LEDS_BLINKING_INVERSE //#define MY_DEFAULT_ERR_LED_PIN 17 #define MY_DEFAULT_TX_LED_PIN 17 #define MY_DEFAULT_RX_LED_PIN 17 //#define MY_DEBUG #define MY_RADIO_RFM69 //#define MY_REPEATER_FEATURE #include <TimeLib.h> #include <SPI.h> #include <OneWire.h> #include <DallasTemperature.h> #include <MySensors.h> #define ONE_WIRE_BUS 6 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); //#define CHILD_ID_MOISTURE 4 #define CHILD_ID_TEMP 21 #define CHILD_ID_VALV1 10 //#define CHILD_ID_VALV2 11 #define RELAY_PIN 3 // Arduino Digital I/O pin number for relay VALV 1 #define RELAY_PIN2 5 // Arduino Digital I/O pin number for relay VALV 2 #define BUTTON_PIN 4 // Arduino Digital I/O pin number for button #define LEDR1 16 // LED A2 pin #define LEDR2 15// LED A1 pin //#define LEDERRO 17 // LED A3 pin #define VALVE_TIME 3600000UL //selenoid 1 goes off after () time (7200000UL)-2HOUR #define readtime 1800000UL //time between read TEMPERATURE (3600000UL) - 1HOUR //xxxxxxxxxxxxxxxxxxxxxxxxxxxxx |SET TIME HERE| - valve1- xxxxxxxxxxxxxxxxxxxxxxxx | //TIME1 const int H1 = 17; //HOURS START PROGRAM //time to start selenoid1 | const int M1 = 00; //MINUTES START PROGRAM | //TIME2 const int H2 = 8; //HOURS START PROGRAM //time to start selenoid1 | const int M2 = 00; //MINUTES START PROGRAM //----------------------------------------valve2--------------------------------------- | unsigned long startMillis = 0; unsigned long startMillisA = 0; int reading;// the current reading from the input pin bool RH = false; int previous = LOW; int timer = false; bool timeReceived = false; unsigned long lastRequest = 0; MyMessage msg1(CHILD_ID_TEMP, V_TEMP); MyMessage msg2(CHILD_ID_VALV1, V_LIGHT); bool state; void before() { // Startup up the OneWire library sensors.begin(); //DS18B20 LIBRARY START } void setup() { //request time from gw requestTime(receiveTime); // Setup the button pinMode(BUTTON_PIN, INPUT); pinMode(RELAY_PIN, OUTPUT); pinMode(RELAY_PIN2, OUTPUT); pinMode(LEDR1, OUTPUT); pinMode(LEDR2, OUTPUT); sensors.begin(); //DS18B20 LIBRARY START // Make sure relays are off when starting up digitalWrite(RELAY_PIN, LOW); } void presentation() { sendSketchInfo("irrigation_temp_soilMoisture", "2.0"); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_VALV1, S_LIGHT); } void receiveTime(unsigned long time) { // Ok, set incoming time setTime(time); timeReceived = true; Serial.print("Time now is: "); Serial.print(hour()); Serial.print(":"); Serial.print(minute()); Serial.print(":"); Serial.print(second()); } //################################################################################################# void VALV1_ON() { analogWrite(RELAY_PIN, 255); delay(400); analogWrite(RELAY_PIN, 90); digitalWrite(LEDR1, HIGH); send(msg2.set(true), false); } void VALV1_OFF() { analogWrite(RELAY_PIN, LOW); digitalWrite(LEDR1, LOW); send(msg2.set(false), false); } //#########################################################################################################3 // β ORDER RECEIVED FROM GW # void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.isAck()) { // Serial.println("This is an ack from gateway"); } if (message.type == V_LIGHT) { // Change relay state state = message.getBool(); if (state == 1) { VALV1_ON(); } else if (state == 0) { VALV1_OFF(); } } } void loop() //loop { unsigned long nows = millis(); // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every 12h if ((!timeReceived && (nows - lastRequest) > (10UL * 1000UL)) || (timeReceived && (nows - lastRequest) > (43200000UL))) { // Request time from controller. // Serial.println("requesting time"); requestTime(receiveTime); lastRequest = nows; } //toogle switch----------selenoid 1------------------------------- reading = digitalRead(BUTTON_PIN); if (reading == HIGH && RH == false) { VALV1_ON(); RH = true; timer = true; delay(400); } else if (reading == HIGH && RH == true) { VALV1_OFF(); RH = false; timer = false; delay(400); } // β time out unsigned long nowMillis = millis(); if ((timer == true) && (nowMillis - startMillis >= VALVE_TIME)) { startMillis = nowMillis ; VALV1_OFF(); timer = false; } //β ON by time if ((hour() == H1 && minute() == M1) || (hour() == H2 && minute() == M2) ) { VALV1_ON(); timer = true; } //β time to send temperature ? float temperature = sensors.getTempCByIndex(0); unsigned long nowMillisA = millis(); if (nowMillisA - startMillisA >= readtime) { //β read temperature sensors sensors.requestTemperatures(); send(msg1.set(temperature, 1)); //send temp to gw startMillisA = nowMillisA ; //reset time } }
Todays Domoticz log from this sensors:
-
RE: Crazy timer on my sketch
@mfalkvidd that was the problem! I correct the code and timers are working perfect now. I will post the skematic and code this night on projects for if someone want to use it . Very handy on summer for water some vegetables like i do. It's a very simple build.
-
RE: Crazy timer on my sketch
Nice catch! i didnΒ΄t see that . thank you
-
RE: Crazy timer on my sketch
@mfalkvidd said in Crazy timer on my sketch:
the debug log will probably give good insight to why the node reacts early.
i just discovered the auto-formatting right now
About debug (mydebug) just reacts as normal,everything as should, but in shorter time... less 70-80% of the time most the times. Tomorrow i will get the arduino that its watering right know and change the code a bit..try some "while" instead of "if" or hammering it
-
Crazy timer on my sketch
hello . i'm finishing an second version from my water irrigation(1 valve control) and i have an issue with one of the timers that i can't understand.
its set for 1 hour,but never reach 1 hour, sometimes 47minutes ,other times 5 minutes.... annoying.
Can anyone understand this ? i'm too limited on programming :s
this is the crazy timer that i talk about:
this timer close the valv after 3600second(1hour) but won't work..unsigned long nowMillis = millis(); if ((timer==true) && (nowMillis - startMillis >= VALVE_TIME)) { startMillis = nowMillis ; VALV1_OFF(); timer==false;
full code:
// Set blinking period (in milliseconds) #define MY_DEFAULT_LED_BLINK_PERIOD 500 #define MY_WITH_LEDS_BLINKING_INVERSE //#define MY_DEFAULT_ERR_LED_PIN 17 #define MY_DEFAULT_TX_LED_PIN 17 #define MY_DEFAULT_RX_LED_PIN 17 //#define MY_DEBUG #define MY_RADIO_RFM69 //#define MY_REPEATER_FEATURE #include <TimeLib.h> #include <SPI.h> #include <OneWire.h> #include <DallasTemperature.h> #include <MySensors.h> #define ONE_WIRE_BUS 6 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); //#define CHILD_ID_MOISTURE 4 #define CHILD_ID_TEMP 21 #define CHILD_ID_VALV1 10 //#define CHILD_ID_VALV2 11 #define RELAY_PIN 3 // Arduino Digital I/O pin number for relay VALV 1 #define RELAY_PIN2 5 // Arduino Digital I/O pin number for relay VALV 2 #define BUTTON_PIN 4 // Arduino Digital I/O pin number for button #define LEDR1 16 // LED A2 pin #define LEDR2 15// LED A1 pin //#define LEDERRO 17 // LED A3 pin #define VALVE_TIME 3600000UL //selenoid 1 goes off after () time (7200000UL)-2HOUR #define readtime 1800000UL //time between read TEMPERATURE (3600000UL) - 1HOUR //xxxxxxxxxxxxxxxxxxxxxxxxxxxxx |SET TIME HERE| - valve1- xxxxxxxxxxxxxxxxxxxxxxxx | //TIME1 const int H1 = 17; //HOURS START PROGRAM //time to start selenoid1 | const int M1 = 00; //MINUTES START PROGRAM | //TIME2 const int H2 = 8; //HOURS START PROGRAM //time to start selenoid1 | const int M2 = 00; //MINUTES START PROGRAM //----------------------------------------valve2--------------------------------------- | unsigned long startMillis = 0; unsigned long startMillisA = 0; int reading;// the current reading from the input pin bool RH = false; int previous = LOW; int timer = false; bool timeReceived = false; unsigned long lastRequest=0; MyMessage msg1(CHILD_ID_TEMP,V_TEMP); MyMessage msg2(CHILD_ID_VALV1,V_LIGHT); bool state; void before() { // Startup up the OneWire library sensors.begin(); //DS18B20 LIBRARY START } void setup() { //request time from gw requestTime(receiveTime); // Setup the button pinMode(BUTTON_PIN,INPUT); pinMode(RELAY_PIN, OUTPUT); pinMode(RELAY_PIN2, OUTPUT); pinMode(LEDR1, OUTPUT); pinMode(LEDR2, OUTPUT); sensors.begin(); //DS18B20 LIBRARY START // Make sure relays are off when starting up digitalWrite(RELAY_PIN,LOW); } void presentation() { sendSketchInfo("irrigation_temp_soilMoisture", "2.0"); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_VALV1, S_LIGHT); } void receiveTime(unsigned long time) { // Ok, set incoming time setTime(time); timeReceived = true; Serial.print("Time now is: "); Serial.print(hour()); Serial.print(":"); Serial.print(minute()); Serial.print(":"); Serial.print(second()); } //################################################################################################# void VALV1_ON() { analogWrite(RELAY_PIN,255); delay(400); analogWrite(RELAY_PIN,90); digitalWrite(LEDR1,HIGH); send(msg2.set(true),false); } void VALV1_OFF() { analogWrite(RELAY_PIN,LOW); digitalWrite(LEDR1,LOW); send(msg2.set(false),false); } //#########################################################################################################3 // β ORDER RECEIVED FROM GW # ORDER RECEIVED FROM GW # ORDER RECEIVED FROM GW ORDER RECEIVED FROM GW ORDER RECEIVED FROM GW β void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.isAck()) { // Serial.println("This is an ack from gateway"); } if (message.type == V_LIGHT) { // Change relay state state = message.getBool(); if (state == 1) { VALV1_ON(); } else if (state == 0) { VALV1_OFF(); } } } void loop() //loop loop loop loop loop loop loop loop loop loop loop { unsigned long nows = millis(); // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every 12h if ((!timeReceived && (nows-lastRequest) > (10UL*1000UL)) || (timeReceived && (nows-lastRequest) > (43200000UL))) { // Request time from controller. // Serial.println("requesting time"); requestTime(receiveTime); lastRequest = nows; } // toogle switch toogle switch toogle switch toogle switch toogle switch //toogle switch----------selenoid 1------------------------------- reading = digitalRead(BUTTON_PIN); if (reading == HIGH && RH == false) { VALV1_ON(); RH = true; timer = true; delay(400); } else if(reading == HIGH &&RH == true) { VALV1_OFF(); RH = false; timer==false; delay(400); } // β time out β unsigned long nowMillis = millis(); if ((timer==true) && (nowMillis - startMillis >= VALVE_TIME)) { startMillis = nowMillis ; VALV1_OFF(); timer==false; } //β ON by time β if ((hour() == H1 && minute() == M1) ||(hour() == H2 && minute() == M2) ) { VALV1_ON(); timer = true; } //β time to send temperature ? β float temperature =sensors.getTempCByIndex(0); unsigned long nowMillisA = millis(); if (nowMillisA - startMillisA >= readtime) { //β read temperature sensors β sensors.requestTemperatures(); send(msg1.set(temperature,1)); //send temp to gw startMillisA = nowMillisA ; //reset time } }
-
RE: π¬ MySensors Cover Node
hello guys. i changed @dpressle scketch for work with our South European shutters. that means now work with a standard shutter mechanical wall switch, without stop ,and 2 relays ,one for up ,one for down and all shutter motors have mechanic limits/stoppers embedded,So i don't pay much attention to calibrate or have exact stop time. I removed the calibration code and i add manually the exact time that windows shutter take to open +1sec (for be sure it reach mechanical limit).
Stop is now on release(fall) any key from the mechanical switch(up or down), and in power fail case ,it stays were it was left and start counting up or down from there.Unfortunately if you use Domoticz ,percentage appear be not supported... And without any v_status on code,appear that domoticz don't know if state is open or close,but respond to close and open and stop like blind switch/sensor.
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 //#define MY_RF24_PA_LEVEL RF24_PA_LOW //#define MY_REPEATER_FEATURE #include <Bounce2.h> #include <MySensors.h> #include <SPI.h> // uncomment if we want to manually assign an ID //#define MY_NODE_ID 1 / #define BUTTON_UP_PIN 5 // Arduino Digital I/O pin number for up button #define BUTTON_DOWN_PIN 6 // Arduino Digital I/O pin number for down button //#define BUTTON_STOP_PIN 7 // Arduino Digital I/O pin number for stop button #define RELAY_UP_PIN 3 // Arduino Digital I/O pin number for direction relay #define RELAY_DOWN_PIN 4 // Arduino Digital I/O pin number for power relay #define RELAY_ON 0 #define RELAY_OFF 1 //#define RELAY_DOWN 1 //#define RELAY_UP 0 #define DIRECTION_DOWN 1 #define DIRECTION_UP 0 #define SKETCH_NAME "Cover" #define SKETCH_VER "2.0" #define CHILD_ID_COVER 0 // sensor Id of the sensor child #define STATE_UP 100 // 100 is open - up #define STATE_DOWN 0 // 0 is closed - down //#define CHILD_ID_CALIBRATE 1 // sensor Id of the sensor child to calibrate #define CHILD_ID_SET 1 // sensor Id of the sensor child to init the roll time #define PRESENT_MESSAGE "shuttle for Livingroom" const int LEVELS = 100; //the number of levels float rollTime = 28.0; //the overall rolling time of the shutter const bool IS_ACK = false; //is to acknowlage static bool initial_state_sent = false;//for hass we need at list one state send at begining // debouncing parameters int value = 0; int oldValueUp = 0; int oldValueDown = 0; //int value1=0;int value2=0; int oldValueStop=0; int oldValueStop1=0; //static unsigned long last_interrupt_time_up = 0; //static unsigned long last_interrupt_time_down = 0; //static unsigned long debounce_time = 200; Bounce debouncerUp = Bounce(); Bounce debouncerDown = Bounce(); //Bounce debouncerStop = Bounce(); // shutter position parameters float timeOneLevel = rollTime / LEVELS; int requestedShutterLevel = 0; int currentShutterLevel = 0; unsigned long lastLevelTime = 0; bool isMoving = false; int directionUpDown; enum CoverState { STOP, UP, // Window covering. Up. DOWN, // Window covering. Down. }; static int coverState = STOP; MyMessage msgUP(CHILD_ID_COVER, V_UP); MyMessage msgDown(CHILD_ID_COVER, V_DOWN); MyMessage msgStop(CHILD_ID_COVER, V_STOP); MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE); void sendState() { // Send current state and status to gateway. send(msgUP.set(coverState == UP)); send(msgDown.set(coverState == DOWN)); send(msgStop.set(coverState == STOP)); send(msgPercentage.set(currentShutterLevel)); } void shuttersUp(void) { #ifdef MY_DEBUG Serial.println("Shutters going up"); #endif if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) { digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); delay(100); } digitalWrite(RELAY_UP_PIN, RELAY_ON); directionUpDown = DIRECTION_UP; isMoving = true; coverState = UP; sendState(); } void shuttersDown(void) { #ifdef MY_DEBUG Serial.println("Shutters going down"); #endif if (digitalRead(RELAY_UP_PIN) == RELAY_ON) { digitalWrite(RELAY_UP_PIN, RELAY_OFF); delay(100); } digitalWrite(RELAY_DOWN_PIN, RELAY_ON); directionUpDown = DIRECTION_DOWN; isMoving = true; coverState = DOWN; sendState(); } void shuttersHalt(void) { #ifdef MY_DEBUG Serial.println("Shutters halted X"); #endif digitalWrite(RELAY_UP_PIN, RELAY_OFF); digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); delay(100); //} isMoving = false; requestedShutterLevel = currentShutterLevel; #ifdef MY_DEBUG Serial.println("saving state to: "); Serial.println(String(currentShutterLevel)); #endif saveState(CHILD_ID_COVER, currentShutterLevel); coverState = STOP; //sendState(); } void changeShuttersLevel(int level) { int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN; if (isMoving && dir != directionUpDown) { shuttersHalt(); } requestedShutterLevel = level; } void receive(const MyMessage &message) { #ifdef MY_DEBUG Serial.println("recieved incomming message"); Serial.println("Recieved message for sensor: "); Serial.println(String(message.sensor)); Serial.println("Recieved message with type: "); Serial.println(String(message.type)); #endif if (message.sensor == CHILD_ID_COVER) { switch (message.type) { case V_UP: //Serial.println(", New status: V_UP"); changeShuttersLevel(STATE_UP); break; case V_DOWN: //Serial.println(", New status: V_DOWN"); changeShuttersLevel(STATE_DOWN); break; case V_STOP: //Serial.println(", New status: V_STOP"); shuttersHalt(); break; case V_PERCENTAGE: int per = message.getInt(); if (per > STATE_UP) { per = STATE_UP; } changeShuttersLevel(per); break; } } #ifdef MY_DEBUG Serial.println("exiting incoming message"); #endif return; } void before() { // Setup the button pinMode(BUTTON_UP_PIN, INPUT_PULLUP); // Activate internal pull-up digitalWrite(BUTTON_UP_PIN, HIGH); pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP); // Activate internal pull-up digitalWrite(BUTTON_DOWN_PIN, HIGH); // After setting up the button, setup debouncer debouncerUp.attach(BUTTON_UP_PIN); debouncerUp.interval(5); // After setting up the button, setup debouncer debouncerDown.attach(BUTTON_DOWN_PIN); debouncerDown.interval(5); // Make sure relays are off when starting up digitalWrite(RELAY_UP_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_UP_PIN, OUTPUT); // Make sure relays are off when starting up digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_DOWN_PIN, OUTPUT); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_VER); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK); //present(CHILD_ID_SET, S_CUSTOM); } void setup(void) { int state = loadState(CHILD_ID_COVER); #ifdef MY_DEBUG Serial.println("getting state from eeprom: "); Serial.println(String(state)); #endif currentShutterLevel=state; changeShuttersLevel(state); } void loop(void) { if (!initial_state_sent) { #ifdef MY_DEBUG Serial.println("Sending initial value"); #endif sendState(); initial_state_sent = true; } debouncerUp.update(); value = debouncerUp.read(); if (value == 0 && value != oldValueUp) { changeShuttersLevel(STATE_UP); } oldValueUp = value; debouncerDown.update(); value = debouncerDown.read(); if (value == 0 && value != oldValueDown) { changeShuttersLevel(STATE_DOWN); } oldValueDown = value; value = debouncerUp.rose(); if ((value == 0) && (value != oldValueStop) &&(isMoving==true)){ shuttersHalt(); } oldValueStop = value; value = debouncerDown.rose(); if ((value) == 0 && (value != oldValueStop1)&&(isMoving==true)){ shuttersHalt(); } oldValueStop1 = value; if (isMoving) { unsigned long _now = millis(); if (_now - lastLevelTime >= timeOneLevel * 1000) { if (directionUpDown == DIRECTION_UP) { currentShutterLevel += 1; } else { currentShutterLevel -= 1; } #ifdef MY_DEBUG //Serial.println(String(requestedShutterLevel)); Serial.println(String(currentShutterLevel)); #endif lastLevelTime = millis(); //send(msgPercentage.set(currentShutterLevel)); } if (currentShutterLevel == requestedShutterLevel){ shuttersHalt(); } } else if (requestedShutterLevel != currentShutterLevel) { if (requestedShutterLevel > currentShutterLevel) { shuttersUp(); } else { shuttersDown(); } lastLevelTime = millis(); } }
-
RE: Roller shutter(s_cover) on Domoticz
so, i assume that my question it's not obvious and because that domoticz still have this bug...
i will leave it without percentage bar(just as blind) because its just to opena and close that shutter at night/morningnobody have an sensor with S_COVER presented on Domoticz working good?
-
RE: Roller shutter(s_cover) on Domoticz
thank you for reply @mfalkvidd
Payload like 100 shoud be 100% on domoticz, right? how does domoticz "know" that a blindcover /or shutter is open or close? because it's not respondig to that...__ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.1 16 MCO:BGN:INIT NODE,CP=RRNNA---,REL=255,VER=2.3.1 26 MCO:BGN:BFR 28 TSM:INIT 30 TSF:WUR:MS=0 34 TSM:INIT:TSP OK 34 TSF:SID:OK,ID=4 36 TSM:FPAR 1257 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 1423 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0 1429 TSF:MSG:FPAR OK,ID=0,D=1 3264 TSM:FPAR:OK 3264 TSM:ID 3266 TSM:ID:OK 3268 TSM:UPL 3276 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 3315 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1 3321 TSF:MSG:PONG RECV,HP=1 3325 TSM:UPL:OK 3328 TSM:READY:ID=4,PAR=0,DIS=1 3540 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 3567 TSF:MSG:READ,0-0-4,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 3786 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1 4005 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 4046 TSF:MSG:READ,0-0-4,s=255,c=3,t=6,pt=0,l=1,sg=0:M 4263 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=5,sg=0,ft=0,st=OK:Cover 4483 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.0 4708 TSF:MSG:SEND,4-4-0-0,s=0,c=0,t=5,pt=0,l=22,sg=0,ft=0,st=OK:shuttle for Livingroom 4716 MCO:REG:REQ 4929 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 4956 TSF:MSG:READ,0-0-4,s=255,c=3,t=27,pt=1,l=1,sg=0:1 4962 MCO:PIM:NODE REG=1 4964 MCO:BGN:STP getting rolltime from eeprom: 28.00 getting state from eeprom: 0 4968 MCO:BGN:INIT OK,TSP=1 Sending initial value 5185 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=29,pt=1,l=1,sg=0,ft=0,st=OK:0 5402 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=30,pt=1,l=1,sg=0,ft=0,st=OK:0 5619 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=31,pt=1,l=1,sg=0,ft=0,st=OK:1 5838 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:0
.
.
.
.
after I give an order of CLOSE (DOWN) shutter (v_percentage=0)------------ *(HERE WAS AT 100% AND I ORDER TO GO 0%(CLOSED)* ------------------- exiting incoming message Shutters going down 612509 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=29,pt=1,l=1,sg=0,ft=0,st=OK:0 612728 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=30,pt=1,l=1,sg=0,ft=0,st=OK:1 612947 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=31,pt=1,l=1,sg=0,ft=0,st=OK:0 613167 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:100 99 98 (...) 7 6 5 4 3 2 1 0 Shutters halted X saving state to: 0 645519 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=29,pt=1,l=1,sg=0,ft=0,st=OK:0 645738 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=30,pt=1,l=1,sg=0,ft=0,st=OK:0 645957 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=31,pt=1,l=1,sg=0,ft=0,st=OK:1 646176 TSF:MSG:SEND,4-4-0-0,s=0,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:0 ------------ *(HERE REACH 0%)* -------------------
-
Roller shutter(s_cover) on Domoticz
hello. I'm building and remake of Simple cover actuator from @dpressle (here), i call it a remake because my shutter have 2 relays ,one for UP and 1 for Down(not power and direction like original one)
and i'm having problems to make it work like "blind percentage" switch type on Domoticz.
i read that they were not supported 4 years ago but i think it was already corrected.Right?
picture above its what i got on domoticz, up,down and stop works,but percentage its buggy ,not respond, and status its always closed,even when windows it' full open(full up).my edited code
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 //#define MY_RF24_PA_LEVEL RF24_PA_LOW //#define MY_REPEATER_FEATURE #include <Bounce2.h> #include <MySensors.h> #include <SPI.h> // uncomment if we want to manually assign an ID //#define MY_NODE_ID 1 / #define BUTTON_UP_PIN 5 // Arduino Digital I/O pin number for up button #define BUTTON_DOWN_PIN 6 // Arduino Digital I/O pin number for down button //#define BUTTON_STOP_PIN 7 // Arduino Digital I/O pin number for stop button #define RELAY_UP_PIN 3 // Arduino Digital I/O pin number for direction relay #define RELAY_DOWN_PIN 4 // Arduino Digital I/O pin number for power relay #define RELAY_ON 0 #define RELAY_OFF 1 //#define RELAY_DOWN 1 //#define RELAY_UP 0 #define DIRECTION_DOWN 1 #define DIRECTION_UP 0 #define SKETCH_NAME "Cover" #define SKETCH_VER "2.0" #define CHILD_ID_COVER 0 // sensor Id of the sensor child #define STATE_UP 100 // 100 is open - up #define STATE_DOWN 0 // 0 is closed - down //#define CHILD_ID_CALIBRATE 1 // sensor Id of the sensor child to calibrate #define CHILD_ID_SET 1 // sensor Id of the sensor child to init the roll time #define PRESENT_MESSAGE "shuttle for Livingroom" const int LEVELS = 100; //the number of levels float rollTime = 28.0; //the overall rolling time of the shutter const bool IS_ACK = false; //is to acknowlage static bool initial_state_sent = false;//for hass we need at list one state send at begining // debouncing parameters int value = 0; int oldValueUp = 0; int oldValueDown = 0; //int value1=0;int value2=0; int oldValueStop=0; int oldValueStop1=0; //static unsigned long last_interrupt_time_up = 0; //static unsigned long last_interrupt_time_down = 0; //static unsigned long debounce_time = 200; Bounce debouncerUp = Bounce(); Bounce debouncerDown = Bounce(); //Bounce debouncerStop = Bounce(); // shutter position parameters float timeOneLevel = rollTime / LEVELS; int requestedShutterLevel = 0; int currentShutterLevel = 0; unsigned long lastLevelTime = 0; bool isMoving = false; int directionUpDown; enum CoverState { STOP, UP, // Window covering. Up. DOWN, // Window covering. Down. }; static int coverState = STOP; MyMessage msgUP(CHILD_ID_COVER, V_UP); MyMessage msgDown(CHILD_ID_COVER, V_DOWN); MyMessage msgStop(CHILD_ID_COVER, V_STOP); MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE); //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND); void sendState() { // Send current state and status to gateway. send(msgUP.set(coverState == UP)); send(msgDown.set(coverState == DOWN)); send(msgStop.set(coverState == STOP)); send(msgPercentage.set(currentShutterLevel)); } void shuttersUp(void) { #ifdef MY_DEBUG Serial.println("Shutters going up"); #endif if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) { digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); delay(20); } digitalWrite(RELAY_UP_PIN, RELAY_ON); directionUpDown = DIRECTION_UP; isMoving = true; coverState = UP; sendState(); } void shuttersDown(void) { #ifdef MY_DEBUG Serial.println("Shutters going down"); #endif if (digitalRead(RELAY_UP_PIN) == RELAY_ON) { digitalWrite(RELAY_UP_PIN, RELAY_OFF); delay(20); } digitalWrite(RELAY_DOWN_PIN, RELAY_ON); directionUpDown = DIRECTION_DOWN; isMoving = true; coverState = DOWN; sendState(); } void shuttersHalt(void) { #ifdef MY_DEBUG Serial.println("Shutters halted X"); #endif // Serial.println("2 BOTOES OFF"); // if (digitalRead((RELAY_UP_PIN) || (RELAY_DOWN_PIN) )== RELAY_ON) { digitalWrite(RELAY_UP_PIN, RELAY_OFF); digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); delay(20); //} isMoving = false; requestedShutterLevel = currentShutterLevel; #ifdef MY_DEBUG Serial.println("saving state to: "); Serial.println(String(currentShutterLevel)); #endif saveState(CHILD_ID_COVER, currentShutterLevel); coverState = STOP; //sendState(); } void changeShuttersLevel(int level) { int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN; if (isMoving && dir != directionUpDown) { shuttersHalt(); } requestedShutterLevel = level; } void initShutters() { #ifdef MY_DEBUG Serial.println("Init Cover"); #endif shuttersUp(); delay((rollTime + timeOneLevel * LEVELS) * 1000); currentShutterLevel = STATE_UP; requestedShutterLevel = currentShutterLevel; } void receive(const MyMessage &message) { #ifdef MY_DEBUG Serial.println("recieved incomming message"); Serial.println("Recieved message for sensor: "); Serial.println(String(message.sensor)); Serial.println("Recieved message with type: "); Serial.println(String(message.type)); #endif if (message.sensor == CHILD_ID_COVER) { switch (message.type) { case V_UP: //Serial.println(", New status: V_UP"); changeShuttersLevel(STATE_UP); //state = UP; //sendState(); break; case V_DOWN: //Serial.println(", New status: V_DOWN"); changeShuttersLevel(STATE_DOWN); //state = DOWN; //sendState(); break; case V_STOP: //Serial.println(", New status: V_STOP"); shuttersHalt(); //state = IDLE; //sendState(); break; case V_PERCENTAGE: //Serial.println(", New status: V_PERCENTAGE"); // if (!initial_state_sent) { // #ifdef MY_DEBUG // Serial.println("Receiving initial value from controller"); // #endif // initial_state_sent = true; // } int per = message.getInt(); if (per > STATE_UP) { per = STATE_UP; } changeShuttersLevel(per); //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate //sendState(); break; } } else if (message.sensor == CHILD_ID_SET) { if (message.type == V_VAR1) { Serial.println(", New status: V_VAR1, with payload: "); String strRollTime = message.getString(); rollTime = strRollTime.toFloat(); Serial.println("rolltime value: "); Serial.println(String(rollTime)); saveState(CHILD_ID_SET, rollTime); } } #ifdef MY_DEBUG Serial.println("exiting incoming message"); #endif return; } void before() { // Setup the button pinMode(BUTTON_UP_PIN, INPUT_PULLUP); // Activate internal pull-up digitalWrite(BUTTON_UP_PIN, HIGH); //attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, RISING); pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP); // Activate internal pull-up digitalWrite(BUTTON_DOWN_PIN, HIGH); // attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, RISING); //pinMode(BUTTON_STOP_PIN, INPUT_PULLUP); // Activate internal pull-up //digitalWrite(BUTTON_STOP_PIN, HIGH); // After setting up the button, setup debouncer debouncerUp.attach(BUTTON_UP_PIN); debouncerUp.interval(5); // After setting up the button, setup debouncer debouncerDown.attach(BUTTON_DOWN_PIN); debouncerDown.interval(5); // After setting up the button, setup debouncer // debouncerStop.attach(BUTTON_UP_PIN&&BUTTON_UP_PIN); // debouncerStop.interval(5); // Make sure relays are off when starting up digitalWrite(RELAY_UP_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_UP_PIN, OUTPUT); // Make sure relays are off when starting up digitalWrite(RELAY_DOWN_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_DOWN_PIN, OUTPUT); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_VER); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK); //present(CHILD_ID_SET, S_CUSTOM); } void setup(void) { //set up roll time if the saved value is not 255 Serial.println("getting rolltime from eeprom: "); float tmpRollTime = loadState(CHILD_ID_SET); if (tmpRollTime != 0xff) { rollTime = tmpRollTime; } Serial.println(String(rollTime)); int state = loadState(CHILD_ID_COVER); #ifdef MY_DEBUG Serial.println("getting state from eeprom: "); Serial.println(String(state)); #endif if (state == 0xff) { initShutters(); } else { changeShuttersLevel(state); } } void loop(void) { if (!initial_state_sent) { #ifdef MY_DEBUG Serial.println("Sending initial value"); #endif sendState(); // send(msgCode.set('20.0')); // #ifdef MY_DEBUG // Serial.println("Requesting initial value from controller"); // #endif // request(CHILD_ID_COVER, V_PERCENTAGE); // wait(2000, C_SET, V_PERCENTAGE); initial_state_sent = true; } debouncerUp.update(); value = debouncerUp.read(); if (value == 0 && value != oldValueUp) { changeShuttersLevel(STATE_UP); //state = UP; //sendState(); } oldValueUp = value; debouncerDown.update(); value = debouncerDown.read(); if (value == 0 && value != oldValueDown) { changeShuttersLevel(STATE_DOWN); //state = DOWN; //sendState(); } oldValueDown = value; // debouncerStop.update(); //value = debouncerStop.read(); //if (value == 0 && value !=( oldValueUp||oldValueDown)) { // debouncerDown.update(); // debouncerUp.update(); value = debouncerUp.rose(); if (value == 0 && value != oldValueStop){ shuttersHalt(); } oldValueStop = value; value = debouncerDown.rose(); if (value == 0 && value != oldValueStop1){ shuttersHalt(); } oldValueStop1 = value; if (isMoving) { unsigned long _now = millis(); if (_now - lastLevelTime >= timeOneLevel * 1000) { if (directionUpDown == DIRECTION_UP) { currentShutterLevel += 1; } else { currentShutterLevel -= 1; } #ifdef MY_DEBUG //Serial.println(String(requestedShutterLevel)); Serial.println(String(currentShutterLevel)); #endif lastLevelTime = millis(); //send(msgPercentage.set(currentShutterLevel)); } if (currentShutterLevel == requestedShutterLevel){ //if ((currentShutterLevel == requestedShutterLevel) || (digitalRead(((RELAY_UP_PIN) ==1) &&(RELAY_DOWN_PIN) ==1))) { shuttersHalt(); } } else if (requestedShutterLevel != currentShutterLevel) { if (requestedShutterLevel > currentShutterLevel) { shuttersUp(); } else { shuttersDown(); } lastLevelTime = millis(); } }
what am i missing? thank you .
-
RE: π¬ AC-DC double solid state relay module
how is the board and specially the hlk-pm01 transformer,that is the component that i need more trust ,after 3 years of work?
i want to make some rolle shutter controllers to replace the expensive and buggy fibaro FGR-223 new modules.
-
RE: Never been able to get MySensors to work
@zookazim be carefull with the nrf24 amplified boards.some times you just have less range because you incresed the signal power and starting have ecos and distortions on signals. I only has 1 amplified card and had poor range,just before change everyting to rfm69w ,not even need to be the hight power(hw )version to have more range than on 2.4 ghz cards
-
RE: Never been able to get MySensors to work
2 years and keep trying without ask help??!!!
I'm using lot of sensors since i'm registered on this forum and it works since first day.I only had problems with nrf24 chinese clones range,so a i changed all network to rfm69 and now i have an sensor 50m away from house and keep working every day.
the only diference is that i use a serial gateway connected to raspberry pi. It's the arduino version with and rfm69 conected by usb.
order some rfm69 from ebay and try again and order an arduino pro mini (1.xβ¬) and an genuineftdi(clones won't work) or even an arduino nano with original ftdi chip and connect it by usb to the pi. I assure that it works. -
RE: 'Mysensor' a smoke detector with sound detection
with KY-038 will not work as you expect. Any loud noise,like something fall off will trigger the alarm. or other alarm fires and you thing its fire. i have one working on my visonic alarm for domoticz notify me, but its powered by mains power supply. I never used battery arduino for that because batteries just end in a few months and you think you are safe and you are not.
-
RE: 'Mysensor' a smoke detector with sound detection
how much volts is the smoke sensor powered?3v from 2 AA bateries?
my bet for not drain bateries from smoke sensor itself its use a 3.3v arduino with wireless card(esp,nrf24 or rfm69,depends what you use on gateway) and make the alarm power the arduino itself. It means each time you get an smoke alarm ,the arduino is powered ,boot up and send an signal to gateway or what ever receive it. like this there are no power waste on arduino during months. you can use a transistor to power the arduino from smoke sensor bateries for exemple
-
RE: plant watering node
Nice work. I did someting like this but much simplified. Only one temperature sensor,one soil moisture that i never used , and a 24v AC controlled by 5v DC.
Do you know that this 24v valved(our european ones )work better with low voltage dc, because don't heat up, but need a start up kick from 9v or so and then decrease it to 5v and at that voltage they hold open position and don't get hot .
Domoticz have a timer for every day on summer,and on winter is off. Soil moisture will help in case of rain but i never finish the integration of this one. Next spring i have to finish this
Thank you for sharing your project. -
RE: Raspberry gateway: small range
I changed all my radios to rfm68 exactly because poor range.probably you are on middle of a 2.4ghz signal war. Take a look on your wifi neighborhood.probably there's a lot of 2.4 signal already ,masking you small nrf24 signal.... And then all ebay ones are fake... Just make a try with 2 rfm69w and you never touch an nrf24 again.
-
RE: Advice for Newbie trying to get started
My advise if you want upgrade and improve your domotics in your house is what i done. Domoticz,serial gateway, rfm69h and rfm69hw instead of nrf24 that i used before and replace all cards. Nrf24 have many range problems for me and the the chinise clone that are unknown quality in each order.all diferents each time i order...
-
RE: False triggering PIR sensor
My bet will be the power supply as well. i had one HC-SR501 running from battery for a few months .False triggers? every time sun comes out from a cloud! for outdoor they are crap.
Just for you know about power supplies , last project that i build a k type thermometer(for high temperatures) on my fireplace, i feed it with a HLK-PM01 and while I didn't connect negative terminal to the fireplace steel chassis(ground) , it fluctuate a lot during readings, like 20c then 45c,25 etc.. not even with a capacitor.
-
RE: FTDI No more?
HUM.. nice to advise us then ..and make sense because my windwos 10 have driver updates off(and main updates off aswellβ¦
that explains why i don't have my fake ftdi driver broken on my win 10,because i never update nothing that works,,, grrrr , i hate that Windows update and run policyβ¦by the way ,rollback to previews drivers and lock them from update. how to do?
if that is not enough create a rule on outgoing firewall trafic that block Windows update service and sihclient.exe from runing.
-
RE: FTDI No more?
Yes ,try in other computer to be sure. I already had one windows that ftdi driver was broken(i did it trying revive an almel 34u2) and another time an Windows update (Windows 7 i think) brick all my ebay red and fake ftdi. I had to unbrick them... Nowadays i think Microsoft already don't do that.
-
RE: [SOLVED] 3.3V 8MHz pro mini as GW, should it work?
I don 't know if it helps but i tell you my story. I had all network using nrf24l01(7or8 nodes) and i had some lost data ,random,depend day time etc... So i change all radios to rfm69 and 69hw and never had a lost packet again. Happy end
Now i have an arduino pro mini 3.3v@ 8mhz connected to raspberry by serial (usb ftdi original) managed by domoticz. Rocksolid solution until now. Its there for months (6 maybe). One of the nodes its 50 m outside,on main gate. And same node controls lights,gate open,door bell and a fence perimeter alarm(fence cutted) .Never miss a notification.
This is my solution to not have issues with radios modules
. -
RE: Irrigation controller
Erik .if you dont have a gateway or mysensors implemented in your house yet,you should do someting simple.that schetch its crazy for a new start person.
Some relays that fire by time its enouf. Wifi part that you want provably its realy Wi-Fi,not mysensors conection that its an wireless protocol,(not wifi). We are deep in summer,its not time to make a new irrigation controller from 0 and tryit -
RE: Will a NRF24L01+PA+LNA help with my signal problems
Hi to @Greymarvel .Well i already seen this movie before. I bought diferent nrf24 nodes,amplifed ,not amplified,with or without capacitors. In fact i had worst redults with amp nodes. I just change to rfm69hw and w
. No more low power/high power...etc. now i got my 4000m2 terrain covered (around 80m long).
I didn't check max range but i never had lost a packet again. I was a very good increment on my network stability.
That fake nrf24 chips are crazy and unstable and yes,all ebay cheap nodes are fake second i know. -
RE: Egg incubator IOT v3.0
@rahokos download the file and change the extension from file to .fzz
for any reason it happens when i upload this file. -
RE: π¬ Arduino Pro Mini Shield for RFM69(H)W
@gohan said in Arduino Pro Mini Shield for RFM69(H)W:
If I remeber right that pin is used as input so the RFM69 is not receiving any 5v signal. In addition there are people claming they have the RFM69 module working on 5v on data pins and 3.3v on vcc, but I hardly suggest to do it.
thank you just what i thought .
about direct 5v on data...well... i seen a big red sign saying n :DONT do it! lol
Level converters are so cheap...that i ordered 5 or 10 thoguether with rfm69 board.sorry about hijack this topic, i though i was on general discussion
-
RE: π¬ Arduino Pro Mini Shield for RFM69(H)W
hi.i know that discoussion have some months ,buti'm only doing my rfm69 conversion from nrf24 ,now.
second this picture here, i can leave digital pin 2 from arduino direct to rfm69 d0 pin. Without anylevel converter when use a 5v arduino
is that true? will not fry because that?
i will use a ams1117 3.3v regulator for power rfm69c from my 5v pro minis
sorce:https://learn.sparkfun.com/tutorials/rfm69hcw-hookup-guide -
Domoticz with DIY "razberry" card
hello. like o wrote before my veralite dies after 4 years of work.
So now i'm on Domoticz.For the dead vera lite i recover the z-wave part. i had some doubts that it works but i have seen n razberry cards that the hardware its the same,so why not try.
I just cutted the 4 layers pcb and solder 4 wires on zm3102 chip directly(tx,rc,vcc and gnd). some hot glue and some nail polish /or epoxy to seal cutted sides.There are no working leds but how cares. and yea.I have an external antena . Everything fits inside vera case aswell(recycling on the best),raspbery,zwave card and mysensors GW.
in beginning domoticz didn't detect it like in official zwave cards ,there are some procedures to make before,but soon as setup button gets blue ,was just reset or exclude and then include nodes again on Domoticz. until now (24hours later) everything still work like a charm ,And let me say Domoticz is far more complete than mios os. -
RE: vera ,the green dead brick
Second support,if it won't enters in recover mode(press reset and power it) its dead(defective unit) . Nice term for;buy another.
So i'm configuring Domoticz to give a try with mysensors.
About fibaro zwave devices i'm thinking reverse engenniering vera zwave module and connect it to domoticz. Its that possible?
Vera lite have the z-wave part at one corner of the board. And its a zw0302(3rt geneneration) and an EPROM. If i connect tx,rx,gng and vcc from the chip to raspberry,i have an zwave shield. Or will not work because zwave firmware on the z-wave chip? -
RE: vera ,the green dead brick
I didn't know about razberry limitations. i only have fibaro 222 modules(windows outside aluminium shutters). And i only want that zwave module.The rest are mysensors sensors. Since i found them ,now i don't change the fact that i know how they work and how to repair it ,against the fact of buy already made and get stuck..like happens with vera know!
-
vera ,the green dead brick
hi. my vera just died. i'm changing radios on my mysensors network,from nrf24 to rfm69 and when i connect a new gw with arduino 3.3 volts and new radio, serial port wont detect my gw,so i restart vera. it enters in a restart loop... it already happened a few months after one update, and i recover it by following this steps: http://wiki.mios.com/index.php/Firmware_Flash_VeraLite
but now after flash it with sucess (it says), restart,and no light at all. just flash all lights for a second when plug the power cable and then.... nothing.
no lights ,no response to reset and power in, no response to any ip.
Happend to any of you already? i think its really bricked and i have to move to raspberry and razberry(zwave shield) -
RE: RFM69 antennas comparison
@gohan
Hi. i know that its 3 months + old discussion .but i only read now
i have the same problem,probably same time that hapens to you. my nrf24 modules between front gate and gateway stops comunicating at end of day.
My bet it that signal its already on limit ,(at 50m between gate and home), and at the end of day ,air humidity increase and signal just don't arrive. I already change antennas but signal strengh it's on limit and some days are worst than others.Now i will change all my nrf24 for rfm69's (they arrive today) and try again at 868mhz and simple wire antenna(dipole).
Just for confirm; are the grownd plane from rfm69hw good enought? or i need something more than a piece of wire on ANA pin ? -
RE: Your best advice on buying components?
i have an freeway open between china and my house manage by ebay
There are a lot of online shop like rs-online ,mouser etc but buy and arduino at 30β¬... if Chinese prices don't exist ,today i wasn't here commented that and i just bought all my electronic actuator already assembled from any brand like fibaro or any zwave brand.
I like eletronics but not so much for waste 10β¬ e 2 or 3 mosfets...
thanks to cheap prices i have an smart house that i understand how it works and i did it myself -
RE: Whole house power monitoring.
I'm using an arduino pro mini with an W500 Ethernet module connected directly to router,and a clamp from ebay(100amps i think). arduino and w500 fits inside a small box and its inside main power box,clamped to the main wire from main eletric deferential . I have the (ATI) Telecomonication box at side of power box so its easy to connect to the router. i dont use transformer for volt read,just read Amps because my power its very stable at 230/235v and this is just for " power waste "control
on first moth that i build it i saved 30β¬/moth in power(i not a commercial advertisement ).i had the electric resistance from water solar heating panel (3000w) working during the night,useless because we don't need hot water in morning,only at end of the day. so now i have another arduino that handle the hot water if there is no enough sun during the day... ( arduino pro minifor the win!!! )
This is a screenshot from my emoncms page. like you see my wife its doing cakes and dinner,and the oven and induction plate eat a lot of power ![
-
RE: Transformer-less power supply
myself already debate a little of this kind os tranformless power supply a few months ago.
here: https://forum.mysensors.org/topic/6927/3-3-or-5v-tranformer-for-mysensors-projects/11at the time i found how my zwavemodules worked.and that is the skematic:
It's tested by them and working on my house for more than 3 years and no problem.
the point that i reach is: doesn't worth build all this crap when a 2β¬ mini transformer do the same but safer.
-
RE: Egg incubator IOT v3.0
And that is the result . 14 chicks of 25eggs ,but i could say that was 100% sucess because the other eggs were not fertilized. not even a single dead before or after hatch. Its not the arduino the most versatile machine?
top left chic just born 10min before i take the picture:P
-
RE: Egg incubator IOT v3.0
@dbemowsk ofcourse it can. ..but what happens if DHT22 gone crazy or the main arduino freeze with relay on? Secondary arduino will turn alarm on.
I forgot mention that i'm using mysensors library only on secundary arduino. for communicate with VERA lite and then send info to emoncms.com(for logs)
-
Egg incubator IOT v3.0
Do you think you've seen all kinds of projects here? So ..think again.
There it is my chicken eggs encubator .
Made from a 25 liters plastic storage box and some foam outside to prevent heat loss.
i used 2 X 18w halogen g9 bulbs and a 230v dimmer to decrease light brightness.There is a diagram above from fritzing. I uses an main arduino that controls a SSR relay for controls halogen light bulbs. this light bulbs are dimmed to half(in my case)
for hold temperature much time as possible without decrease temperature.That makes SSR stay on for some minutes before goes off again. if halogen light are to powerfull makes the SSR goes on and off many times in short period. the ideal situation is having the dimmer controlled by arduino and hold temperature without turn ligh off ,but i didn't got this dimmer yet(is there any one ready for try it? ).this is the 3rd version i build and all the other version hatch almost all eggs(+/-80%) even with some issues on controlling temperature.i only had 1 fan and that caused some zones that overheated (more on coners).
Now i have 2x120mm(0.10A) pc fans that can spread hot air the same way in all this box.Then i have a secondary arduino that it's for safe features. it controls an alarm buzzer(pc speaker) ,its connected to an temperature sensor (ds18b20) and send temperature to emoncms.com through an nrf24 wireless board
If temperatures goes over 39ΒΊC or below 30ΒΊC it sound an noisy alarm.Just in case main arduino or DHT22 fail.Egg roller its made os aluminium and plastic egg racks cutted and glued with hot glue(screws were better but this is enought to hold eggs).it makes 45ΒΊ each side.
An High torque servo roll every 60 minutes. Note that an regular servo does not have enough torque should be an high toque version.
eggs ready to start hatching! note the ds18b20 sensor in the back of the DHT22 sensor.they will stay same height than egg rack.
2x18w halogen lighs
lcd screen is configured for simplicity . code have hours and days passed and remaining ,but i decide use just passed days, temperature manual offset and time for next egg roll(minutes),and of course temperature and humidity on first line.
its a mess of cables ...i know. It's what happening when we always improve our project until it be a final version
I used usb cables from computer cases for wire sensors, it work really well .
There's 2 solid state relays on picture but we only need one.Parts:
2x 12v 120mm pc fan(0.10A -slow speed/low noise)
1x LM2596
1x High torque servo or step motor(need additional controller).
1x 5v Arduino pro mini (or equivalent )
1x DHT22
1x 5v relay Or SSR G3MB-202P Solid State
1x 2 lines I2C 1602 LCD (i2c ,not serial) or 4 lines if you what more info on screen like time left and time spent clock.
2x monetary switch
2x 10k resistors
2x 18w halogen light bulbs
2x G9 Ceramic Sockets
1x AC 220V 2000W SCR Voltage Regulator (overkill for 36W i know, but it cost 1.50β¬ on ebay)Optional parts
1x 3.3v pro mini (or equivalent)
1x computer speaker(buzzer)
1x DS18b20
1x NRF24L01
1x 4.7K Resistor
1x 3.7v litio battery (cellphone or 18650 cell)
1x Battery Protection Board(just for charge battery before start hatching)
note: this battery just hold main arduino in case of power failure. During normal work it never charge or discharge due 5v on line from LM2526FRITZING PROJECT:
0_1504458462680_eggencubator v2.fzzCODE:
// Servo version of // Incubator code with lcd 16x2 ####--->> I2C (4 wires) <<--- ### // --------------------------------------------- #include <Wire.h> #include <LiquidCrystal_I2C.h> #include "DHT.h" #include <Servo.h> #define DHTPIN 4 // Define the temp sensor data pin #define DHTTYPE DHT22 // define the temp/hum sensor type #define RELAY_1 7 // define the relay 1 and 2 control pin #define RELAY_2 8 Servo myservo; // create servo object to control a servo DHT dht(DHTPIN, DHTTYPE); //initialize the temp sensor LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE); //set up what port the LCD will use int pos = 0; // variable to store the servo position int istate = 0; const int buttonPin1 = 5; // the pin that the Up pushbutton is attached to const int buttonPin2 = 6; // the pin that the Down pushbutton is attached to int buttonState1 = 0; int buttonState2 = 0; float val = 0; //val to increment/decrement (buttons/ threshold) int is, im, ih, id, ida, iha, ima; // variables for time float time, s1, m1, h1, d1; // Set up variables to calculate time int ic, ip, ik; byte thermo[8] = {B00100, B01010, B01010, B01110, B01110, B11111, B11111, B01110}; //thermometer icon byte drop[8] = {B00100, B00100, B01010, B01010, B10001, B10001, B10001, B01110}; //drop icon byte arrow[8] = { B00100, B01010, B10101, B00100, B10101, B01010, B00100,}; // smile icon byte tim[8] = {B00000, B01110, B10101, B10101, B10011, B10001, B01110,}; // clock icon int END = 0; unsigned long previousMillis = 0; const long interval = 3600000UL; //timer for roll eggs 1HOUR void setup() { Serial.begin(9600); pinMode(buttonPin1, INPUT); pinMode(buttonPin2, INPUT); dht.begin(); //start the temp sensor pinMode(RELAY_1, OUTPUT); pinMode(RELAY_2, OUTPUT); lcd.begin (16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); // start with a blank screen lcd.setCursor(0, 0); // set cursor to column 0, row 0 (the first row) lcd.print("Incubatora 1.0"); // opening line lcd.setCursor(0, 1); // set cursor to column 0, row 1 lcd.print("A iniciar!"); delay(2000); lcd.createChar(0, thermo); lcd.createChar(1, drop); lcd.createChar(2, arrow); lcd.createChar(3, tim); myservo.attach(9); // servo control is set to pin 9 (usually yellow wire is control, black goes to ground red goes to +5V) myservo.write(70); //put the servo at intitial position of 16 degrees myservo.detach(); } //loop to read the sensor and display void loop() { int buttonState1 = digitalRead(buttonPin1); int buttonState2 = digitalRead(buttonPin2); delay(10); if (buttonState1 == HIGH) { val-=0.1; } else if (buttonState2 == HIGH) { val+=0.1; } float h = dht.readHumidity(); // Read the humidity float t = dht.readTemperature(); // Read temperature in celsius float f = dht.readTemperature(true); // get the temperature in Fahreheit //Temperature controller if (t >= (37.7 + val)) { // Set the temperature for the relay to come on (ideal 37.7ΒΊC) digitalWrite(RELAY_1,LOW); // TO HOT: Turns Relay OFF digitalWrite(RELAY_2,LOW); } if (t <= (37.5 + val)) { // Set the temperature for the relay to come on (ideal 37.7ΒΊC) digitalWrite(RELAY_1,HIGH); // TO HOT: Turns Relay ON digitalWrite(RELAY_2,HIGH); } // uncomment to compute heat index in Fahrenheit (the default) //float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) //float hic = dht.computeHeatIndex(t, h, false); time = millis(); // Get time in milliseconds since tunit turn on s1 = time / 1000; // Convert time to seconds, minutes, hours, days m1 = s1 / 60; h1 = m1 / 60; d1 = h1 / 24; id = int(d1); //d // Strip out remainder to leave Days:Hours:Minutes:Seconds ih = int((d1 - int(d1)) * 24); //h im = int((h1 - int(h1)) * 60); //m is = int((m1 - int(m1)) * 60); //s // Calculate approximate TIME till hatch (assume 21 days to hatch) - not used yet ida = 21 - id; iha = 24 - ih; ima = 60 - im; if (isnan(h) || isnan(t) || isnan(f)) { // if sensor can't be read lcd.clear(); lcd.setCursor(0, 0); lcd.print("Falha No Sensor"); Serial.print("Falha No Sensor" ); digitalWrite(RELAY_1,HIGH); // ERRO: Turns 1 Relay OFF to not kill all the eggs digitalWrite(RELAY_2,LOW); delay(5000); return; } else { // for LCD 16x2 //sensor was read succesfully so print values to LCD 16x2 lcd.clear(); // Clear the LCD //Print temperature and humidity in first two lines lcd.setCursor(0, 0); // lcd.print("Temperature:"); lcd.write(byte(0)); // Write the Thermometer icon lcd.print(t , 1); lcd.print((char)223); lcd.print("C "); //lcd.setCursor(0,1); lcd.write(byte(1)); // Write the drop icon // lcd.print("Humidade:"); lcd.print(h, 0); lcd.print("%"); // lcd.print(" "); // lcd.print(ic); lcd.setCursor(0, 1); //lcd.print(" "); lcd.write(byte(3)); lcd.print(" "); // Print timein format Time: xxd:xxh:xxm:xxs lcd.print(id); lcd.print("d "); /* lcd.print(ih); lcd.print(":"); lcd.print(im); lcd.print(" "); lcd.print(is); lcd.print(" ");*/ lcd.print(val,1); if (21 - id <= 3){ // Print days left till hatch lcd.print("!"); END = 1; //stop move eggs } // this section is to roll the eggs unsigned long currentMillis = millis(); int tleft = ((currentMillis - previousMillis)/ 1000) /60; lcd.print(" "); lcd.write(byte(2)); lcd.print(tleft); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; if(istate == 0 && END == 0){ //myservo.attach(9); for (pos = 80; pos <= 155; pos += 1) { // goes from 16 degrees to 80 degrees in steps of 1 degree myservo.attach(9); myservo.write(pos); istate=1; delay(50); } myservo.detach(); } else if( istate == 1 && END == 0) { // myservo.attach(9); for (pos = 155 ; pos >=80; pos -= 1) { // goes from 80 degrees to 0 degrees myservo.attach(9); myservo.write(pos); istate = 0; delay(50); // slow the servo down a bit to turn the eggs } myservo.detach(); } } // Pause for 2 seconds delay(2000); } }
auxiliary/optional arduino
#define MY_DEBUG // --------------------------------------------- #define MY_RADIO_NRF24 #include <SPI.h> #include <MySensors.h> #include <OneWire.h> #include <DallasTemperature.h> #define MY_RF24_PA_LEVEL RF24_PA_LOW // Data wire is plugged into pin 2 on the Arduino #define ONE_WIRE_BUS 2 #define CHILD_ID_EGG 12 //id // Setup a oneWire instance to communicate with any OneWire devices // (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); const int buzzer = 3; //buzzer to arduino pin 3 unsigned int al = 0; bool receivedConfig = false; bool metric = true; MyMessage msg(CHILD_ID_EGG,V_TEMP); unsigned long previousMillis = 0; // will store last time sent temperature const long interval =900000; //15min void before() { // Startup up the OneWire library sensors.begin(); } void setup() { sensors.begin(); pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Temperature eggs", "2.0"); // Present all sensors to controller present(CHILD_ID_EGG, S_TEMP); } void loop() { sensors.requestTemperatures(); // Send the command to get temperatures //Serial.print("Temperature is: "); float t =sensors.getTempCByIndex(0); //Serial.print(t); //-----------------------------timer & send------------------------------------- unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; // Send in the new temperature every 5min send(msg.setSensor(t).set(t,1)); send(msg.set(t,1)); Serial.print(t); } //--------------------------------------------------------------------------------------- //alarm buzzer------- if (t >=37.0) { //(37ΒΊc) al=1; //save 1 when 1st temperature estabilize. after that "al" will be always 1 until reset/shutdows . This makes the alarm not start when incubator still cold on warm up } //Temperature controller alarm if (t >= 39.0) { for (unsigned int i=750; i<2500; i++) { // TO HOT: alarm! tone(buzzer, i ,700); delayMicroseconds (15); } delay(2000); } if (t <= 30.0 && al == 1) { for (unsigned int i=750; i<2500; i++) { // TO HOT: alarm! tone(buzzer, i ,700); delayMicroseconds (15); } delay(2000); } }
NOTE: English it's not my language. i'm sorry some errors that can happens
-
RE: Distance sensor power
step up modules ALWAYS consume more power than stepdown ,like a good voltage regulator.
-
RE: 3.3 or 5v tranformer for mysensors projects
@gohan of course isolation on low voltage cables should be good . i wonder use the nearest top wall junction box to place hi link transformer and then ,over a cat6 newtork cable ,pass 2 meters of cable to feed the sensor(5v) . easily the air conditioned or wash machine gets fire that all cable isolation fail ...
-
RE: NRF24L01+ genuine vs. counterfeit - checked some modules
i only saw this post today. So i dont have any nrf24 that have this square on top righ of the chip. all have a solid circle. that means they are fake right?
obvius i already expect that because they cost 80cents on ebay righ now.... : -
RE: Timer (Emergencie)
if it is an emergency button should be connected directly to relay (connected by hardware). And not using code,because if arduino it's freezed it will not respond and you cant stop it
-
RE: 3.3 or 5v tranformer for mysensors projects
recon psu are great,smal but expensive(12.21β¬) comparably with the mean well IRM-02 or IRM-01(+-5.50β¬) that @rozpruwacz said .
about lnk302 , i have 4 fibaro modules running for 3 to 4 years and never have problems as well.
-
RE: 3.3 or 5v tranformer for mysensors projects
hi guys . I just discovered how some main zwave brands power their modules.
the chip used its LNK302DN and the sckematic its(adapted for 5v or 3.3v):SEE PAGE 4 AND 5
http://www.farnell.com/datasheets/2059771.pdf?_ga=2.242203521.2016163251.1496347222-1734612754.1489089187That's something!
-
RE: Adding local sensor to NodeMCU gateway
@mfalkvidd but then if i have 200 deleted devices .it ill kept everything? how to reset that?
-
RE: Irrigation System (LCD Keypad)
Bruno. Ma Portuguese friend! lol
Because i'm Portuguese too .i will tell you .. the code will not apear here as magic.
So show us what you have done already. hardware connections, code ..etc. and then maybe we can help you.
Do you have any gateway or mysensors network or just its a standalone irrigation system? -
RE: Adding local sensor to NodeMCU gateway
o vera lite the problem is : if i add a new sensor and delete it , id stays there..somewere on vera. and next time device will not be find because it is already there. i have to increase node id number on arduino sketch (i don't know if auto id works).
Anyone know why Vera don't really delete devices and kept te ID somewere? -
RE: 3.3 or 5v tranformer for mysensors projects
@rozpruwacz said in 3.3 or 5v tranformer for mysensors projects:
@Tmaster they require additional circuitry for filtering, look at the "TYPICAL APPLICATION" and "EMC RECOMMENDED CIRCUIT" sections.
crap!
i will use an regular mini trasformer, like hi link or equivalent from a known brand with termal shutdown that hi link don't have. -
RE: Freezer Temperature Alarm finished
Good. I already thought do the same because already had a similar problem but mine was a bad contact mains cable(where connects to fridge motor).
the question is why all fridges don't come with an alarm from factory!?
i didn't do mine because i had problems to pass sensor without drill holes on new fridge -
RE: Battery-powered irrigation controller
@user2684 said in Battery-powered irrigation controller:
Regarding the abnormal battery consumption, I placed two 330uF capacitor between gnd and Vcc of the H-bridge powering the valve and they seem to help. After a few on and off the battery went from 4.70V to 4.68V so it was not affected at all. Not sure if it is a good idea or not but I thought could help the valve to be more gentle against the battery. I've also added a sleep of two seconds just after the digitalOutput pulse so to allow the board not to suffer of the voltage drop before sending the ack back to the controller (it was sometimes lost before).
AA bateries can't handle much current. You are feeding an solenoid (coil) that probably requires 1A for switch state and it drains too much from aa battery. Buy a 12v /7a battery from chinese brand for 10β¬ and use a voltage regulator from ebay and you have you problems gone.
-
RE: 3.3 or 5v tranformer for mysensors projects
look at this beauty that i found when look for MeanWell family:
http://www.image.micros.com.pl/_dane_techniczne_auto/dc ls05-15b03s.pdf5w?
-
RE: 3.3 or 5v tranformer for mysensors projects
@rozpruwacz said in 3.3 or 5v tranformer for mysensors projects:
MeanWell IRM-01
never heard about this ones... they are like hi-link in size . in fact i'm using 4 hi-link now outside house(one repeater,water solar panel ,garden watering and gate control) and 0 problems.but for inside i prefer use something more robust or at least a good brand
but we know,any power supply can fail...that power supply will be behind a 2 key wall switch (for shutters up and down)
something like this: https://forum.mysensors.org/topic/2944/roller-shutter-node -
3.3 or 5v tranformer for mysensors projects
hi. i,m planing build an shutter controller with 2 relays like i already see here ,some with transformer(hlk-pm01) others tranformless(i don't trust them).
I already have many mysensors projects running but its the first one that connects directly to mains 230v and the first to be always on inside wall ,so i want it be safe.
So i search mini transformers to power that node. i find this ones below. they are like hlk-pm01 but are not chinese brand andcost around 6β¬http://docs-europe.electrocomponents.com/webdocs/1266/0900766b81266088.pdf
someone already use it ?
-
RE: How best to find the "best" small solar panel of a particular size?
why use supercaps on an arduino tha consumes so low current? that caps will not discharge during night,when solar panels are not producing energy.?
-
RE: Battery-powered irrigation controller
the only desvantagem you have is ; not having main power there .Because if you have it you coud use standart 24v AC irrigation valves ,controlled by 5vDC as i did and then if power fails it just goes off, because they need current(+-200mha) for work. And they are cheap. the bi state 9v version cost more than 30β¬ and i never use it
-
RE: Sensors giving wrong data after some time
what about the DS18B20? still report stable temperature? apperar be a broken sensors or miss joint(broken solder) or something.
i have one dh22 that is on an egg incubator and already did 2 cycles of hatching eggs with sucess and accurate reading with humidity on about 80%
but just in case i have an DS18B20 as an secundary arduino with a buzzer(5ΒΊc tolerance up and down) just in case dh22 went crazy -
RE: Battery-powered irrigation controller
i think that AA batteries hardly approach the 1A discharge if its your selenoid rate.
Another thing you can change is NEVER trust on a incoming signal to shutdown you valve. if power fails or signal is missing ,you selenoid will be open all life because gw never send the signal in time .what i did is: call time from GW , store it on irrigation node ,and then after time out(2 hours) it shuts off alone .in fact i don't have any code to control valves from gw . Gw only receive status for domotics. all time for valves On and Off its on the node.
See the timeaware sensor example to know how get time from gw and how handle it
you can just use for ex:
if(hour()==09) { //if its 9 hour AM TURN ON
digitalwrite (valve, HIGH)
}
if(hour()==10) { //if its 10 hour AM TURN OFF
digitalwrite (valve,LOW)
}Or on shutdown implement a "time out"timer (if millis have been passed turn off) like on "blink without delay" example
-
RE: Extending range of regular nRF24L01+
so if you have nothing to lose ,cut the antena trace near last smd component and solder an external antena and try again. should increase signal.
-
RE: Extending range of regular nRF24L01+
@gohan said in Extending range of regular nRF24L01+:
Hi guys, I tried the single wire mod but without any noticeable improvement: with a single wall in between I can't go more than 5 mt or I start getting NACK messages. I'll have to try the dipole or my radio modules are crap (as I always suspected)
Tooooooo short! real range of printed antena modules are around 20 to 30m with one wall at midle.
You should have something doing noise,like router on same freq our other 2.4 ghz device on same frequency.
on my case i live ouside city so my router its the only one on 2.4ghz but never cause me problems .
Its really bad luck all your modules come with problemssome of my modules have and laptop antena instead of pcb antena,but only increase range in +/- 5m though walls
there's one increment that i read here from other member did on amplified version; cover the module with aluminium foil ,and leave antenna outside aluminium,i think that avoid signal propagation before antena do this job.(
-
RE: 'MySensoring' a GE Washer
why not connect the buzzer signal direct to arduino analog read? optocoupter for a 80cents arduino?
-
RE: Battery-powered irrigation controller
And about selenoids ,this is how i control them:
on arduino pwm pins you can define how much voltage you send to solenoid with "analogwrite" .
You can use any mosfet or transistor that can handle the 3.5v 1a(buy double or triple value of curente for safe) -
RE: Battery-powered irrigation controller
That's an interesting project!
how are these valve working after almost a month of work?some bi-state valves have reputation of get stuck opened or closed. They are cheap enough to i like them if the don't get stuckAnd what about time to control the valvs. Are you requesting from gateway?
For power you can use a 4v or 5 v solar panel to charge 1 li-io cell with this charge regulators((https://cdn.instructables.com/FSH/L5F0/IO0G95Y5/FSHL5F0IO0G95Y5.MEDIUM.jpg?width=614)) if regular batteries have poor life, and of course you can hide battery box under a flat rock or a tile because sun heat.There are common 9v valves that are bi-state as well ,like the ones used on rain bird 9v programmers
my irrigation controller (24v Ac controlled by 5v Dc) its about to be presented here as well soon i'm finishing tests on attached sensors and stability tests and upload on emoncms.com
-
RE: Watering flowers on the balcony + LED illumination
Nice. i`m building an version that control just 2 selenoids valvs 24v AC controlled by 5-12v DC . i will post it when its ready.stills testing the humidity sensor .. i build it from scratch because i change all the smart features to the sensors instead of depending from the gw.
one of selenoids work all days ,the other just day yes ,day not.
-
RE: Help with irrigation LCD display
probably you have changed lcd type for 4 lines or something. some lcd that i bough recently had even different adress,instead of this
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address to 0x27
had 0x3F or something like this.
-
RE: Hacking a remote control Hunter ceiling fan controller
what about buid an dimmer sensor ,put it directly to the fan motor and forget that remote? that is what i would do. that its all about create a scene for that fan, temperature limits,motion .... smat fan you know
what is the motor power ?
-
RE: Synthetic Sensors
There are someting "fishy" here accelerometers detecting motion when connected to the wall? are the coffee machine shaking walls? and what about motion detectors if you leave water running ... hehe.
but something can be used. microphone will detect machines and motors when a good software behind can recognize that noise,but for measure waste of water or power you can have a one power meter or water meter from mysensors projects for the entire house
that amg8833 is an ir sensor.. for me its good to detect fire or a over heated machine or motor . useful if applied on a co2 or fire alarm sensor or even on burglar alarm. but only the ir sensors cost more than 20euros .imagine total cost of that board -
RE: NRF24 Range
of corse that a clear path its always better that change what already is made. but i only change the antenna when im in a "hole". On that case i cant move my tx sensors so i have to increse power. i hope with a "mini yagi" i can redirect the signal in one direction insted ominidirectional antena. on gw i`m using an old laptop antenna with good results
-
RE: NRF24 Range
@zboblamont said in NRF24 Range:
overkill for ca 50m,
overkill for this ebay nrf24L01+? in real life they don't have this range without modifications. 1 wall ..and its done
-
RE: NRF24 Range
i'm bilding this right now: http://www.qsl.net/eb4eqa/bt_yagi/bt_yagi.htm
i tell you what is the increment of range in the next weekend ...i have one of temp sensors under a water solar panel and the aluminium from the frame get me crazy because that sensor lose many of the sent reads to gw. i will finish that yagi antenna and solder that to my nrf24 and i hope signal increase performance.
in my house (i dont have neighboard les than 80m with wifi signal and noise from other routers or any king of 2.4ghz signals ) i can send a door sensor signal(from my entrance gate) by 50m and 1 wall . that one have this antena alredy on tx:
http://martybugs.net/wireless/collinear.cgi
-
RE: receive message...
imagine i have 2 diferent arduinos with relays. i will upload the same code for both, exept the node_id .
then i want turn node 1 on. gw send message "to the air" and both arduino get message saying "light on"
what i can't understand yet is ,that part of code only says ; if message is v_light turn on, For example
where is the part saying only turn relay 1 on?(differ nodes)will both relays turn on? if they have same code(exept de id)?
-
RE: receive message...
so the problem of try turn one sensor on and turn the other will not exist because its already on message core?
sory about this question but in not good on code as i am on eletronics and i dont know /understand yet all the api
-
receive message...
Hello . on led rgb controller or relay exemples,if you want receive a message from controller part of the code is that one :
void receive(const MyMessage &message) { //When receiving a V_STATUS command, switch the light between OFF //and the last received dimmer value if ( message.type == V_STATUS ) { Serial.println( "V_STATUS command received..." );
My Question is ; if i have 2 diferent relay nodes or rgb controller nodes ,how this simple "if MESSAGE IS V_STATUS or V_LIGHT " define what node refers to?
i mean how to select with one i want to switch on or off?
-
RE: Sensebender serial gateway: serial port not recognized in Vera
If it's not a original FTDI chip vera will not recognise it. I already tried that on v1 of my sensors.
i had to buy a genuine ftdi(difficult to know that on ebay). -
RE: timealerts and mysensors library conflict?
pretty difficult question hum? lol
i solve it by forgetting TimeAlarms.h and set just an hour that triggers the solenoid like this
(HX and MH its the time,[hours] and [minutes] defined at beginning and its set manually)if (hour() == HX && minute() == MX ) { analogWrite(RELAY_PIN,255); delay(400); analogWrite(RELAY_PIN,90); //half voltage(+-5v to 6v) to not burn valve selenoid(hold voltage) digitalWrite(LEDR1,HIGH); //Serial.print("time up"); } else if (hour() == HXend && minute() == MXend ) { digitalWrite(RELAY_PIN,LOW); digitalWrite(LEDR1,LOW); //Serial.print("time down"); }
-
RE: Need advice on choosing software
cheaper: openhab with linux or raspian,can be easy if its the only one controller.
easiest: vera . I use it for more than 4 years and was the beginning of mySensors adventure. one gw and just copy and paste code from already made sensors.now im importing vera stuff to openabe to be like an remote of vera. Vera weak point its the webinterface