I built a trip wire for the post box that I'm connecting. It's however based on a mercury tilt sensor so I'm really not sure whether I think it's a great idea putting it to use (at least not with a sturdy case...). However, I can share my code:
#define DIGITAL_INPUT_SENSOR 2 // 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)
MyMessage msgTripped(CHILD_ID_TRIPPED, V_TRIPPED);
void setup()
{
gw.sendSketchInfo("Postal", "1.0");
gw.present(CHILD_ID_TRIPPED, S_MOTION);
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
}
void loop()
{
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == LOW;
if(tripped) {
gw.send(msgTripped.set("1")); // Send tripped value to gw
}
gw.sleep(INTERRUPT,FALLING, SLEEP_TIME);
}
@jocke4u I run 2 RF gateways and it's not a problem. When you 'migrate' a node to a new gateway make sure to run the mysensors clear eeprom sketch first to get rid of the old routing table or you might have issues.
following this thread loosely.
I have the following sensors and they seem to be accurate to some degree:
http://www.aliexpress.com/item/DFRobot-Capacitive-Analog-Soil-Moisture-Sensor-3-3-5-5V-Corrosion-Resistant-with-Gravity-3-Pin/32574020064.html?spm=2114.01010208.3.2.P99ddH&ws_ab_test=searchweb201556_0,searchweb201602_1_10037_10017_507_10033_10032_10040,searchweb201603_1&btsid=8d3b5e46-a069-441a-a1f7-491ae7e317e1
and they are much easier to work with Arduino compared to Watermark stuff. Anyone agree?
@epierre said:
Both need protection (internal or external) from excessive discharge (or excessive charge, and short circuits etc)
That is where our new library to check battery level goes in, we could dream to have an internal mysensor security check of a LiPo battery ! they do so in 'copters
I may pass on that. I'm not used to software glitches having quite so much potential impact, and I don't need to save every gram. But to each their own!