Hello @sundberg84,
I already considered this idea but my node have been running perfectly for two days before failed. So I think, power consideration are not the problem. I can trigg on and off my shutters many and many times without problem.

Posts made by flylowgofast
-
RE: battery level doesn't appear ?
-
RE: battery level doesn't appear ?
Hello all,
At the end, I choose to do a software reset every 24 hours. This solution is very bad for me but it works !!
bye
-
RE: battery level doesn't appear ?
Hello @flopp ,
Sorry I was myself focus on this second problem that's interesting to solve too ?
At the end twice aren't solve ! -
RE: battery level doesn't appear ?
Hello AWI,
Thanks for your reply, yes my node trigs 5 triacs. I use snubber, regulator, capacitor. And ond the other hand, all commands to the node work properly ? just battery level doesn't work and after several hours NRF24L01 stop to work.
I would like to reset NRF24L01 but with MySensors we don't have direct access to it anymore. Perhaps there is a way to reset the sketch globaly ?thanks for your help
-
RE: battery level doesn't appear ?
My real problem is not to send battery level. I try to do that because after 24 or 48 hours my node stop sending messages . So, I hoped that was a way to make it awake !
-
RE: battery level doesn't appear ?
my loop(){}
// the loop routine runs over and over again forever: void loop() { // Process incoming messages (like config from server) gw.process(); //---------------Lecture des ouvertures de porte------------------ doorOpenOffState = digitalRead(HALLOFFICEDOOR); // lecture à chaque cycle (urgence) if (doorOpenOffState != doorOpenOffChange){ gw.send(msgDoorOffice.setSensor(OFFICEDOOR).set(doorOpenOffState)); doorOpenOffChange = doorOpenOffState; } doorOpenBedState = digitalRead(HALLBEDROOMDOOR); // lecture à chaque cycle (urgence) if (doorOpenBedState != doorOpenBedChange){ gw.send(msgDoorBedroom.setSensor(BEDROOMDOOR).set(doorOpenBedState)); doorOpenBedChange = doorOpenBedState; } if (digitalRead(ECLEXT) != oldInterExt){ oldInterExt = !oldInterExt; eclState = !eclState; gw.send(msgLightSwitch.set(eclState)); } //---------------Envoi du niveau de batterie !! pour rester eveillé------------------ /*if ((millis() - myTime) > 10000) { // toutes les dix secondes myTime = millis(); gw.sendBatteryLevel(97,1); } else { if ((millis() - myTime) < 0) { myTime = millis(); } }*/ gw.sendBatteryLevel(97,1); // ---------------Traitement volet 1----------------- analogUpV1 = analogRead(UPV1); if ((analogUpV1 <25) && !manOnV1) { //analogUp proche de zéro et ancienne valeur niveau haut (en l'air) digitalWrite(TRIAC5, HIGH); digitalWrite(TRIAC2, LOW); triacTempoV1 = millis(); triacManPriorityV1 = true; manOnV1 = true; memoStopV1 = false; } else { analogDownV1 = analogRead(DOWNV1); if ((analogDownV1 <25) && !manOnV1) { //proche de zéro digitalWrite(TRIAC5, LOW); digitalWrite(TRIAC2, HIGH); triacTempoV1 = millis(); triacManPriorityV1 = true; manOnV1 = true; memoStopV1 = false; } else { if (analogUpV1 > 800 && analogDownV1 > 800 && !memoStopV1){ // les deux fils en l'air digitalWrite(TRIAC5, LOW); digitalWrite(TRIAC2, LOW); triacManPriorityV1 = false; manOnV1 = false; memoStopV1 = true; } else { if (!triacManPriorityV1){ if (shutterOff1State && shutterOff2State) { shutterOff1State = false; shutterOff2State = false; digitalWrite(TRIAC5, LOW); digitalWrite(TRIAC2, LOW); } else { if (shutterOff1State) { shutterOff1State = false; digitalWrite(TRIAC5, HIGH); digitalWrite(TRIAC2, LOW); triacTempoV1 = millis(); } else { if (shutterOff2State) { shutterOff2State = false; digitalWrite(TRIAC5, LOW); digitalWrite(TRIAC2, HIGH); triacTempoV1 = millis(); } } } } } } } if (((triacTempoV1 + TEMPOOPENV1) < millis())) { digitalWrite(TRIAC5, LOW); digitalWrite(TRIAC2, LOW); triacManPriorityV1 = false; } // --------------------------Traitement volet 2------------------------ analogUpV2 = analogRead(UPV2); if ((analogUpV2 <25) && !manOnV2) { //analogUp proche de zéro et ancienne valeur niveau haut (en l'air) digitalWrite(TRIAC3, HIGH); digitalWrite(TRIAC4, LOW); triacTempoV2 = millis(); triacManPriorityV2 = true; manOnV2 = true; memoStopV2 = false; } else { analogDownV2 = analogRead(DOWNV2); if ((analogDownV2 <25) && !manOnV2) { //proche de zéro digitalWrite(TRIAC3, LOW); digitalWrite(TRIAC4, HIGH); triacTempoV2 = millis(); triacManPriorityV2 = true; manOnV2 = true; memoStopV2 = false; } else { if (analogUpV2 > 800 && analogDownV2 > 800 && !memoStopV2){ // les deux fils en l'air digitalWrite(TRIAC3, LOW); digitalWrite(TRIAC4, LOW); //triac3 = false; //triac4 = false; triacManPriorityV2 = false; manOnV2 = false; memoStopV2 = true; } else { if (!triacManPriorityV2){ if (shutterBed1State && shutterBed2State) { shutterBed1State = false; shutterBed2State = false; digitalWrite(TRIAC3, LOW); digitalWrite(TRIAC4, LOW); } else { if (shutterBed1State) { shutterBed1State = false; digitalWrite(TRIAC3, HIGH); digitalWrite(TRIAC4, LOW); triacTempoV2 = millis(); } else { if (shutterBed2State) { shutterBed2State = false; digitalWrite(TRIAC3, LOW); digitalWrite(TRIAC4, HIGH); triacTempoV2 = millis(); } } } } } } } if (((triacTempoV2 + TEMPOOPENV2) < millis())) { digitalWrite(TRIAC3, LOW); digitalWrite(TRIAC4, LOW); triacManPriorityV2 = false; } }
-
RE: battery level doesn't appear ?
hello,
here is logs from gateway2;4;1;1;3;70;0;3;0;9;send: 0-0-2-2 s=4,c=1,t=3,pt=0,l=1,sg=0,st=fail:7 Finished 0;0;3;0;18;PINGFinished 2;4;1;1;3;70;0;3;0;9;send: 0-0-2-2 s=4,c=1,t=3,pt=0,l=1,sg=0,st=fail:7 0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:97 0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:97 1;255;3;0;0;97 Finished 0;0;3;0;18;PING0;0;3;0;9;read: 65-65-0 s=255,c=3,t=0,pt=1,l=1,sg=0:99 0;0;3;0;9;send: 0-0-65-65 s=255,c=3,t=0,pt=1,l=1,sg=0,st=fail:99 65;255;3;0;0;99 0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:97 0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:97 1;255;3;0;0;97 Finished
Is there a documentation to understand better ?
thanks
-
RE: battery level doesn't appear ?
hello @AWI,
is there a way to verify if my sensor send a newx value ? because I can't use terminal with debug informations, I use Rx / Tx for an other purpose !
thanks
-
RE: battery level doesn't appear ?
Hello @flopp,
I'll try this evening to remove all the code but gw.sendbattery...
I think there isn't problem with { or }, perhaps you don't like my way to write codethanks
-
RE: battery level doesn't appear ?
hello,
thanks for your answer. For me 97,1 means 97% and acknowledge. And the same code work properly with my other nodes with temperature sensors !
Any other ideas ?
-
battery level doesn't appear ?
Hello all,
I have a node with switchs and dimmer, and I tried to send Battery level like that :
if ((millis() - myTime) > 10000) { // toutes les dix secondes myTime = millis(); gw.sendBatteryLevel(97,1); } else { if ((millis() - myTime) < 0) { myTime = millis(); } }
but in Domoticz I can't see the battery level ! however, I have the same code for two other nodes with temperature sensors and in this case It works ? is Battery level for temperature sensors only ?
thanks
-
RE: Pin 1 not usable
Hello, thank you for your reply. You are right, it works fine without debug.
Thanks again
-
Pin 1 not usable
Hello all,
I try to use on Arduino pro mini the pin 1 (Tx) as output to trig a triac. But Since I have been using MySensors, I can't use this pin. Do you have any informations on this problem ? is there a link with led Blinking ?
regads
-
RE: Interruption Vector
thanks to all your contributions, it becomes clear for me.
-
RE: Interruption Vector
Hi, thank you for your reply, the link is very usefull.
You said variables should be Volatile, this is the case for my variable triac1 & 2, but I use two other "const" :static const uint8_t TRIAC1= 3; //Triac 1 associé au timer 2 OC2B pour la sortie D3 static const uint8_t TRIAC2= 10; //Triac 2 associé au timer 1 OC1B pour la sortie D10
Have I to add volatile in this case too ?
Thanks
-
RE: Interruption Vector
Yes you're right,
before MySensors my code was ok, but now MySensors use a librairy in ~/arduino-1.6.7/harware/arduino/avr/cores/arduino/WInterrupts.c
So this use of interrupt is already declare in this library !
I don't now how to avoid the issue ? -
RE: Interruption Vector
ok, but it's a little bit long, this is the part : ISR(INT0_vect) {
#include <MySensor.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #include "config.h" //Définition des constantes pour le projet DomoFab #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No #define MAX_ATTACHED_DS18B20 1 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. MyTransportNRF24 transport(CE, CSN, RF24_PA_LEVEL_GW); MySensor gw(transport);// signerRADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN); float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; // Initialize temperature message MyMessage msgTemp(0,V_TEMP); MyMessage msgDoor(1,V_STATUS); uint32_t triacTempo; volatile uint8_t triac1 = false; volatile uint8_t triac2 = false; uint16_t analogUp; uint16_t analogDown; uint8_t doorOpenState; uint8_t doorOpenChange = 99; //pour passer la première fois unsigned long myTime = 15000; // Pour faire une lecture des valeurs tout de suite // ??????????????????????????? Who am I ????????????????????????????????????????????????????????????????????????????????????????????????????????????? byte role = API2; // première carte avec pro mini capteur de température et capteur de porte // ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? // the setup routine runs once when you press reset: void setup() { printf("DomoFab rRF24 API n°: %u start\n\n\r", role); // initialize the digital pin as an output. pinMode(HALL, INPUT); pinMode(TRIAC1, OUTPUT); // output pin for OC2B pinMode(TRIAC2, OUTPUT); // output pin for OC1B pinMode(ZEROCROSS, INPUT); //passage par zéro du réseau INT0 digitalWrite(UP, HIGH); //Set pull up resistor digitalWrite(DOWN, HIGH); //Set pull up resistor EIMSK = (1 << INT0); //INT 0 enable EICRA = (1 << ISC00); //autoriser n'importe quel changement sur INT0 (D2) à générer une interruption; printf ("\nConfiguration : API2\n\r"); // Startup up the OneWire library sensors.begin(); // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); // Startup and initialize MySensors library. Set callback for incoming messages. gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Temperature Sensor", "1.1"); // Fetch the number of attached temperature sensors numSensors = sensors.getDeviceCount(); Serial.print("nombre de capteur : "); Serial.println(numSensors); // Present all sensors to controller gw.present(0, S_TEMP); gw.present(1, S_DOOR); } /*ISR(TIMER2_COMPB_vect) // interrupt service routine { } ISR(TIMER1_COMPB_vect) // interrupt service routine { } */ ISR(INT0_vect) { if (triac1) { digitalWrite(TRIAC1, HIGH); digitalWrite(TRIAC1, LOW); delayMicroseconds(100); digitalWrite(TRIAC1, HIGH); digitalWrite(TRIAC1, LOW); digitalWrite(TRIAC1, HIGH); digitalWrite(TRIAC1, LOW); digitalWrite(TRIAC1, HIGH); digitalWrite(TRIAC1, LOW); } else { if (triac2) { digitalWrite(TRIAC2, HIGH); digitalWrite(TRIAC2, LOW); delayMicroseconds(100); digitalWrite(TRIAC2, HIGH); digitalWrite(TRIAC2, LOW); digitalWrite(TRIAC2, HIGH); digitalWrite(TRIAC2, LOW); digitalWrite(TRIAC2, HIGH); digitalWrite(TRIAC2, LOW); } } } // the loop routine runs over and over again forever: void loop() { // Process incoming messages (like config from server) gw.process(); //---------------Lecture des valeurs------------------ if ((millis() - myTime) > 10000) { // toutes les dix secondes myTime = millis(); // Attention à la fréquence 16 ou 8 Mhz pro mini Chinois ou pas !!! // Sinon ca ne marche pas et je cherche pendant 3 heures !!! // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); } // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(0):sensors.getTempFByIndex(0)) * 10.)) / 10.; // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[0] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature gw.send(msgTemp.setSensor(0).set(temperature,1)); // Save new temperatures for next compare lastTemperature[0]=temperature; } doorOpenState = digitalRead(HALL); // lecture à chaque cycle (urgence) if (doorOpenState != doorOpenChange){ gw.send(msgDoor.setSensor(1).set(doorOpenState)); doorOpenChange = doorOpenState; }
-
Interruption Vector
Hello all,
few days ago I sent a post to know if I can adapt my hardware to MySensors. SomeOne explained me that is possible, because there isn't constraint with pin to use. That's right, I already have two nodes which work with temperature and door switch.
But now I have an issue with a node which runs two triacs. I need AC power synchronization to drive my triacs and I use ISR (INT0_vect) { }, but when I compile the sketche I have : multiple definition of `__vector_1'
I think it occurs because MySensors use this interruption too ?
Could you help me ?
regards
-
RE: My own hardware
Hello Anticimex,
It's a very good news ! I already produce the software to communicate between 4 nodes. But It seems to be simple to change for MySensors. I think it will be better for the futur. I will earn lot of time.
Thank you for your informations
-
RE: Rain node suddenly draw much power
I already had a problem with a nrf24L01 which suddenly started to consume a lot, but works right. Try with a new one ?
-
RE: My own hardware
Hello thank you for your answer.
when I read your post I understood I was not accurate ! My hardware already have a "radio transport". I use a NRF24L01 but I read some documentation which mention I need special pin available to drive NRF24L01. But mine aren't the same ! is it possible to set differently those pins ?
regards
-
My own hardware
Hello Everybody,
I just registered this morning, a friend of mine spoke about you last week.
I'm very interested in MySensors, but I have already started my own home automation system !!
And I wouln'd like to start again from scratch ! I made my sensor board with my own pin
numbers (arduino pro mini based, with 5 triacs (1dimmer), two open door sensors).So my question is, is it possible to adapt "MySensors" to an existing harware ? because I think it is no usefull to do all this work by my side.
Tell me ?
have a nice day
Flylowgofast