Originally posted by hleidecker
View Post
Thanks Henrik for some of your suggestions.
I have spent some more time on trying to get things working. At first I had some success. I was able to set up several more motion sensors using arduino nanos that I couldn't use earlier. I used the 'ClearEepromConfig' sketch (which I did not know about). There is also a line in the motion sensor sketch (and seems to be in all sketches) that defines the child id #. I started changing that number (and am now using AUTO). My new motion sensors all started to get added and they also were part of the same node (whereas some other sensors that I had connected through the same gateway were appearing as being connected to different nodes). Attaching a picture of what my device page in HS3 looks like. Out of curiosity, did they show up as different nodes because I was not changing the define child id or could there have been another reason?
More importantly, I have not been able to get the moisture sensor to work. I began using a more basic sketch (see below). The data seems to be flowing properly when I look at the serial monitor (see below as well). I can't get the device to add to HS3 though. I've tried multiple arduino nanos that have all had the cleareeprom sketch and a reset sketch. Does it have anything to do with the fact that I am now using an analogue connection for the data? This sketch uses S_moisture which you had said is not supported, so I changed it to S_HUM but that did not help. I've switched out the radios as well. Any thoughts on what else I might try?
------------------
#include <SPI.h>
#include <MySensor.h>
#define CHILD_ID AUTO // Id of the sensor child, CHANGE!
int moistureSensor = 0; // ANALOG Pin for Soil sensor, usally A0
MySensor gw;
MyMessage msg(CHILD_ID, V_TRIPPED);
int lastSoilValue = -1;
void setup()
{
gw.begin(NULL, 0);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Soil Moisture Sensor in percentage", "1.0");
// Register all sensors to gw (they will be created as child devices)
gw.present(CHILD_ID, S_HUM);
}
void loop()
{
int soilValue = map(analogRead(moistureSensor), 0, 1024, 100, 0);
if (soilValue != lastSoilValue) {
Serial.println(soilValue);
gw.send(msg.set(soilValue));
lastSoilValue = soilValue;
}
gw.sleep(3000);
}
----------------
0;0;3;0;9;gateway started, id=0, parent=0, distance=0
0;0;3;0;9;send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=25,sg=0,st=ok:Soil Mois
0;0;3;0;9;send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
0;0;3;0;9;send: 0-0-0-0 s=255,c=0,t=7,pt=0,l=5,sg=0,st=ok:1.5.4
35
0;0;3;0;9;send: 0-0-0-0 s=255,c=1,t=16,pt=2,l=2,sg=0,st=fail:35
Comment