@berkseo do you have a 3d Model of the Sensor? I could support with designing a housing if you want!
Posts made by jeti
-
RE: π¬ EFEKTA Temperature & Humidity mini sensor
-
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo cool thanks for your update, really impressive which detail you are aiming to achieve!
I'm planning to get some as soon as possible already gathering the parts. Any chance you upload the PCB? -
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo it looks very good! Is testing running good?
Any hickups ? -
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo ah thanks. If you need somebody to test. I would be happy to do so.
-
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo on the second restart the temperature shows 46Β°C that's why in wondered of this is caused by testing. As during "normal" using this should not be an issue
-
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo awesome! Great work!
One question: the high temperature is a result of testing? So with a long enough sleep time the temp will be accurate? -
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
@berkseo any chance you can provide a brief feedback?
What is your status on the software side? -
RE: π¬ EFEKTA Temp&Hum sensor(ver. nRF52 )+E-Ink display
Looking good! Please keep up the awesome work.
-
RE: π¬ Aeos : a NRF52 versatile, up to 9in1, device
Sounds good to me! Thanks a lot for your effort!
-
RE: π¬ Aeos : a NRF52 versatile, up to 9in1, device
@scalz just found this project. It looks amazing!
Is there anything we can do to support the progress? -
RE: π¬ NRF2RFM69
@tbowmo i have some left over. If you are interested just shoot me a pm
Thanks
Jeti -
RE: π¬ Arduino Pro Mini Shield for RFM69(H)W
Hi Guys,
I am having troubles with the Version 015 ( i have checked that DI00 is routed to PIN2).
My definition for the radio looks like this:
// Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_FREQUENCY RF69_433MHZ
but i still get a error:
!TSM:FPAR:FAILAdding a capacitor did nit help either. Does someone have a similar Issue?
Thanks
-
RE: π¬ RFM69 Multisensor Node (CR2032)
@mtiutiu
already got the Si7021, will get a MAX44009 and give it a go, I will check back when i started going! -
RE: π¬ RFM69 Multisensor Node (CR2032)
@mtiutiu
is there anything we can do to help you?
I would be really interested :simple_smile: -
only sending first 8 digits of value
Hi all,
I am working on a I Button reader (Key Holder for homestatus use). I have everything working but one detail...
I have 2 seperat OneWire conections (will be 4 in future), each is connected to one reader. Getting the ID of each button works fine but on the first reader I get the ID (8 byte long) and random numbers attached to the end when I send it.
On the second reader there is also a number attached but it stays the same.- is there a way to shorten the send value (V_VAR1) to valid digits?
thanks in advance
oh yes, this is the sketch I am using:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_FREQUENCY RF69_433MHZ #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #include <OneWire.h> // This is the pin with the 1-Wire bus on it OneWire ds_1(3); OneWire ds_2(4); OneWire ds_3(5); OneWire ds_4(6); // unique serial number read from the key byte addr_1[8]; int addr_1_last; byte addr_2[8]; int addr_2_last; // poll delay (I think 750ms is a magic number for iButton) int del = 750; #define CHILD_ID_1 1 #define CHILD_ID_2 2 #define CHILD_ID_3 3 MyMessage ReadMsg_1(CHILD_ID_1, V_VAR1); MyMessage ReadMsg_2(CHILD_ID_2, V_VAR2); MyMessage ReadMsg_3(CHILD_ID_3, V_VAR3); void setup() { Serial.begin(115200); } void presentation() { sendSketchInfo("iButton Reader", "1.0"); present(CHILD_ID_1, S_CUSTOM); present(CHILD_ID_2, S_CUSTOM); present(CHILD_ID_3, S_CUSTOM); } void loop() { byte result; // search looks through all devices on the bus ds_1.reset_search(); for( int i = 0; i < 8; ++i ) addr_1[i] = (char)0; ds_1.search(addr_1); // Serial.println(ds_1.crc8(addr_1,7)); if(ds_1.crc8(addr_1,7) == 0 && addr_1_last == 0) { send(ReadMsg_1.set(0)); addr_1_last = 1; for( int i = 0; i < 8; ++i ) addr_1[i] = (char)0; } else if (ds_1.crc8(addr_1,7) >> 0 && addr_1_last == 1){ send(ReadMsg_1.set(addr_1,HEX)); addr_1_last = 0; } ds_2.reset_search(); for( int i = 0; i < 8; ++i ) addr_2[i] = (char)0; ds_2.search(addr_2); // Serial.println(ds_2.crc8(addr_2,7)); if(ds_2.crc8(addr_2,7) == 0 && addr_2_last == 0) { send(ReadMsg_2.set(0)); addr_2_last = 1; for( int i = 0; i < 8; ++i ) addr_2[i] = (char)0; } else if (ds_2.crc8(addr_2,7) >> 0 && addr_2_last == 1){ send(ReadMsg_2.set(addr_2,HEX)); addr_2_last = 0; } delay(del); return; }
edit:
for clarification:
this is the 8 byte code:
"0102E47F1600003F"
but V_VARxxx is something like:
"0102E47F1600003F0000017CD2861800"
so first 16 digits are correct then random -
RE: first RFM node & Gateway !TSM:FPAR:FAIL (solved)
Hi Guys,
thanks for pointing me in the right direction!
I was missing some defines:#define MY_IS_RFM69HW #define MY_RFM69_FREQUENCY RF69_433MHZ
now everything looks fine. The node is already discovered in FHEM and working!
thanks again!
-
RE: first RFM node & Gateway !TSM:FPAR:FAIL (solved)
-
recheked wiring checked, it is ok (now... DI00 was missing), still the same troubles
-
thea are roughly 40cm apart (Desk)
-
i am using the nrf2rfm69 adapter board, so capacitor is really close
-
downgrading to 2.0 gets this result:
"Starting sensor (RRNNA-, 2.0.0)
TSM:INIT
TSM:RADIO:OK
TSP:ASSIGNID:OK (ID=102)
TSM:FPAR
TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
!TSM:FPAR:FAIL
!TSM:FAILURE
TSM:PDT" -
changing channels and wpoerlevel works in MySensors.h? As I am just starting with the RFM i did not come across that yet. I also stumbled over the "Connecting the Radio" howto, where is mentioned that some lines need to be added to MySensors.h. Is this needed? if yes where to add them?
@maman I know that the NRF is the easier one, and I do have several nodes using it. The range issue of the fake modules is bugging me. therefore is would like to give the RFM a go
thanks for your support !
-
-
first RFM node & Gateway !TSM:FPAR:FAIL (solved)
Hi all,
as the fake NRFs are kind of annoing with ther varying ranges i decied to give the RFMs a try.
Therefore i gut a sensberger gateway with following sketch:/** * 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 * Contribution by a-lurker and Anticimex, * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de> * Contribution by Tomas Hozza <thozza@gmail.com> * * * DESCRIPTION * The EthernetGateway sends data received from sensors to the ethernet link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program. * * LED purposes: * - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error * * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions. * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 // Enable gateway ethernet module type #define MY_GATEWAY_W5100 // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 // Enable Soft SPI for NRF radio (note different radio wiring is required) // The W5100 ethernet module seems to have a hard time co-operate with // radio on the same spi bus. #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #endif // When W5100 is connected we have to move CE/CSN pins for NRF radio #ifndef MY_RF24_CE_PIN #define MY_RF24_CE_PIN 5 #endif #ifndef MY_RF24_CS_PIN #define MY_RF24_CS_PIN 6 #endif // Enable to UDP //#define MY_USE_UDP #define MY_IP_ADDRESS 192,168,1,82 // If this is disabled, DHCP is used to retrieve address // Renewal period if using DHCP //#define MY_IP_RENEWAL_INTERVAL 60000 // The port to keep open on node server mode / or port to contact in client mode #define MY_PORT 5003 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254 // The MAC address can be anything you want but should be unique on your network. // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use. // Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address. #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif #include <Ethernet.h> #include <MySensors.h> void setup() { } void loop() { }
which seems to work nicely:
thats the only debug i get:
"0;255;3;0;9;MCO:BGN:STP
0;255;3;0;9;MCO:BGN:INIT OK,TSP=1"for the only node i use this sketch (which worked fine with a nrf), this is a Arduino Nano with some I-button readers:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #include <OneWire.h> // This is the pin with the 1-Wire bus on it OneWire ds_1(3); OneWire ds_2(4); OneWire ds_3(5); OneWire ds_4(6); // unique serial number read from the key byte addr_0[8]; byte addr_1[8]; int addr_1_last; byte addr_2[8]; int addr_2_last; byte addr_3[8]; // poll delay (I think 750ms is a magic number for iButton) int del = 750; #define CHILD_ID_1 1 #define CHILD_ID_2 2 #define CHILD_ID_3 3 MyMessage ReadMsg_1(CHILD_ID_1, V_VAR1); MyMessage ReadMsg_2(CHILD_ID_2, V_VAR2); MyMessage ReadMsg_3(CHILD_ID_3, V_VAR3); void setup() { Serial.begin(115200); } void presentation() { sendSketchInfo("iButton Reader", "1.0"); present(CHILD_ID_1, S_CUSTOM); present(CHILD_ID_2, S_CUSTOM); present(CHILD_ID_3, S_CUSTOM); } void loop() { byte result; // search looks through all devices on the bus ds_1.reset_search(); for( int i = 0; i < 8; ++i ) addr_1[i] = (char)0; ds_1.search(addr_1); // Serial.println(ds_1.crc8(addr_1,7)); if(ds_1.crc8(addr_1,7) == 0 && addr_1_last == 0) { /* Serial.print("Reader 1a: "); for(byte i=0; i<8; i++) { Serial.print(addr_1[i], HEX); Serial.print(" "); } Serial.print("\n"); */ send(ReadMsg_1.set(0)); addr_1_last = 1; /* Serial.print("addr_1_last: "); Serial.print(addr_1_last); Serial.print("\n"); */ for( int i = 0; i < 8; ++i ) addr_1[i] = (char)0; } else if (ds_1.crc8(addr_1,7) >> 0 && addr_1_last == 1){ /* Serial.print("Reader 1b: "); for(byte i=0; i<8; i++) { Serial.print(addr_1[i], HEX); Serial.print(" ");} Serial.print("\n"); */ send(ReadMsg_1.set(addr_1,HEX)); addr_1_last = 0; /* Serial.print("addr_1_last: "); // for(byte i=0; i<8; i++) { Serial.print(addr_1_last); // Serial.print(" "); } Serial.print("\n"); */ } ds_2.reset_search(); for( int i = 0; i < 8; ++i ) addr_2[i] = (char)0; ds_2.search(addr_2); // Serial.println(ds_2.crc8(addr_2,7)); if(ds_2.crc8(addr_2,7) == 0 && addr_2_last == 0) { /* Serial.print("Reader 2a: "); for(byte i=0; i<8; i++) { Serial.print(addr_2[i], HEX); Serial.print(" "); } Serial.print("\n"); */ send(ReadMsg_2.set(0)); addr_2_last = 1; /* Serial.print("addr_2_last: "); Serial.print(addr_2_last); Serial.print("\n"); */ for( int i = 0; i < 8; ++i ) addr_2[i] = (char)0; } else if (ds_2.crc8(addr_2,7) >> 0 && addr_2_last == 1){ /* Serial.print("Reader 2b: "); for(byte i=0; i<8; i++) { Serial.print(addr_2[i], HEX); Serial.print(" ");} Serial.print("\n"); */ send(ReadMsg_2.set(addr_2,HEX)); addr_2_last = 0; /* Serial.print("addr_2_last: "); // for(byte i=0; i<8; i++) { Serial.print(addr_2_last); // Serial.print(" "); } Serial.print("\n"); */ } delay(del); return; }
where i get this debug:
"0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
6 TSM:INIT:TSP OK
8 TSM:INIT:STATID=102
10 TSF:SID:OK,ID=102
11 TSM:FPAR
3133 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
5140 !TSM:FPAR:NO REPLY
5142 TSM:FPAR
8264 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
10271 !TSM:FPAR:NO REPLY
10273 TSM:FPAR
13395 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
15403 !TSM:FPAR:NO REPLY
15405 TSM:FPAR
18527 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
20534 !TSM:FPAR:FAIL
20535 TSM:FAIL:CNT=1
20537 TSM:FAIL:PDT"a capacitor is already in place on the node.
Am i looking into a Gateway or node issue here? any suggestions?thanks in advance
-
RE: π¬ Sensebender Gateway
So I think i have a maybe already solved issue, but I can not get int working...
In Arduino IDE 1.8.1 this is the error during compiling:"Local\Arduino15\packages\arduino\hardware\samd\1.6.12\cores\arduino/Arduino.h:48:17: fatal error: sam.h: No such file or directory"
-
I have the MySensors SAMD boards installed, so Sensbender Gateway is availabe
-
Arduino SAMD boards are also installed
-
I have installed the "M0" boards
-
Running windows 10 so no need for the inf file, is this correct?
what am I missing?
thanks in advance!
-
-
RE: RFID Reader ID-3LA
@mfalkvidd:
also with S_INFO amd V_TEXT the gateway only receives a "1"...I just searched and played a little more and i got i working now:
/** * ID-3LA Arduino * ----- ------- * GND -> GND * VCC -> +3.3V * D0 -> D5 * D1 -> D6 * FORM -> GND */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #include <SoftwareSerial.h> SoftwareSerial rfid = SoftwareSerial(5, 6); int val = 0; char code[10]; int bytesread = 0; #define CHILD_ID 1 // Id of the sensor child MyMessage KeyMsg(CHILD_ID, V_VAR1); void setup() { Serial.begin(9600); rfid.begin(9600); //Serial.println("Ready"); } void presentation() { sendSketchInfo("RFID Reader", "1.0"); present(CHILD_ID, S_CUSTOM); } void loop(){ if(rfid.available() > 0) { // if data available from reader if((val = rfid.read()) == 10) { // check for header bytesread = 0; while(bytesread<10) { // read 10 digit code if( rfid.available() > 0) { val = rfid.read(); if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading break; // stop reading } code[bytesread] = val; // add the digit bytesread++; // ready to read next digit } } if(bytesread == 10) { // if 10 digit read is complete Serial.print("TAG code is: "); // possibly a good TAG Serial.println(code); // print the TAG code } bytesread = 0; Serial.println(code); send(KeyMsg.set(code)); } } }
The issue seemed to be the string, now with a char it works...
now i only need to get reset the reader every now an then to recognice if a tag is removed. The reader only updates when a tag enters the reading adistance but not when it leaves it.
thanks!
-
RE: RFID Reader ID-3LA
I am using FHEM as controller.
Log of the gateway:
0;255;3;0;9;TSP:MSG:READ 102-102-0 s=1,c=1,t=24,pt=1,l=1,sg=0:1
102;1;1;0;24;1so it receives a "1" correct?
Can Mysesnors handle strings? -
RE: RFID Reader ID-3LA
so this is the debug:
I also just figurer out, that i can only see the tag code when i use 9600 baud, thats why the first line is messed up. When i use 115200 baud the tag ID does not show up...ΒΈΓΓΏi"ΓΉΕΈΓ9qβΕ 3Γ±βΓ’@Γ8>βΉ`ΓΏΓ<βΊΓ%Ε Γ/t6ΓΎTSP:MSG:SEND 102-102-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 102-102-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 102-102-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-102 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:READ 0-0-102 s=255,c=3,t=6,pt=0,l=1,sg=0:M TSP:MSG:SEND 102-102-0-0 s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=ok:RFID Reader TSP:MSG:SEND 102-102-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 102-102-0-0 s=1,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=ok: Request registration... TSP:MSG:SEND 102-102-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-102 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=102, parent=0, distance=1, registration=1 TSP:MSG:READ 154-154-255 s=255,c=3,t=7,pt=0,l=0,sg=0: TSP:MSG:BC 0100B058FD1 TSP:MSG:SEND 102-102-0-0 s=1,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=ok:1 0100B058FD1 TSP:MSG:SEND 102-102-0-0 s=1,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 154-154-255 s=255,c=3,t=7,pt=0,l=0,sg=0: TSP:MSG:BC
can it be the case the the format of the tag ID is not correct?
thanks
-
RFID Reader ID-3LA
Hello everybody,
i am trying to establish a node with a RFID reader to recognice which Resident is at home. Therefore I have a ID-3LA including antenna.
The reader works fin with this sketch:#include <SoftwareSerial.h> SoftwareSerial rfid = SoftwareSerial(5, 6); String msg; void setup() { Serial.begin(9600); rfid.begin(9600); Serial.println("Ready"); } void loop(){ msg = ""; while(rfid.available()>0) { msg += char(rfid.read()); delay(1); } if(msg.length() >= 13) { msg=msg.substring(1,13); tone(4, 262, 100); Serial.println(msg); } }
this code results on the serial Monitor with 9600 baud in something like:
Ready
0100B058FD14which is excactly what i want (for now).
But Iam strugeling implementing it into MySensors, that is what i came up with:
/** * ID-3LA Arduino * ----- ------- * GND -> GND * VCC -> +3.3V * D0 -> D5 * D1 -> D6 * FORM -> GND */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 102 #include <SPI.h> #include <MySensors.h> #include <SoftwareSerial.h> SoftwareSerial rfid = SoftwareSerial(5, 6); String key; #define CHILD_ID 1 // Id of the sensor child MyMessage KeyMsg(CHILD_ID, V_VAR1); void setup() { Serial.begin(9600); rfid.begin(9600); //Serial.println("Ready"); } void presentation() { sendSketchInfo("RFID Reader", "1.0"); present(CHILD_ID, S_CUSTOM); } void loop(){ key = ""; while(rfid.available()>0) { key += char(rfid.read()); delay(1); } if(key.length() >= 13) { key=key.substring(1,13); Serial.println(key); send(KeyMsg.set(key)); } }
but i do not get any readings... as i still consider myself as a started i have very little clou where to beginn finding the wrong/missing parts. It would be great to get some indications or tips.
thanks in advance!
-
RE: RFID v2
@fleshfear: ok got it also working. Thanks. mine works with 3.3V and 5V
-
RE: RFID v2
@fleshfear sorry that i can not help, but i just ran into the very same issue... any solutions yet or at least reasons for the
Couldn't find PN53x board
-
RE: RFID Garage door opener
@Mercury69 I would also love to have a look at your scetch!
-
RE: [contest] My 12 input high precision pulse counter (kWh/ W)
ok found the answer
the latest Time.h is only pointing to TimeLib.h so if I am calling TimeLib.h (instead of Time.h) directly it compiles -
RE: [contest] My 12 input high precision pulse counter (kWh/ W)
@AWI as did got get my modifcations 100% running I was pumped to see your latest update, but for reasons i do not understand i get an error while compiling:
error: 'hour' was not declared in this scope
same is the case for setTime, minute etc...
i already tried some stuff with the time.h but it seems nothing has an impact, not even deleting the whole library (which should end in a "libraby not found" error, but only shows the errors described above)
any idea what to look for?thanks
-
RE: [SOLVED] Node sending many messages
@mfalkvidd : ok thanks i think i got it now.
As i only want to send the temperature and humidity once every x seconds/minutes, but the IR must be always ready for receiving/sending i can not use sleep (otherwise the sensor only sends when the nod is awake.I have now used
wait
which does the trick : So temp and hum only every minute but IR signals whenever i want. Is "wait" the right tool here or a band aid?
thanks!
-
RE: [SOLVED] Node sending many messages
ah ok, so it is generating traffic which is not needed. Is there a way of smart-sleeping without the hearteat? normal sleep does not work with the recieving part of the sketch...
-
[SOLVED] Node sending many messages
Hi
i have combined IR Sending with a SI7021 temperature & humidity sensor.
As i am still new to Mysensors and Arduino i have tweaked to send the temp & humidity once every minute but accept IR orders every 250ms which works fine. My sketch looks like this:// Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 112 #include <SPI.h> #include <MySensors.h> #include <IRLib.h> #include "Adafruit_Si7021.h" #include <Wire.h> #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_IR 2 // childId int counter = 0; Adafruit_Si7021 sensor = Adafruit_Si7021(); IRsend irsend; MyMessage msgIR(CHILD_ID_IR, V_VAR1); MyMessage msgT(CHILD_ID_TEMP, V_TEMP); MyMessage msgH(CHILD_ID_HUM, V_HUM); void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("IR Sender & Temp Hum", "1.0"); // Register a sensors to Use binary light for test purposes. present(CHILD_ID_IR, S_LIGHT); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP,S_TEMP); delay(500); // Allow time for radio if power useed as reset sensor.begin(); } void loop() { smartSleep(250); // adjust sleeping time here 250ms in this case ServerUpdate(); counter ++; } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { int incomingRelayStatus = message.getInt(); if (incomingRelayStatus == 1) { irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power } else { irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power wait(1000); // Pause zwische zwei mal ausschalten irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power } } } void ServerUpdate() // used to read sensor data and send it to controller { double T, H; T=sensor.readTemperature(); H=sensor.readHumidity(); if (counter >= 240){ // 240*250ms = 1minute send(msgT.set(T,1)); send(msgH.set(H,1)); counter = 0; // unmark for debuging // Serial.print("T = \t"); Serial.print(T, 1); Serial.print(" degC\t"); // Serial.print("H = \t"); Serial.print(H, 1); Serial.println(" %\t"); } }
It works like it should but in debugging mode I see that it seems to send a lot of messages like this:
TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251177 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251739 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252301 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252862 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253424 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253984 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:254544 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255106 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255670 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256231 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256791 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257351 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257913 TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:258473
so i guess it is spaming my setup, or does it?
It would be greate to understand why these messages are sent and how to avoid this.and once every minute:
TSP:MSG:SEND 112-112-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:23.1 TSP:MSG:SEND 112-112-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:59.2
which is fine
It would be greate to understand why these messages are sent and how to avoid this.
thanks in advance
-
RE: My Slim 2AA Battery Node
ups... C5 is also not there on my board,it shoud be parallel to C4!
-
RE: My Slim 2AA Battery Node
@carmelo42: maybe this helps, all Cs and the R assembled!
0_1476615490017_20161016_125251.jpg -
RE: π¬ Dimmable LED Actuator
so this works now like a charm:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 153 #include <SPI.h> #include <MySensors.h> #define SN "MultiDimmableLED" #define SV "1.1" #define noLEDs 3 const int LED_Pin[] = {3, 5, 6}; #define FADE_DELAY 25 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim) static int currentLevel = 0; // Current dim level... MyMessage dimmerMsg(noLEDs, V_DIMMER); MyMessage lightMsg(noLEDs, V_LIGHT); /*** * Dimmable LED initialization method */ void setup() { // not sure this works // Pull the gateway's current dim level - restore light level upon sendor node power-up for (int sensor=1; sensor<=noLEDs; sensor++){ request( sensor, V_DIMMER ); } } void presentation() { // Register the LED Dimmable Light with the gateway for (int sensor=1; sensor<=noLEDs; sensor++){ present(sensor, S_DIMMER); wait(2); } sendSketchInfo(SN, SV); } /*** * Dimmable LED main processing loop */ void loop() { } void receive(const MyMessage &message) { if (message.type == V_LIGHT || message.type == V_DIMMER) { // Retrieve the power or dim level from the incoming request message int requestedLevel = atoi( message.data ); // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on] requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 ); // Clip incoming level to valid range of 0 to 100 requestedLevel = requestedLevel > 100 ? 100 : requestedLevel; requestedLevel = requestedLevel < 0 ? 0 : requestedLevel; Serial.print( "Changing LED " ); Serial.print(message.sensor); Serial.print(", PIN " ); Serial.print( LED_Pin[message.sensor] ); Serial.print(" level to " ); Serial.print( requestedLevel ); Serial.print( ", from " ); Serial.println( currentLevel ); fadeToLevel( requestedLevel, message.sensor ); // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value... send(lightMsg.set(currentLevel > 0 ? 1 : 0)); // hek comment: Is this really nessesary? send( dimmerMsg.set(currentLevel) ); } } /*** * This method provides a graceful fade up/down effect */ void fadeToLevel( int toLevel, int ledid ) { int delta = ( toLevel - currentLevel ) < 0 ? -1 : 1; while ( currentLevel != toLevel ) { currentLevel += delta; analogWrite(LED_Pin[ledid-1], (int)(currentLevel / 100. * 255) ); wait( FADE_DELAY ); } }``` thank you :thumbsup:
-
RE: π¬ Dimmable LED Actuator
Hi,
thank you both, i will be testing soon!
thanks again!
-
RE: π¬ Dimmable LED Actuator
Hi,
i am still kind of a beginner in programming...
how does the:
* This sketch is extensible to support more than one MOSFET/PWM dimmer per circuit. * http://www.mysensors.org/build/dimmer
work?
i have tried starting with adding a "_1" LED_PIN and other stuff:
#define LED_PIN 3 // Arduino pin attached to MOSFET Gate pin #define LED_PIN_1 6 // Arduino pin attached to MOSFET Gate pin #define FADE_DELAY 35 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim) static int currentLevel = 0; // Current dim level... static int currentLevel_1 = 0; // Current dim level... MyMessage dimmerMsg(0, V_DIMMER); MyMessage dimmerMsg1(1, V_DIMMER); MyMessage lightMsg(0, V_LIGHT); MyMessage lightMsg1(1, V_LIGHT); /*** * Dimmable LED initialization method */ void setup() { // Pull the gateway's current dim level - restore light level upon sendor node power-up request( 0, V_DIMMER ); request( 1, V_DIMMER ); } void presentation() { // Register the LED Dimmable Light with the gateway present( 0, S_DIMMER ); present( 1, S_DIMMER ); sendSketchInfo(SN, SV); }
, but this does not seem right, as i can not differentiat between for the input
thanks in advance
-
RE: [contest] My 12 input high precision pulse counter (kWh/ W)
@AWI thanks alot, i will have a look
hopefully nothing serios... either way all the best
-
RE: [contest] My 12 input high precision pulse counter (kWh/ W)
@AWI:
would you mind sharing the sketches?
-
RE: [contest] My 12 input high precision pulse counter (kWh/ W)
did anybody already upgraded the 12 Input pulse counter to 2.0? just asking :bowtie:
-
NodeMcu & NRF WiFi connection issue
Hi Guys,
i do have right now a problem with me NodeMcu NRF Gateway,
it was working for some time ok but after one reboot (yes it did work before) i did not come back up this is the code i am using:/** * 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 * Contribution by a-lurker and Anticimex, * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de> * Contribution by Ivo Pullens (ESP8266 support) * * DESCRIPTION * The EthernetGateway sends data received from sensors to the WiFi link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * VERA CONFIGURATION: * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003 * * LED purposes: * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error * * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions. * nRF24L01+ ESP8266 * VCC VCC * CE GPIO4 * CSN/CS GPIO15 * SCK GPIO14 * MISO GPIO12 * MOSI GPIO13 * GND GND * * Not all ESP8266 modules have all pins available on their external interface. * This code has been tested on an ESP-12 module. * The ESP8266 requires a certain pin configuration to download code, and another one to run code: * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch') * - Connect GPIO15 via 10K pulldown resistor to GND * - Connect CH_PD via 10K resistor to VCC * - Connect GPIO2 via 10K resistor to VCC * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch') * * Inclusion mode button: * - Connect GPIO5 via switch to GND ('inclusion switch') * * Hardware SHA204 signing is currently not supported! * * Make sure to fill in your ssid and WiFi password below for ssid & pass. */ #include <EEPROM.h> #include <SPI.h> // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 // Enables and select radio type (if attached) #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "correctnetwork" #define MY_ESP8266_PASSWORD "correctpassword" // Enable UDP communication //#define MY_USE_UDP // Set the hostname for the WiFi Client. This is the hostname // it will pass to the DHCP server if not static. // #define MY_ESP8266_HOSTNAME "wifi-sensor-gateway" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,1,81 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 77 // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway // #define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 // Flash leds on rx/tx/err // #define MY_LEDS_BLINKING_FEATURE // Set blinking period // #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Led pins used if blinking feature is enabled above #define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin #define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin #define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED #if defined(MY_USE_UDP) #include <WiFiUDP.h> #else #include <ESP8266WiFi.h> #endif #include <MySensors.h> void setup() { } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
and this is the seriel monitor output:
0β~?β4βΓ¢£ÿOKZΓΎΓ»0;255;3;0;9;Starting gateway (RNNGE-, 2.0.0)
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSM:RADIO:OK
0;255;3;0;9;TSM:GW MODE
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 7
cnt
chg_B1:-40connected with jandj, channel 11
dhcp client start...
0;255;3;0;9;TSM:READY
f r-40, scandone
...................pm open,type:2 0
...........
The dotted ilne will go forever
It seams that it still wants to get a DHCP adress which i do not want.I already tried using older ESP Versions in the Board Manager but this resulted in a error during compiling
I also did a eeprom clean with the Mysensors: ClearEepromConfig.ino
A normal blinking scetch does work on the NodeMcuAny ideas?
thanks
-
RE: Yet Another RGB driver (activeRGB)
@activemind
do you already have a BOM? and is there chance to help you out? I would be willing to assemble one or two of the boards :bowtie: -
RE: Yet Another RGB driver (activeRGB)
i just found you project, looks pretty cool!
did you manege to get it running? -
Another all-in-one PCB
Hi all,
as many of you already did your own design, I also started working on that, as any other solution only covered 75% of my whishes .
Therefore i established my own :bowtie: , but as I am a beginner in Hardwaredesign I would like to ask for your opinion to do as little mistakes as possible.What i wanted:
-
arduino Pro mini (china)
-
2 LED Dimmer circuits
-
1Wire for SHt7021 and light sensor
-
DS18b20 connection
-
PIR connection
-
small form factor (no mounting holes needed yet)
thats what i came up with (KiCad files):
0_1459080161874_Mysensor_1.pdf
0_1459080236009_Mysensors_01.kicad_pcb
0_1459080257370_Mysensors_01.schIt would be great to get some feedback about layout and the schematics!
thanks in advance!
-
-
RE: KiCad Arduino footprint
The footprint should show how the board, component looks in reality, correct?
then the Mysensors one is different: (it is rotated 180, the programming pins are not shown)
EDIT: I just double checked, you are right, pins are corresponding only 27-29 is additional, never-mind, thanks for your making me look again!
-
KiCad Arduino footprint
Hi all,
I am just getting started working with KiCad, adding the MySensors libraries is working fine, also footprints are good!
The only thing i am still looking for is a comprehensive Arduino lib including footprints for some china Arduinos, especially for this one:
Any idea where I could get the missing footprint and library?thanks
Jeti -
RE: MySensors shield and RGBW Controller
Cool thanks! What MOSFETs do you use?
Thanks again for you effort!!! -
RE: MySensors shield and RGBW Controller
@LastSamurai: I would also be really interested in the BOM!
-
RE: My sensorboard MYS 1.0beta
@Nicola-Reina said:
Anybody wanting 10 kits at a bargain price. I am sellling them at bargain price due to lack of time to play with them.
If you are in Rome I can hand it over directly . If you are at EU maker faire this week end even better see you there.
Otherwise I ship them tooKR
Still got the 10Kits?
-
RE: Power/ Usage sensor - multi channel - local display
was not that much work
this is the modified master-sketch from AWI i am starting to use. The changes i made:
-deletion of LCD and rotray part
-deletion of accumulation part
-modified meterType to meter800, meter1000 and meter2000 this reflects meters with 800imp/khw;1000imp/kwh;2000imp/kwhI am using this with only one meter (2000imp/kwh) for now and works pretty nicly second different meter type is on the way.
As I am a beginner please be gentle with comments
#include <MySensor.h> // MySensors network #include <SPI.h> #include <Time.h> #include <ArduinoJson.h> // used to parse the simple JSON output of the pulse meter https://github.com/bblanchon/ArduinoJson // Constants & globals const int NO_METERS = 1 ; // actual meters used (max 12) const int NODE_ID = 152 ; // fixed MySensors node ID const int JSON_LENGHT = 80 ; // Maximum json string length // new V_TEXT variable type (development 20150905) const int V_TEXT = 47 ; // new S_INFO sensor type (development 20150905) const int S_INFO = 36 ; char lastLCD1[21] = "-- "; // LCD message line typedef enum meterTypes: int8_t {meter800, meter1000, meter2000} ; // metertype meter800, meter1000, meter2000; const char METER_NAMES[NO_METERS][4] = {"PC"} ; // meter names const meterTypes METER_TYPES[NO_METERS] = {meter2000}; const unsigned long idleTime = 10000 ; // Delay time for any of the states to return to idle unsigned long idleTimer ; // Delay timer for idleTime union { // used to convert long to bytes for EEPROM storage long kWhLongInt; uint8_t kWhLongByte[4]; } kWhLong ; // Possible states for the state machine. // Idle: default state, show totals for in/out nett // Browse: dive into meter details // Update: update meter value (Wh total) // Reset: reset day values enum States: int8_t {IDLE, BROWSE, UPDATE, RST} ; uint8_t State = IDLE; // current state machine state // meter class, store all relevant meter data (equivalent to struct) class pulseMeter { public: long UsageWh; // last (current) usage (in W) from pulse counter long UsageAccumWh; // usage accumulator (to keep in sync) from pulse counter long PowerW; // actual power, calculated from pulse "rate" long DayUsageWh; // daily usage for display meterTypes Type; // metertype for addition in totals: meter800, meter1000, meter2000; char Name[4] ; // meter name for display }; pulseMeter pulseMeters[NO_METERS] ; // define power meters //pulseMeter meter800, meter1000, meter2000; // pulse/kWh unsigned long tempUsageWh ; // temporary store while manually updating (state UPDATE) // Json parser: define parse object: <10> = number of tokens in JSON: ~10 per m (4 * [key, value] + key_total, value_total)) // example: "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}" char json[JSON_LENGHT] ; // Storage for serial JSON string (init for example) // flags & counters bool timeReceived = false; // controller time bool newDay = false; // reset at 00:00:00 unsigned long lastUpdate=0, lastRequest=0, lastDisplay=0, lastSyncKWH=0; // loop timers for once in while events int updateMeter = 0; // current meter for update bool updateDisplayFlag = true ; // indicate that display needs to be updated int currentMeter = 0; // active meter for update & check, cycles through meters (0..NO_METERS-1) int lastRotary = 0; // last rotary encoder position int updateIncrement = 1000 ; // Interval multiplier for Update int errCount = 0 ; // error counter // *** Definition and initialisation // define the MySensor network MySensor gw; // pins used RFX24(default 9,10) // Initialize messages for sensor network MyMessage powerMsg(0,V_WATT); // message to send power in W MyMessage usageMsg(0,V_KWH); // message to send usage in kWH MyMessage textMsg(0,V_TEXT); // message to send/receive text // function to reset the Arduino (jump to 0 address) void(* resetFunc) (void) = 0;//declare reset function at address 0 void setup(void) { gw.begin(incomingMessage, NODE_ID, false); // this node is fixed, no repeat //Send the sensor node sketch version information to the gateway gw.sendSketchInfo("AWI-12ChannelPulse", "2.0"); // Initialize the meter names // Register all Pulse counters to gw (they will be created as child devices from 0 to MAX-1) for (int x = 0; x < NO_METERS; x++){ gw.present(x, S_POWER, METER_NAMES[x]); // present power meters to gateway delay(10); // give it some time to process } delay(100); for (int x = 0; x < NO_METERS; x++){ // initialize previous kWh values from EEPROM and init for (int y = 0; y < 4 ; y++){ // convert from bytes kWhLong.kWhLongByte[y]= gw.loadState(x *4 + y) ;// EEPROM position = meter number * 4 bytes } // controller is updated later automatically pulseMeters[x].UsageWh = kWhLong.kWhLongInt; strcpy(pulseMeters[x].Name, METER_NAMES[x] ); // copy string for meter names pulseMeters[x].Type = METER_TYPES[x]; // Set type } } void loop(void) { // Before specific states, perform generic tasks unsigned long now = millis(); // Timer in loop for "once in a while" events gw.process() ; // process incoming messages // If no time has been received yet, request it every 10 second from controller if ((!timeReceived && (now-lastRequest > 10*1000)) || (now-lastRequest > 3600000UL)){ // request update every hour to keep in sync Serial.println(F("requesting time")); // Request time from controller. timeReceived = false; gw.requestTime(receiveTime); lastRequest = now; } // Check if new day has started (hour == 0) and reset day usage counters of meters if (hour()==0 && !newDay){ newDay = true; for (int x = 0; x < NO_METERS; x++){ pulseMeters[x].DayUsageWh = 0 ; // reset daily counters saveMeters(x); // save meter values to EEPROM } } else if(hour() != 0 && newDay) // reset newday flag if hour != 0 { newDay = false;} // Every 10 seconds update one meter to controller to avoid traffic jams if (now-lastSyncKWH > 10000){ // printPulsemeter(updateMeter); sendPowerUpdate(updateMeter); // update the values for currentMeter updateMeter++ ; if (updateMeter >= NO_METERS){ // increment and wrap current meter updateMeter = 0 ;} lastSyncKWH = now ; } // Update sensors every 10 secs if (now-lastUpdate > 10000) { // get values to be displayed from controller lastUpdate = now; } // get readings from serial (sent every 10s) // format {"m":meter,"c":count,"r":rate, "cA":countAccum} // use JSON parser to process (could be replaced by simple split routine, but this works just fine) if(readLineJSON(Serial.read(), json, JSON_LENGHT) > 0 ){ //dummySerial(), Serial.read() // if(readLineJSON(dummySerial(), json, 80) > 0 ){ //dummySerial(), Serial.read() Serial.println(json); storeMeterJSON(json); //store the meter reading //calcMeterTotals(); // update totals } } // This is called when a new time value was received void receiveTime(unsigned long controllerTime) { // Ok, set incoming time Serial.print(F("Time value received: ")); Serial.println(controllerTime); setTime(controllerTime); // set the clock to the time from controller timeReceived = true ; } // This is called when a message is received void incomingMessage(const MyMessage &message) { // Expect few types of messages from controller, V_VAR1 for messages if (message.type==V_TEXT) { // if message comes in, update the kWH reading for meter with value since last update // Write some debug info //Serial.print("Last reading for sensor: "); //Serial.print(message.sensor); //Serial.print(", Message: "); //Serial.println(message.getString()); } } // save Meter to EEPROM when needed void saveMeters(int8_t meterNo){ kWhLong.kWhLongInt = pulseMeters[meterNo].UsageWh ; // convert to separate bytes via struct for (int y = 0; y < 4 ; y++){ gw.saveState(meterNo * 4 + y, kWhLong.kWhLongByte[y]) ; // EEPROM position = meter number * 4 bytes } } void sendPowerUpdate(int meterNo) // Sends update to controller for current meter { gw.send(powerMsg.setSensor(meterNo).set((long)pulseMeters[meterNo].PowerW)); // meterNo * 100 )); gw.send(usageMsg.setSensor(meterNo).set((float)pulseMeters[meterNo].UsageWh/1000L ,3)); // send in kWh! } int storeMeterJSON(char *json) /* convert JSON to values and store in corresponding meter (if used) input: JSON string (can be wrong formatted), with length output: changed meter record number or -1 if error use JsonParser */ { StaticJsonBuffer<50> jsonBuffer; // 4 object -> 4 + 4*10 = 44 // char njson[] = "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}"; JsonObject& root = jsonBuffer.parseObject(json); if (!root.success()) { Serial.println(F("JsonParser.parse() failed")); errCount++ ; return -1; } int m = (long)root["m"]; if (m > NO_METERS){ // meter value out of range for used meters (m starts at 1) return -1 ; } else { // update meter values, Power is momentary, Usage is cumulative long newAccumWh = (long)root["cA"] ; long newWh = (long)root["c"] ; long diffAccumWh = newAccumWh - pulseMeters[m-1].UsageAccumWh; // check for missed pulses by comparing cA with last stored value if (diffAccumWh >= newWh){ // no difference or missed pulses -> correct: add difference pulseMeters[m-1].UsageWh += diffAccumWh; pulseMeters[m-1].DayUsageWh += diffAccumWh; } else { // negative diff, out of sync -> add pulses only (can be out of range or restart) pulseMeters[m-1].UsageWh += newWh; pulseMeters[m-1].DayUsageWh += newWh; } pulseMeters[m-1].UsageAccumWh = newAccumWh; // always update sync counter (only for sync and error correction(serial)) if ((long)root["r"] == 0){ // calculate power from pulse rate (ms) and truncate to whole Watts pulseMeters[m-1].PowerW = 0; // if overflow assume no Usage } else if (pulseMeters[m-1].Type == meter800){ pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]*0.8); // rate in microseconds for 800 pulse/kWh } else if (pulseMeters[m-1].Type == meter1000){ pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]); // rate in microseconds for 1000 pulse/kWh } else if (pulseMeters[m-1].Type == meter2000){ pulseMeters[m-1].PowerW = long( 3600000000L / (long)root["r"]/2); // rate in microseconds for 2000 pulse/kWh } else { Serial.println("geht nicht"); } return m ; } } int readLineJSON(int readch, char *buffer, int len) /* checks for JSON and when started append char tot buffer and checks for line completion usage: static char buffer[80]; if (readline(Serial.read(), buffer, 80) > 0) { // line complete} returns simple JSON */ { static int pos = 0; int rpos; if (readch > 0) { switch (readch) { case '\n': // Ignore new-lines break; case '\r': // Return on CR rpos = pos; pos = 0; // Reset position index ready for next time return rpos; default: if (pos < len-1) { buffer[pos++] = readch; buffer[pos] = 0; } } } // No end of line has been found, so return -1. return -1; } /* int dummySerial() // Acts as a dummy JSON serial character generator for debugging // input: none // output: preset JSON string { static int pos = 0; char json[] = "{\"m\":1,\"c\":12,\"r\":120000,\"cA\":12345}\r{\"m\":2,\"c\":212,\"r\":2120000,\"cA\":212345}\r{\"m\":3,\"c\":212,\"r\":2120000,\"cA\":212345}\n\r"; if (pos++ >= strlen(json)){ pos = 0; } return json[pos] ; } */ /* void printPulsemeter(int meter) // prints the Pulsemeter record to serial out { Serial.print("m:"); Serial.print(meter); Serial.print("type:"); Serial.print(pulseMeters[meter].Type); Serial.print(", power: "); Serial.print(pulseMeters[meter].PowerW); Serial.print(", usage: "); Serial.print(pulseMeters[meter].UsageWh); Serial.print(", day usage: "); Serial.println(pulseMeters[meter].DayUsageWh ); // Serial.print(", Ca: "); // Serial.println(pulseMeters[meter].UsageAccumWh); } */
-
RE: [solved] switch and dimmer gone after update
@m26872: Ithink you are right, that would have helped too, or just deleting the device and getting it autoincluded again help too
thanks -
RE: Power/ Usage sensor - multi channel - local display
@AWI: nevermind I will start workin on it
Thanks again for the great work! -
RE: Power/ Usage sensor - multi channel - local display
@AWI thanks again!
I am using your sketches with only one S0 Meter (the 2000pulse/kwh one).
*One thing i just found out, that as long as the master arduino is connected to the serial port of my pc it is running fine but when its not, it does not send.I have checked the voltage at the radio and it is the same... I also do not have any display or rotary encoder, as I do the visualisation with FHEM.
Do you know why this is the case? * -> Voltage was to low... but the secon question remains:Any idea to use differen pulses/kwh S0 meters? for example one 2000pulse/kwh and one 800 pulse/kwh.
thanks in advance! -
[solved] switch and dimmer gone after update
Hi all,
the todays update of the Mysensors modul in FHEM caused my switches and dimmer to not work anymore:
error: "switch1 not defined: no mapping for reading switch1"
and the same with the dimmer:
"dimmer1 not defined: no mapping for reading dimmer1"did this also happen to some of you?
thanks
-
RE: Power/ Usage sensor - multi channel - local display
@AWI
thanks! as i do not have display (yet) i just did the calculations in the "sendPowerUpdate" -> now it works perfect
I just double check with a powermeter to see if everything is ok. -
RE: Power/ Usage sensor - multi channel - local display
Hi, great work
as my S0 meter uses 2000imp/kwh and my reading seem to be twice as high as they should be i guess your meters do 1000imp/kwh?
As i am still working on my programming skills i could not figure out where to change this
can you give me a hint which 1000 to change out with my 2000?thanks!
-
RE: Custom power meter
@maglo18: is the sketch in the first post your latest version? I would also like to do a very similar build and would like to get the best base
thanks!
-
RE: find parent [solution found]
found it, it was a not stable 3.3V for the radio... added a cap now everything works!
topic can be closed -
RE: find parent [solution found]
this is my sketch:
#include <SPI.h> #include <MySensor.h> #include <BH1750.h> #include <Wire.h> #define NODE_ID 136 unsigned long SLEEP_TIME = 10000; // 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 INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) #define LED_PIN 5 // Arduino pin attached to MOSFET Gate pin #define FADE_DELAY 25 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim) #define PIR_ID 0 // Id of the sensor child #define DIM_ID 1 // Id of the sensor child #define CHILD_ID_LIGHT 2 boolean lasttripped = false; BH1750 lightSensor; MySensor gw; MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL); uint16_t lastlux; MyMessage pirMsg(PIR_ID, V_TRIPPED); // Initialize Dimmer static int currentLevel = 0; // Current dim level... MyMessage dimmerMsg(DIM_ID, V_DIMMER); MyMessage lightMsg(DIM_ID, V_LIGHT); void setup() { gw.begin(incomingMessage, NODE_ID, false); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("PIR & DIM & LUX", "1.0"); // Register all sensors to gateway (they will be created as child devices) gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); gw.present(DIM_ID, S_DIMMER ); gw.request(DIM_ID, V_DIMMER ); pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input // Register all sensors to gw (they will be created as child devices) gw.present(PIR_ID, S_MOTION); lightSensor.begin(); } void loop() { gw.process(); boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; if (lasttripped != tripped) { lasttripped = tripped; Serial.print("PIR "); Serial.println(tripped); gw.send(pirMsg.set(tripped?"1":"0")); // Send tripped value to gw } uint16_t lux = lightSensor.readLightLevel();// Get Lux value if ((round(lux/25))*25 != lastlux) { Serial.print("LUX "); Serial.println(lux); gw.send(msg.set(lux)); lastlux = (round(lux/25))*25; } } void incomingMessage(const MyMessage &message) { if (message.type == V_LIGHT || message.type == V_DIMMER) { // Retrieve the power or dim level from the incoming request message int requestedLevel = atoi( message.data ); // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on] requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 ); // Clip incoming level to valid range of 0 to 100 requestedLevel = requestedLevel > 100 ? 100 : requestedLevel; requestedLevel = requestedLevel < 0 ? 0 : requestedLevel; Serial.print( "Changing level to " ); Serial.print( requestedLevel ); Serial.print( ", from " ); Serial.println( currentLevel ); fadeToLevel( requestedLevel ); // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value... gw.send(lightMsg.set(currentLevel > 0 ? 1 : 0)); // hek comment: Is this really nessesary? gw.send( dimmerMsg.set(currentLevel) ); } } /*** * This method provides a graceful fade up/down effect */ void fadeToLevel( int toLevel ) { int delta = ( toLevel - currentLevel ) < 0 ? -1 : 1; while ( currentLevel != toLevel ) { currentLevel += delta; analogWrite( LED_PIN, (int)(currentLevel / 100. * 255) ); delay( FADE_DELAY ); } }
-
RE: find parent [solution found]
just tried cleared the sensors eeprom, did not show any difference.
As the "find parent" is the only line in the serial consol, do you think it can be related to the gateway? -
find parent [solution found]
Hi all,
i just built a motion, lux and dimmer sensor. The sketch is working perfeclty on a UNO+breadboard but does not seem to work on a pro mini+hardwired, i check the wiring already twice...
The error i get in serial consol is:" find parent"
what could be the trigger for this?
thanks -
RE: radio init fail on sensor, RF24 init OK
that was tip out of my post
Did not help with the "radio init fail"
Any other area to look at? -
RE: radio init fail on sensor, RF24 init OK
the "check wires" error shows when the radio is not wired up correctly. Are you certain that everything is wired up correctly?
But i also have the same "radio init fail" in a relay sensor which worked befor flawless.
I just tried this tip:
http://forum.mysensors.org/topic/728/radio-setup-give-check-wires/30
out of this thread:
http://forum.mysensors.org/topic/1728/uno-ethernet-shield-radio-init-fail-solved
This did not do change anything. Did you already try this? -
RE: Ethernet Gateway hangs up
sorry for digging up this older thread but I do have a very similar problem:
Ijust build a Ethernet gateway with the W5100 module and the gateway starts then works for a while and will freeze after generating a reading like this:0;0;3;0;9;read: 103-103-0 s=2,c=1,t=38,pt=7,l=5:17806714000000.000000
103 is a temperature sensor which works totally fine on a serial gateway.
I can not reproduce this error but it happens within minutes of a fresh start.I still can ping the gateway, the power source is a PC USB port (for now) the radio has no Capacitor on 3,3V
any clue where to start debugging (I am fairly new to arduino/MySensors)
thanks
-
RE: noob question Humidity sketch
thanks!
is the reason for this saving of battery live? -> less sending? -
noob question Humidity sketch
Hi,
is it correct, that the standard humidity sketch is only sending new values when there is a change?
In my case, as the temp and humidity is constant, there can be hours without new reading ( Iam using DHT11)
It would be great to get a short feedback if this is "how it should be" in the standard configuration?
Does anybody has a sketch where every time all the data is send?
thanks