@TheoL Thank you so much for your efforts! The code works, I need to try to make gesture recognition a bit for stable (will replace module and maybe try different library) as well as reduce number of light levels as you suggested.
Posts made by APL2017
-
RE: 💬 Gesture controlled MySensors, Floor lamp
-
RE: 💬 Gesture controlled MySensors, Floor lamp
@TheoL I ordered just in case couple of simple APDS modules without regulators. When you have a chance, no rush, please take look at the code, thank you.
-
RE: 💬 Gesture controlled MySensors, Floor lamp
@APL2017 One of my issues is resolved - unstable operation of gesture detection. According to this discussion https://forum.arduino.cc/index.php?topic=483921.15 for some APDS-9960 modules (most likely the on that I use - with built-in 3.3V power regulator) it is critical to adjust LED_BOOST parameter in Sparkfuns library. After I set it to 100 as recommended in link above, my gesture detection became more stable. What is your experience with this?
-
RE: 💬 Gesture controlled MySensors, Floor lamp
@TheoL Please see attached stripped version of @pjjarzembowski code. I see that gesture is being detected, attempted to reduce number of light levels to 5. Having trouble with detecting UP and DOWN gestures - not always happening. Trying to understand how dimmer works.
/**************************************************************** Title: MySensors enabled, gesture controlled lamp. This lamp can be turned on/off, and dimmed by gestures. And it can be controlled by any Home Automation system, that can talk with MySensors. Supported gesture: 1. Left to right stroke: turns lamp on 2. Right to left stroke: turns lamp off 3. Down to up stroke: increases brightness (When brightness is already at max, the lamp will blink - duration and blink count can be changed in the sketch) 4. Up to down stroke: decreases brgihtness (When brightness level is at 0 the lamp is off) The gesture sensor used in this Sketch is an APDS-9960 RGB and Gesture Sensor, sold by SparkFun. They can be found on eBay and Aliexpress as well. See Sparkfuns hookup guide for pin lay-out ( https://learn.sparkfun.com/tutorials/apds-9960-rgb-and-gesture-sensor-hookup-guide ) IMPORTANT: The APDS-9960 can only accept 3.3V! Use bi direction level converter when using another Arduino than a Pro Mini 3.3V This Sketch is based upon the GestureTest exampl developped by, Shawn Hymel @ SparkFun Electronics on May 30, 2014. See https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor The lamp itself is a white LED strip, controlled by an N channel MOSFET. Fore more details on the used hardware and libraries (see https://www.openhardware.io/view/50/Gesture-controlled-MySensors-Floor-lamp ) Revision history: 25-1-2021 Version 2.1 Stripped from everything except gesture and light control. 3-07-2017 Version 2 by pjjarzembowski - Changed for tests on Mysensors 2.0 20-03-2016 Version 1.1 by Theo: - set the brightness level to defined BRIGHTNESS_INCREMENT, when lamp is being turned on be a gesture and the current brightness level is 0. This was a little bug in previous version. It sometimes seemed that the APDS didn't work, but in some cases I had to increase brightness after I turned the lamp on. - cleaned up the code a bit 19-03-2016 Version 1.0 by Theo - Developed and test with MySensors release 1.5.4 ****************************************************************/ // Import libraries used by the Sketch. // added some of my radio definitions (must be before #includes) #define MY_DEBUG #define MY_RADIO_RF24 #define MY_NODE_ID 27 //#include <SPI.h> #include <MySensors.h> #include <Wire.h> #include <SparkFun_APDS9960.h> // Constants declaration(s) #define APDS9960_INT 2 // Needs to be an interrupt pin. We should be able to use the Arduino's pin 3 as well. #define LED_PIN 3 // The led PWM pin, that drives the LED strip. This is the pin thats attached to the mosfet. #define MAXDIMLEVELS 6 // The maximum number of dim levels. Domoticz supports 0-100 (we'll transalate thim in an array) #define BRIGHTNESS_INCREMENT 20 // Dimmer increment for gesture(s). Play with this value yourself. The amount of gesture controlled // dim levels is MAXDIMLEVELS / BRIGHTNESS_INCREMENT having 8 to 5 levels feels more natural to me. #define MAX_LEVEL_REACHED_DELAY 150 // Short blinking delay when increasing the dimmer while the dimmer is already at max // Had some troubles in the past with tha acurateness of the gw.wait on pro mini's. But that'll probably // not be noticeable with this short delay. Delay is in milliseconds #define MAX_LEVEL_REACHED_SIGNAL_COUNT 2 // The amount of blinks, when the max dim level already has been reached. It's just a way to let the user know // that the lamp can not be more brighter than the current brightness #define CHILD_ID_LIGHT 1 // The child id of the Node. Only one Node on this sensor though. See MySensors documentation #define LIGHT_OFF 0 // Constant indicating the lamp on state #define LIGHT_ON 1 // Constant indicationg light off state // Global Variables SparkFun_APDS9960 apds = SparkFun_APDS9960(); // Initialize a SparkFun_APDS9960 object. This does all the magic incl. i2c communication with the sensor. int isr_flag = 0; // interrupt flag, triggered when a gesture has been dectected. Used to detect gesture detection in the interrupt handler // the actual handling is done in the main loop. This allows is the keep the interrupt handler is lightweight is possible // which is a good practice. Otherwise you'll get some behaviour you don't expect. int LastLightState=LIGHT_OFF; // The current lamp state. Wel'll turn it off for first time useage. The Sketch will query your Home Automation System for // the last value when it's being reboot. int LastDimValue=MAXDIMLEVELS; // last known dim value (Only initial value. Value is retrieved from your HA system) int dimlevels[ MAXDIMLEVELS ] = // PWM values used for translating home automation dimmer levels. This gives smoother transations { 0, 50, 100, 150, 200, 255}; MyMessage lightMsg(CHILD_ID_LIGHT, V_LIGHT); MyMessage dimmerMsg(CHILD_ID_LIGHT, V_DIMMER); // interrupt handler. Is being triggered by the gesture sensor whenever a gesture has been detected. We've setup this up in the setup. void interruptRoutine() { isr_flag = 1; } void presentation() { sendSketchInfo("Led with Gesture", "2.0"); present(CHILD_ID_LIGHT, S_DIMMER); } void setup() { pinMode( LED_PIN, OUTPUT ); // APDS Initialization code pinMode(APDS9960_INT, INPUT); // Set interrupt pin as input. @@Note: this should be handled my the library. But it isn't attachInterrupt(0, interruptRoutine, FALLING); // Initialize interrupt service routine. Basicly it'll call our interrupt routine if ( apds.init() ) { // Initialize APDS-9960 (configure I2C and initial values) // @@NOTE: original value is two. But it looks like the modern gesture sensor more sensitive. 1 does it for me apds.setGestureGain( 2 ); } if ( apds.enableGestureSensor(true) ) { // Start running the APDS-9960 gesture sensor engine. Sensor support more functions than gesture detection only. analogWrite( LED_PIN, 0 ); // Turn the lamp off. // Request current dimvalue. The current value is being handled in the incomming method. request( CHILD_ID_LIGHT, V_PERCENTAGE ); // Request current dimvalue from HA. The current value is being handled in the incomming method. // Request current lamp state. The current value is being handled in the incomming method. request( CHILD_ID_LIGHT, V_STATUS ); // Request current lamp state from HA. The current value is being handled in the incomming method. } } // Main loop. Does two things. Handle gestures if detected by the interrupt routine. And give the MySensors lib the oppurtunity to handle incomming messages. void loop() { if( isr_flag == 1 ) { detachInterrupt(0); handleGesture(); isr_flag = 0; attachInterrupt(0, interruptRoutine, FALLING); } } // Determine gesture and handle accordingly.We'll ignore FAR and NEAR gestures. Didn't feel natural to me anyway. void handleGesture() { if ( apds.isGestureAvailable() ) { // Check if there's a gesture available. Which should be, because the interrupt handler told us so. switch ( apds.readGesture() ) { // Get the gesture type. case DIR_UP: // Handle up stroke (Brightness increasing) Serial.println ("DIR_UP"); if ( LastDimValue + BRIGHTNESS_INCREMENT > ( MAXDIMLEVELS - 1 ) ) { for ( int i = 0; i < MAX_LEVEL_REACHED_SIGNAL_COUNT; i++ ) { analogWrite( LED_PIN, dimlevels[ 0 ] ); wait( MAX_LEVEL_REACHED_DELAY ); analogWrite( LED_PIN, dimlevels[ MAXDIMLEVELS - 1 ] ); wait(MAX_LEVEL_REACHED_DELAY ); } LastDimValue = ( MAXDIMLEVELS - 1 ); } else { LastDimValue += BRIGHTNESS_INCREMENT; } LastLightState = LIGHT_ON; SetCurrentState2Hardware(); break; case DIR_DOWN: // Handle down stroke (Brightness decreasing) Serial.println ("DIR_DOWN"); if ( LastDimValue - BRIGHTNESS_INCREMENT <= 0 ) { LastDimValue = 0; } else { LastDimValue -= BRIGHTNESS_INCREMENT; } if ( LastDimValue == 0 ) { LastLightState = LIGHT_OFF; } else { LastLightState = LIGHT_ON; } SetCurrentState2Hardware(); break; case DIR_LEFT: // Handle left stroke. Turn lamp off Serial.println ("DIR_LEFT"); LastLightState = LIGHT_OFF; SetCurrentState2Hardware(); break; case DIR_RIGHT: // Handle right stroke. Turn lamp on Serial.println ("DIR_RIGHT"); LastLightState = LIGHT_ON; if ( LastDimValue == 0 ) { // @@Version 1.1 addition Slight modification. When the dimValue was 0, the light stayed off when turned on. LastDimValue = BRIGHTNESS_INCREMENT; // Just used the first Gesture dimming stage (2 times would be better for my taste though. Might change that in the future) } SetCurrentState2Hardware(); break; } } } /** * Handler for message send by the MySensor gateway. */ void receive(const MyMessage &message) { //if ( message.type == V_LIGHT ) { // Gateway reports a new Light state if ( message.type == V_STATUS ) { // Gateway reports a new Light state int lstate= atoi( message.data ); if ( ( lstate < 0 ) || ( lstate > 1 ) ) { return; } LastLightState=lstate; if ( ( LastLightState == LIGHT_ON ) &&( LastDimValue == 0 ) ) { //In the case that the Light State = On, but the dimmer value is zero, then something (probably the controller) did something wrong, //for the Dim value to 100% LastDimValue = 100; } //When receiving a V_LIGHT command we switch the light between OFF and the last received dimmer value //This means if you previously set the lights dimmer value to 50%, and turn the light ON //it will do so at 50% } //else if (message.type == V_PERCENTAGE) { // Gateway reports new dimmer level. We'l adjust it to the new value else if (message.type == V_DIMMER) { // Gateway reports new dimmer level. We'l adjust it to the new value int dimvalue= atoi( message.data ); if ( ( dimvalue < 0 ) || ( dimvalue > 100 ) ) { return; } if ( dimvalue == 0 ) { LastLightState = LIGHT_OFF; } else { LastLightState = LIGHT_ON; LastDimValue = dimvalue; } } SetCurrentState2Hardware(); //Here we'll set the actual light state/level } void SetCurrentState2Hardware() { // Send current values to the PWM controlled MOSFET if (LastLightState==LIGHT_OFF) { analogWrite( LED_PIN, dimlevels[0] ); Serial.print ("DIMELEVELS "); Serial.println (dimlevels[LastDimValue] ); } else { analogWrite( LED_PIN, dimlevels[ LastDimValue - 1 ] ); } SendCurrentState2Controller(); //Send current state to the controller } void SendCurrentState2Controller() // Report new values to the Gateway { if ((LastLightState==LIGHT_OFF)||(LastDimValue==0)) { send(dimmerMsg.set(0)); } else { send(dimmerMsg.set(LastDimValue)); } }
-
RE: 💬 Gesture controlled MySensors, Floor lamp
@TheoL Agree, my project is for kitchen for under the cabinets lights, so I can't imagine my wife adjusting brightness, may be 2-3 levels would be sufficient. Current slider dimmer is set to one position...
-
RE: 💬 Gesture controlled MySensors, Floor lamp
@TheoL Sorry, I though that I deleted multiple posts. I understand about stripping the code, this is what I am trying to do, just got a bit confused between parts of the code responsible for measuring and controlling the light (similar variable names, etc.). Thanks for the idea about reducing number of light levels, totally make sense. My personal take on this project would be having gesture controller physically separate from the light controller with mySensors node to node communication between. May I ask you why you don't use this setup anymore? FYI, I use ioBroker as controller and happy with it (most of the time)
-
RE: 💬 Building a Serial Gateway
@mfalkvidd Thank you, I will donate 168P to some other Arduino enthusiast.
-
RE: 💬 Gesture controlled MySensors, Floor lamp
Hello. Can somebody publish working code just for gesture and LED dimming with latest mySensors library? Thank you.
-
RE: 💬 Building a Serial Gateway
Sketch uses 13634 bytes (95%) of program storage space. Maximum is 14336 bytes. Global variables use 731 bytes (71%) of dynamic memory, leaving 293 bytes for local variables. Maximum is 1024 bytes.
I noticed parsing error in my controller log and switched to 328P. I bought 168P by mistake and wondering how I can use it. Does simple mySensors node require less ROM/RAM than gateway?
-
RE: 💬 Building a Serial Gateway
Can serial gateway be build on Atmel 168 chip instead of 328 in terms of memory? It compiles fine, but leaves little extra memory for variables.
-
RE: 💬 Parking Sensor
Thank you for great project. I built it, it works fine except occasionally it starts flashing red when was left along for couple of hours without any objects moving in front of the sensor. It happens at least couple times per day. Sensor replacement did not fix it. The only way to get out of it is to restart Arduino. Any idea what is going on?
Found fix for this problem at https://forum.mysensors.org/topic/1734/parking-sensor/57 by Dan.S. Please update the library.
-
DIY LED lens
For my battery powered water leak nodes I wanted to add a clear lens to be able to see communication LED status on Arduino Pro Mini while maintaining reasonable water protection. The quick no cost solution was:
- Drill small hole in node enclosure against LED location
- Cover it from outside with masking tape
- Put some amount of hot glue from the inside to cover the hole, wait till glue hardens, remove masking tape. And voila!!
-
Waking up on timer AND interrupt
For battery operated node is it possible to set node to wake up on timer to send battery status AND wake up on DIN3 interrupt to report digital input status? I see example how to wake up on timer for battery status reporting and other example on waking up on digital input interrupt, but not sure how to combine them together.
-
RE: 💬 Battery Powered Sensors
Does enabled myDebug and some Serial.print statements (with serial port disconnected) affect power consumption of the node?
-
RE: Node to Node communication
@BearWithBeard Thank you! I am really embarrassed with my, let's say, luck of understanding. But you made it clear again. Everything works as required!
-
RE: Node to Node communication
@BearWithBeard Thanks to you my water leak detection system works fine. My next challenge is to let node receive Boolean (RESET_SOFT) from GW - directly from controller logic. I am looking at example RelayActuator and trying to make sense of it, see below simplified version of it. The idea is to get message from GW (node 0) and received it as sensor ID 20 on the receiving node. Is this close to what is should be?
#define MY_DEBUG #define MY_RADIO_RF24 #include <MySensors.h> bool RESET_SOFT; void setup() { } void presentation() { sendSketchInfo("Basement Water", "1.0"); present(20, S_BINARY); } void loop() { } void receive(const MyMessage &message) { if (message.getType()==S_BINARY && message.getSensor()==0) {RESET_SOFT=message.getBool(); } }
-
Functional Guide
I think that it will be useful to put together some kind of functional guide pointing the user in which mySensors example the specific function or feature is implemented, for example: sending floating number, digital input debouncing algorithm, battery saving, node to node communication, GW to node communication, minimizing traffic between node and GW, etc.
-
RE: Node to Node communication
@BearWithBeard THANK YOU! It works fine. The only change I had to make is to replace msg with message in all commands. Couple of questions, if you don't mind:
- Is it critical to have void receive after void loop?
- How receiving node distinguishes between same sensor ID coming from different nodes? Or, I need to assign unique sensor ID throughout complete sensors pool?
It will be useful to include working example into mySensors library.
-
RE: Node to Node communication
@BearWithBeard Sorry, I am still confused. Is it possible to publish a complete example of sending Boolean from one node to another to be used in control logic? Thank you.
-
RE: Node to Node communication
@BearWithBeard Thank you. I do not define my nodes ID, they are being assigned automatically (by controller? gateway?), but I do see nodes ID in my controller configuration. Is this a problem?
-
RE: Node to Node communication
@boum Thank you! So, in my receiving function i should have the following, where 10 is sending node?
void receive(const MyMessage &message) {if (message.type==V_TRIPPED) {if (message.sensor==10) { Serial.print(message.sensor); Serial.print("\n"); Serial.print(", New status: "); Serial.print(message.getBool()); LEAK_RECEIVED=message.getBool(); } } }
-
RE: Node to Node communication
@boum said in Node to Node communication:
MyMessage msg_LEAK_to_15(10,V_TRIPPED);
Thank you, here is what I have on receiving node (simplified). I am not getting the leak flag on receiving node. Is this correct? Elimination of sleeping did not help. I've noticed that there is no receiving commands within the LOOP, but it was advised as not required in previously referenced discussion.
#define MY_DEBUG #define MY_RADIO_RF24 #include <MySensors.h> #define LEAK_RECEIVED_CHILD_ID 10 bool LEAK_RECEIVED; uint32_t SLEEP_TIME = 1000; // Sleep time between reads (in milliseconds) MyMessage msg_LEAK_RECEIVED(LEAK_RECEIVED_CHILD_ID,V_TRIPPED); void setup() { } void presentation() { sendSketchInfo("Basement Water", "1.0"); present(LEAK_RECEIVED_CHILD_ID, S_DOOR); } void receive(const MyMessage &message) {if (message.type==V_TRIPPED) {if (message.sensor==15) { Serial.print(message.sensor); Serial.print("\n"); Serial.print(", New status: "); Serial.print(message.getBool()); LEAK_RECEIVED=message.getBool(); } } } void loop() { sleep(SLEEP_TIME); }
-
RE: Node to Node communication
@BearWithBeard I took my typical water leak detection node, which sends leak flag to controller and added request to also send leak flag to node 15, sensor 10 (the last set below) , but immediately this node stopped reporting leak to controller. What am I doing wrong? Do I need to define dedicated MyMessage statement for sharing data with node?
#define MY_DEBUG #define MY_RADIO_RF24 #include <MySensors.h> #define LEAK_1_CHILD_ID 1 #define LEAK_1_PIN 5 bool LEAK_1; bool last_LEAK_1; MyMessage msg_LEAK_1(LEAK_1_CHILD_ID,V_TRIPPED); void setup() { pinMode(LEAK_1_PIN,INPUT_PULLUP); } void presentation() { sendSketchInfo("Water Leak", "1.0"); present(LEAK_1_CHILD_ID, S_DOOR); } void loop() { LEAK_1 =digitalRead(LEAK_1_PIN); if (LEAK_1 != last_LEAK_1) { send(msg_LEAK_1.set(LEAK_1)); send(msg_LEAK_1.setDestination(15).setSensor(10).set(LEAK_1)); last_LEAK_1 = LEAK_1; } }
-
RE: Node to Node communication
@BearWithBeard Thank you! Will go through information you provided and try to implement shortly
-
Node to Node communication
Hello, I see few discussions about establishing Node to Node communication, probably the most complete is here:
https://forum.mysensors.org/topic/8941/mysensors-get-temperature-value-from-another-node-through-the-gateway/27
Unfortunately, there are still few things which are not clear to meFrom the link above, here is what I see as working example:
Send sketch is:
send(pcMsg.setDestination(1).setSensor(101).set(temperature,1));
and receive sketch is
void receive(const MyMessage &message) {
if (message.type==V_VAR1) {
if (message.sensor==101) {
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print("\n");
Serial.print(", New status: ");
Serial.println(message.getFloat());
}
}
I am missing here explanation of some text used in the example above, for example, in send sketch what is pcMsg, why Destination has 1 as argument, why setSensor has 101 as argument, what is temperature and 1 arguments in the last set?
send(pcMsg.setDestination(1).setSensor(101).set(temperature,1)); -
RE: 💬 Distance Sensor
@evb No I did not. I was thinking about filtering out obviously wrong readings, but never implemented it since it was not high priority project. I am glad that there is some activity going on related to this issue.
-
RE: Power ON node
@tbowmo Thank you, supercap idea works fine, my first experience with supercaps.
-
WDT or internal heartbeat
Does mySensors code have native WDT which would allow controller to see if node is ON or OFF?
-
RE: Power ON node
@tbowmo Spamming network is a valid concern. I will look into super cap solution and send message or two when power goes ON then message when power goes OFF.
Also, I need to investigate how to let nodes communicate with each other without controller getting involved. Thank you. -
RE: Power ON node
@zboblamont Thanks again, amazing how human mind works, I came up with WDT solution while responding to your post...
-
RE: Power ON node
@zboblamont Thank you, but I am trying to avoid powering node from dedicated power supply. I would like it to be powered by power source that goes on and off. One solution is to program it as WDT, generating pulses when it is powered up, so controller can detect condition when node is off.
-
Power ON node
I am looking for a simple solution to use one node as indicator that power is applied, so controller can detect status of this node. When power is OFF node is dead, when power is ON node is operational and its status is available to controller. Will appreciate any help.
-
RE: 💬 Building a wired RS485 sensor network
Hello, I would like to better understand the concept here. It sounds like we still need a gateway connected to a controller (serial, Ethernet, WiFi, etc.) but the interface between gateway and multiple nodes is over wired RS485 serial interface. Please confirm. Thank you for your great efforts!
-
RE: 💬 Distance Sensor
@zboblamont Thanks, you are proposing to filter out wrong reading, I am trying to understand why system periodically sends out 0.
-
RE: 💬 Distance Sensor
zboblamont . Thank you, I understand all of this except I really don't see in sketch testing of two consecutive results in X attempts. I see that node will wake up and update the distance if new data is different than old data, but, anyway, question was about something different. Why, single sensor node based on this example periodically generates 0 distance? Are there different models of these sensors, so NewPing library needs to be altered?
-
RE: 💬 Distance Sensor
Actually, even when I use this example without any changes with single sensor, quite often node sends out 0cm. Real distance in my office from table top to ceiling is about 160cm. Maximum distance set to 300.
-
RE: 💬 Distance Sensor
Are there any tricks to configure one node with two distance sensors? I tried, it generally works, shows two distances, but periodically shows first or second distance =0
-
RE: 💬 Temperature Sensor
Looking at code example it seems to be sufficient to set bool metric = false to get readings in Fahrenheit, but node still returns readings in C. Any idea why?
-
RE: Node ESP8266 with NFR24 and WiFi disabled
Here is my sketch intended to detect water leak from a sensor connected to D4:
#define MY_DEBUG
#define MY_BAUD_RATE 9600
#define MY_RADIO_RF24
#include <ESP8266WiFi.h>
#include <MySensors.h>
#define LEAK_1_CHILD_ID 1
#define LEAK_1_PIN D4
bool LEAK_1;
bool last_LEAK_1;
MyMessage msg_LEAK_1(LEAK_1_CHILD_ID,V_TRIPPED);void setup()
{
pinMode(LEAK_1_PIN,INPUT);
digitalWrite(LEAK_1_PIN,HIGH);
WiFi.mode( WIFI_OFF );
WiFi.forceSleepBegin();
}void presentation()
{
present(LEAK_1_CHILD_ID, S_DOOR);
}void loop()
{
LEAK_1 =digitalRead(LEAK_1_PIN);
if (LEAK_1 != last_LEAK_1)
{
send(msg_LEAK_1.set(LEAK_1));
last_LEAK_1 = LEAK_1;
}
}Here is what I am reading over serial interface. After seems to be successful initial communication, ESP gets stack on not getting ACK from the radio. Any idea why?
189 MCO:BGN:INIT NODE,CP=RNNNE---,REL=255,VER=2.3.1
377 TSM:INIT
391 TSF:WUR:MS=0
414 TSM:INIT:TSP OK
435 TSF:SID:OK,ID=102
458 TSM:FPAR
508 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
1262 TSF:MSG:READ,0-0-102,s=255,c=3,t=8,pt=1,l=1,sg=0:0
1320 TSF:MSG:FPAR OK,ID=0,D=1
2585 TSM:FPAR:OK
2602 TSM:ID
2615 TSM:ID:OK
2631 TSM:UPL
2649 TSF:MSG:SEND,102-102-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
2724 TSF:MSG:READ,0-0-102,s=255,c=3,t=25,pt=1,l=1,sg=0:1
2784 TSF:MSG:PONG RECV,HP=1
2813 TSM:UPL:OK
2830 TSM:READY:ID=102,PAR=0,DIS=1
2867 TSF:MSG:SEND,102-102-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
2946 TSF:MSG:READ,0-0-102,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
3013 TSF:MSG:SEND,102-102-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
3094 TSF:MSG:SEND,102-102-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
5170 TSF:MSG:SEND,102-102-0-0,s=1,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
5241 MCO:REG:REQ
5263 TSF:MSG:SEND,102-102-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
5339 TSF:MSG:READ,0-0-102,s=255,c=3,t=27,pt=1,l=1,sg=0:1
5398 MCO:PIM:NODE REG=1
5424 MCO:BGN:STP
force slp enable,type: 2
fpm open,type:2 0
5443 MCO:BGN:INIT OK,TSP=1
7768 !TSF:MSG:SEND,102-102-0-0,s=1,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=NACK:1 -
Node ESP8266 with NFR24 and WiFi disabled
I happen to have few ESP8266 and NRF24+ laying around and would like to use ESP instead of Arduino to blend with the rest of mySensors network. I prefer WiFi disabled on ESP. Does anybody have a sample code to start with?
-
RE: 💬 MySensors Library - v2.x
@mfalkvidd One of the efficient ways to do it (if doable) is to replace site examples with links to main MySensors git repo. I noticed that some examples on site are incorporated into the pages, some are done as links already. I realize thou that examples in git repo could be different. The goal of git repo examples, as I see it, is to show technology capabilities covering majority of typical applications, while on website you may also publish some real exotic examples, such as sky stars, or whole house fan.
Please don't get me wrong, I love MySensors and very pleased with technology, documentation and support. This is just in my nature to attempt to clarify and optimize whatever I can. My colleagues at work hate me for this...
-
RE: 💬 MySensors Library - v2.x
@mfalkvidd I am referring to the following code example on Build page of MySensors site: Distance, Door/Window/Button, GPS Sensor, IR Sender/Receiver, Parking Sensor, Servo, Temperature, UV
-
RE: 💬 MySensors Library - v2.x
Thank you MFalkvidd. I was wondering why many examples in your library have SPI.h library called while have no SPI communication required, it sounds like it can be removed from them as well..
Also, do I need to place CHILD MySensors defines before including MySensors.h? It is not how many examples are done, please clarify. -
RE: 💬 MySensors Library - v2.x
Please confirm that to have node configured as repeater only, it is sufficient to have the following code written:
#define MY_DEBUG
#define MY_RADIO_NRF24
#include <SPI.h>
#include <MySensors.h>
#define MY_REPEATER_FEATUREvoid setup()
{
}
void presentation() {
}
void loop()
{
} -
RE: 💬 Easy/Newbie PCB for MySensors
sundberg84 Don't bother, I went through the hassle, downloaded Eagle and created readable PDF
-
RE: 💬 Easy/Newbie PCB for MySensors
Sorry to bother you again (3rd time), still waiting for readable PDF of Rev. 9 schematic and board layout. Thank you
-
RE: 💬 Easy/Newbie PCB for MySensors
What software was used to develop this board? My latest KiCad does not read schematic from Rev. 5 ZIP file. All I need is a simple PDF...
-
RE: 💬 Easy/Newbie PCB for MySensors
I am also looking for documentation for Rev. 9 that I purchased. The link with revisions that was provided: https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors#tabs-revisions
lists revisions 1-7, but not 9. All I need is readable schematic and PCB layout in PDF. Thanks. -
RE: AC -DC transformer sourcing
@monte Well, yes there are few designs with very low power consumption, I believe less than 2-3mA, designed & FM certified to eliminate shock in case of failures. I guesstimated 2-3mA because typical GFCI trip point is 4-5mA, so GFCI allows ground current leak of less that 4mA. That is why it is important to specify expected power consumption.
-
RE: AC -DC transformer sourcing
@jeremushka Before helping you out here are a few thoughts to share:
- I have to disappoint you, AC-DC transformer does not exist. By definition, transformer is an AC to AC device, so most likely you are looking for a power supply (PS) to convert 220VAC to 5VDC.
- How do you expect to power PS without neutral wire? Use ground wire instead? in USA and most likely in other countries, ground wire must not be load carrying wire. There are few designs with very low power consumption, I believe less than 2-3mA, designed & FM certified to eliminate shock in case of failures. I guesstimated 2-3mA because typical GFCI trip point is 4-5mA, so GFCI allows ground current leak of less that 4mA.
If you don't care about 2) at risk of electrical shock, lawsuit, etc. advise:
- What is expected power consumption
- What form factor required (PCB module, panel module, wall plug, etc.)
-
RE: 💬 Easy/Newbie PCB for MySensors
Just schematic and board layout, exactly what you placed, if possible in a bit better resolution. Thanks a lot!
-
RE: 💬 Easy/Newbie PCB for MySensors
Can you please share design of version 9 of the Easy PCB NRF24 edition. I bought 10 pieces a while ago but just decided to use couple. Thank you.
-
RE: 💬 Relay
I would like to clarify operation of the sketch, where more than 1 sensors input are used along with more than 1 relay actuator. in one node
- Does node need unique child ID for each sensor input AND relay output?
- If that is the case how child ID is assigned to relay actuators in the above examples?
-
RE: 💬 Gas Sensor
Lack of support makes you think, so I figured out the "hidden" calculations in the sketch above and proposing the code modification to allow users to port the code to a different gas sensor using data taken directly from the sensor chart. Here are modified fragments of the code showing only CO curve for MQ2 sensor:
float CO2Curve[4] = {0.8,200,2.2,10};
//two end points are taken from the curve with two coordinates for each point
//in form of{Y1, X1,Y2, X2) where X is PPM axis, Y is Rs/Ro axis from the sensor chart for specifc gas
//then equation X=(Y-b)/m is used,
//where m is slope of the curve, b is Y axis intersept point
float Slope = (log(pcurve(1)-log(pcurve(0))/(log(pcurve(3)-log(pcurve(2));
float Y_Intercept=log(pcurve(1)-Slope*log(pcurve(3);int MQGetPercentage(float rs_ro_ratio, float *pcurve)
{
{ return (pow(10,((log(rs_ro_ratio)-Y_Intercept)/Slope))); }
} -
RE: 💬 Gas Sensor
Sure, the curve is there. I am trying to make sense out of two points curve that is used in sketch for MQ2 sensor, CO gas. "point1: (lg200, 0.72), point2: (lg10000, 0.15)" while I see on the curve from datasheet (lg200, 5.2) and (lg10000, 1.3). That is why I am asking for help, sorry for not making it clear.
-
RE: 💬 Gas Sensor
Please advise what would be curve for MQ135 sensor for CO2. Thank you.
-
RE: openHAB 2.0 binding
@TimO said in openHAB 2.0 binding:
dmesg
Thank you! When I entered serial ports as /dev/ttyUSB0, as reported by dmesg, the mySensors serial gateway binding came alive in OpenHAB. Initially, I got confused by instructions how to setup gateway in https://github.com/tobof/openhab2-addons/wiki/Configuration where I spotted serialPort="/dev/pts/2"
-
RE: openHAB 2.0 binding
Hello forum! I am very new with mySensors and OpenHAB (you've heard it before). I have OpenHab 2.1 running on Raspberri Pi2. I configured Z-wave binding, things and a few items, and it works fine. Now I am trying to bind OpenHab to a serial gateway build with Arduino Nano. The default example sketch is loaded to Arduino. The latest v2.1.0 mySensors .jar is placed in \openhab2-addons. I configured serial port as /dev/pts/2 but Gateway is offline. I tried to reboot Raspberry, Arduino but mySensors gateway is always offline, while Z-wave is online and operational. What am I doing wrong?