@Anticimex okay, thanks for the fast response
Posts made by Fleischtorte
-
RE: 💬 Sensebender Gateway
hi all,
i have some problems to enable encryption on the gateway. When i upload the cleareeprom sketch, the gateway dont clear the eeprom,
the same problem comes up when i want to set the ENC-Key. Both sketches work with my moteino-gateway and my ProMini-Node, so do i miss something with the SensebenderGW-Config?ClearEEPROM:
#if defined(ARDUINO_ARCH_SAMD) while (!Serial) {} // Wait for USB enumeration before setting up serial device #endif Serial.begin(MY_BAUD_RATE); Serial.println("Started clearing. Please wait..."); for (int i=0; i<EEPROM_LOCAL_CONFIG_ADDRESS; i++) { hwWriteConfig(i,0xFF); } Serial.println("Clearing done. You're ready to go!");
Set ENC-Key:
#if defined(ARDUINO_ARCH_SAMD) while (!Serial) {} // Wait for USB enumeration before setting up serial device #endif Serial.begin(MY_BAUD_RATE); Serial.println("Set ENC-Key. Please wait..."); uint8_t key[32]; memcpy(key, user_aes_key, 16); hwWriteConfigBlock((void*)key, (void*)EEPROM_RF_ENCRYPTION_AES_KEY_ADDRESS, 16); Serial.println("Set ENC-Key. Done");
-
RE: openHAB 2.0 binding
Hi@TimO
first, thanks for your awesome work
On the weekend i switched from OH1 to OH2 and your binding is working just out of the box
Im only missing the IR_Send and the V_TEXT sensor to integrate all of my sensors
could you integrate them in your binding? -
RE: rfm69 and atc
hi ,
it works but not very stable... after a while the sensors become offline so i revert to the stable version of MySensors.
-
RE: SCT-013-030 to measure watt
Hi Tmaster,
the SCT-013-030 have an build in burden, the SCT-013-000 dont have one. So you need to calculate the right burden and set the right calibration value (see https://openenergymonitor.org/emon/buildingblocks/how-to-build-an-arduino-energy-monitor-measuring-current-only)
-
RE: SCT-013-030 to measure watt
Hi Patrik,
i use two of these to monitor my washer and dryer. Here is the schematic:
And the MS-Sketch:
/** SCT_Dual_Sensor MySensors 2.0 EmonLib */ // Enable debug prints //#define MY_DEBUG // Set Static NodeID #define MY_NODE_ID 5 // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_RFM69_FREQUENCY RF69_868MHZ #define MY_RFM69_NETWORKID 121 #define MY_RFM69_ENABLE_ENCRYPTION // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #include <EmonLib.h> #define ANALOG_INPUT_SENSOR1 1 #define ANALOG_INPUT_SENSOR2 2 #define CHILD_ID_PWR1 1 // Id of the sensor child #define CHILD_ID_PWR2 2 // Id of the sensor child #define CHILD_ID_RSSI 7 // Id for RSSI Value //Init Emon EnergyMonitor emon1; EnergyMonitor emon2; //Set Vars unsigned long SLEEP_TIME = 60000 - 3735; // sleep for 60 seconds (-4 seconds to calculate values) long wattsum1 = 0; double kwh1 = 0; double wh1= 0; int minutes1 = 61; long wattsum2 = 0; double kwh2 = 0; double wh2 = 0; int minutes2 = 61; //Int Messages MyMessage wattMsg1(CHILD_ID_PWR1,V_WATT); MyMessage kwhMsg1(CHILD_ID_PWR1,V_KWH); MyMessage wattMsg2(CHILD_ID_PWR2,V_WATT); MyMessage kwhMsg2(CHILD_ID_PWR2,V_KWH); MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT); void setup() { emon1.current(ANALOG_INPUT_SENSOR1, 30); // Current: input pin, calibration. stock = 30 emon2.current(ANALOG_INPUT_SENSOR2, 30); // Current: input pin, calibration. stock = 30 double Irms1 = emon1.calcIrms(1480); // initial boot to charge up capacitor (no reading is taken) - testing double Irms2 = emon2.calcIrms(1480); // initial boot to charge up capacitor (no reading is taken) - testing } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Energy Meter Dual SCT013", "0.1"); // Register this device as power sensor present(CHILD_ID_PWR1, S_POWER); present(CHILD_ID_PWR2, S_POWER); present(CHILD_ID_RSSI, S_INFO); } void loop() { // power used each minute if (minutes1 < 60) { double Irms1 = emon1.calcIrms(1480); // Calculate Irms only if (Irms1 < 0.3) Irms1 = 0; long watt1 = Irms1*230.0; // default was 230 but our local voltage is about 240 wattsum1 = wattsum1+watt1; minutes1++; send(wattMsg1.set(watt1)); // Send watt value to gw Serial.print(watt1); // Apparent power Serial.print("W, I= "); Serial.print(Irms1); // Irms int var1 = _radio.RSSI; send(rssiMsg.set(var1)); // Send RSSI value to gw } // end power used each minute if (minutes2 < 60) { double Irms2 = emon2.calcIrms(1480); // Calculate Irms only if (Irms2 < 0.3) Irms2 = 0; long watt2 = Irms2*230.0; // default was 230 but our local voltage is about 240 wattsum2 = wattsum2+watt2; minutes2++; send(wattMsg2.set(watt2)); // Send watt value to gw Serial.print(watt2); // Apparent power Serial.print("W, I= "); Serial.print(Irms2); // Irms } // end power used each minute // hours KW reading if (minutes1 >= 60) { wh1 = wh1 + wattsum1/60; kwh1 = wh1/1000; send(kwhMsg1.set(kwh1, 4)); // Send kwh value to gw wattsum1 = 0; minutes1 = 0; // end of hourly KW reading } // hours KW reading if (minutes2 >= 60) { wh2 = wh2 + wattsum2/60; kwh2 = wh2/1000; send(kwhMsg2.set(kwh2, 4)); // Send kwh value to gw wattsum2 = 0; minutes2 = 0; // end of hourly KW reading } //sleep until the next minute sleep(SLEEP_TIME); }
Also check this site : https://openenergymonitor.org/emon/buildingblocks/ct-sensors-interface
-
RE: Code that was send by mysensor devices
@ArduPino check this site https://www.mysensors.org/download/serial_api_20
-
RE: rfm69 and atc
@Frencho radio.sendwithretry is used (see line 53 in libraries/MySensors/core/MyTransportRFM69.cpp) and ATC must be enabled on GW/Node (use _radio.enableAutoPower(-70); only on the node side).
It seems you need continous traffic to see the effect of ATC (i use a simple relay sketch which reports the rssi with every switch command). -
RE: rfm69 and atc
@frencho @BenCranston
This is my implementation of PR440first download new RFM69 driver from LowPowerLab https://github.com/LowPowerLab/RFM69/archive/master.zip
Replace the files from libraries\MySensors\drivers\RFM69 (copy all and replace)Change in file RFM69.cpp line 31-32
#include <RFM69.h> #include <RFM69registers.h>
to
#include "RFM69.h" #include "RFM69registers.h"
in RFM69_ATC.cpp line 32-34
#include <RFM69_ATC.h> #include <RFM69.h> // include the RFM69 library files as well #include <RFM69registers.h>
to
#include "RFM69_ATC.h" #include "RFM69.h" // include the RFM69 library files as well #include "RFM69registers.h"
i think this was the driver..
next was mysensors
in file libraries/MySensors/MySensor.h line 268
#include "drivers/RFM69/RFM69_ATC.cpp"
in file libraries/MySensors/core/MyTransportRFM69.cpp
first in line 24#include "drivers/RFM69/RFM69_ATC.h"
line 25-26
RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM); uint8_t _address;
to
#ifdef MY_RFM69_Enable_ATC RFM69_ATC _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM); #else RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM); #endif uint8_t _address;
and line 53 idk if this is necessary
return _radio.sendWithRetry(to,data,len);
to
return _radio.sendWithRetry(to,data,len,5);
btw i use not the dev version
https://github.com/mysensors/MySensors/pull/440 see comment from trlafleur
there is my testing node (molgan PIR )
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_NODE_ID 4 #define MY_RADIO_RFM69 #define MY_RFM69_FREQUENCY RF69_868MHZ #define MY_RFM69_NETWORKID 121 #define MY_RFM69_ENABLE_ENCRYPTION #define MY_RFM69_Enable_ATC #include <SPI.h> #include <MySensors.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child #define CHILD_ID_RSSI 7 // Id for RSSI Value // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); // Initialize RSSI message MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT); void setup() { #ifdef MY_RFM69_Enable_ATC _radio.enableAutoPower(-70); Serial.println("ATC Aktiviert"); #endif pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Molgan-PIR", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_DOOR); present(CHILD_ID_RSSI, S_INFO); } void loop() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw int var1 = _radio.RSSI; send(rssiMsg.set(var1)); // Send RSSI value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }
i hope this helps im just learing mysensors & co
david
-
RE: rfm69 and atc
@lafleur thanks for your work! On the weekend i was able to upgrade the driver and enable ATC with RSSI-Report. With the instructions from PR440 it was very easy
-
RE: rfm69 and atc
Hi Scalz,
any progress here? Cant wait to use ATC and the rssi-value for my nodes
Thanks for your workregards
david -
RE: RFM69 gatway problem
Hi Chris,
You can test the RFM69 communication with the example sketchs from LowPowerLab (https://github.com/LowPowerLab/RFM69/tree/master/Examples), you only need the two libarys (SPIFlash, RFM69).