Sensors do not add

Moving my last update from the gateway thread to its own…

Finally got the gateway communicating with the Vera…so I began assembling sensors.

I cannot get any of them to register to the gateway…and not sure how to even monitor them and see if they are doing anything at all. I’m using Hek’s default sensor sketches. I’ve tried the motion sensor sketch, light sensor, distance sensor, etc.

Watching the sensor with the serial monitor shows zero information.

If I upload a normal sketch written for the same devices and pin config, they work like normal. For example, the light sensor I have assembled on the breadboard now. If I use a simple sketch that reports both the analog and digital outputs to the serial monitor it is fine. I turn around and upload Hek’s sketch and nothing. Tried serial monitor on both 9600 and 115200 and zero output at all.

And again, none of the sensors show up to the Gateway when I put it into Inclusion mode.

Not sure the best way to troubleshoot this…still fairly new to this Arduino use and Vera plugins.

Enable debug mode in Config.h before uploading sensor sketch.

What type of radio do you have on your gateway? With antenna?

All hardware is made up of the parts you linked to in the instructions. Gateway is a Nano with the nRF24L01 card.

The sensor unit and the gateway are also sitting less than 4 feet apart…

I’ll enable debug mode in the sketch…how will I get the debug info?

Thanks!
Ross

I’ll show my lack of knowledge here…

How do I enable debug mode? Sigh…I hate not knowing.

In the library under mysensors you should be able to find the file Config.h. open this file in some text editor. And remove // from the define debug line. Reload the sketch to your arduino.

Well…I couldn’t find config.h in the library, and digging more it began to look like I had a mix of the 1.2 and 1.3 beta stuff so I wasn’t sure what might be loaded where…

The plugin in UI5 showed Plugin Version: 1.2+ and Library Version: 1.2+

Since I wasn’t sure if this might be the cause (2 versions of the files…all with the same names and folder structure) I went ahead and deleted them all, cloned the GIT of the current non-beta release linked on Hek’s page and proceeded to re-create the Plugin and Gateway.

Now I’m back to not being able to get the Gateway to load in Vera.

Comparing dmesg before and after plugging in the USB device I get:

JFFS2 notice: (961) check_node_data: wrong data CRC in data node at 0x00920e18: read 0xed81528b, calculated 0x48078a9b. JFFS2 notice: (961) check_node_data: wrong data CRC in data node at 0x0025c000: read 0x5b64d127, calculated 0x5b2f3a15. ramips-wdt: timeout value 60 must be 0 < timeout < 25 +usb 2-1: new full speed USB device using rt3883-ohci and address 2 +usb 2-1: device descriptor read/64, error -62 +usb 2-1: device descriptor read/64, error -62 +usb 2-1: new full speed USB device using rt3883-ohci and address 3 +usb 2-1: device descriptor read/64, error -62 +usb 2-1: device descriptor read/64, error -62 +usb 2-1: new full speed USB device using rt3883-ohci and address 4 +usb 2-1: device not accepting address 4, error -62 +usb 2-1: new full speed USB device using rt3883-ohci and address 5 +usb 2-1: device not accepting address 5, error -62 +hub 2-0:1.0: unable to enumerate USB device on port 1

So back to not being able to configure the serial port info.

What is odd, even using the correct, linked version of the Vera repository it shows Plugin Version: 1.2+ and Library Version is blank.

Sigh…I’m getting ready to just quit.

And it finally shows up in the Vera…so the gateway is back online…guess it wants to keep me just short of quitting…

But Library Version is still blank.

So…I am about to reprogram the light sensor module with config.h setting for debug mode.

Success!

Got the light sensor to include…guess ironing everything out version-wise must have fixed the issues. I guess when I moved libraries into the Arduino folder and the Vera had two different versions.

Seems like I turn everything into a learning experience…with a huge splash of facepalm stupidity on my part.

Thanks for the suggestions all…I’m slowly learning the little tricks and troubleshooting steps.

If you are only using the Arduino IDE for MySensors, then an easy way to avoid versioning issues is to set the sketchbook location under the Arduino preferences to the Arduino directory within the git repo that you pulled.

An alternative is to change your default directory to /Arduino/libraries and run the following rsync command to update the libraries folder in your sketchbook location (default on Mac OS X is ~/Documents/Arduino so change accordingly).

find . -type d -depth 1 -exec rsync -av --delete {}/ ~/Documents/Arduino/libraries/{} \;

Yeah…I keep all the Arduino directories on Dropbox since I may be sitting at one of 4 different computers at any given time…but my laptop is my most often used machine. I’ll setup a scheduled rsync to keep the git repo version synced to the Dropbox folder.

Got the Motion Sensor working and also the Light Sensor

Started playing with the Distance Sensor and it’s blowing up the serial console:

[code]Open ping reading pipe: 255
Tx: fr=255,to=255,la=255,ne=255,ci=255,mt=4,ty=9,cr=184:
Sent successfully
Message available on pipe 7
Message available on pipe 7

(imagine a hundred or so of these here…)

Message available on pipe 7
Message available on pipe 7
No relay nodes was found. Trying again in 10 seconds.[/code]

That just keeps repeating in the console…I haven’t tried to include it to the Vera yet since this does not look like proper output.

Here’s the sketch from the MySensors library…just to verify it is correct:

[code]#include <Sleep_n0m1.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>
#include <Sensor.h>
#include <NewPing.h>

#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 5 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
unsigned long SLEEP_TIME = 5; // Sleep time between reads (in seconds)

Sensor gw;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
Sleep sleep;

int lastDist;
boolean metric = true;

void setup()
{
gw.begin();

// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(0, S_DISTANCE);
metric = gw.isMetricSystem();
}

void loop()
{
gw.powerUp(); // Power up radio
int dist = metric?sonar.ping_cm():sonar.ping_in();

Serial.print(“Ping: “);
Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println(metric?” cm”:" in");

if (dist != lastDist) {
gw.sendVariable(0, V_DISTANCE, dist);
lastDist = dist;
}

// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
delay(1000); //delay to allow serial to fully print before sleep
gw.powerDown();
sleep.pwrDownMode(); //set sleep mode
sleep.sleepDelay(SLEEP_TIME * 1000); //sleep for: sleepTime
}[/code]

And here is a sketch that does work with the same Nano + Sensor:

[code]/*

  • //////////////////////////////////////////////////
  • //making sense of the Parallax PIR sensor’s output
  • //////////////////////////////////////////////////
  • Switches a LED according to the state of the sensors output pin.
  • Determines the beginning and end of continuous motion sequences.
  • @author: Kristian Gohlke / krigoo () gmail () com / http://krx.at
  • @date: 3. September 2006
  • kr1 (cleft) 2006
  • released under a creative commons “Attribution-NonCommercial-ShareAlike 2.0” license
  • Creative Commons — Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 2.0 Deutschland — CC BY-NC-SA 2.0 DE
  • The Parallax PIR Sensor is an easy to use digital infrared motion sensor module.
  • (http://www.parallax.com/detail.asp?product_id=555-28027)
  • The sensor’s output pin goes to HIGH if motion is present.
  • However, even if motion is present it goes to LOW from time to time,
  • which might give the impression no motion is present.
  • This program deals with this issue by ignoring LOW-phases shorter than a given time,
  • assuming continuous motion is present during these phases.

*/

/////////////////////////////
//VARS
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 30;

//the time when the sensor outputs a low impulse
long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 5000;

boolean lockLow = true;
boolean takeLowTime;

int pirPin = 3; //the digital pin connected to the PIR sensor’s output
int ledPin = 7;

/////////////////////////////
//SETUP
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(pirPin, LOW);

//give the sensor some time to calibrate
Serial.print(“calibrating sensor “);
for(int i = 0; i < calibrationTime; i++){
Serial.print(”.”);
delay(1000);
}
Serial.println(" done");
Serial.println(“SENSOR ACTIVE”);
delay(50);
}

////////////////////////////
//LOOP
void loop(){

 if(digitalRead(pirPin) == HIGH){
   digitalWrite(ledPin, LOW);   //the led visualizes the sensors output pin state
   if(lockLow){  
     //makes sure we wait for a transition to LOW before any further output is made:
     lockLow = false;            
     Serial.println("---");
     Serial.print("motion detected at ");
     Serial.print(millis()/1000);
     Serial.println(" sec"); 
     delay(50);
     }         
     takeLowTime = true;
   }

 if(digitalRead(pirPin) == LOW){       
   digitalWrite(ledPin, HIGH);  //the led visualizes the sensors output pin state

   if(takeLowTime){
    lowIn = millis();          //save the time of the transition from high to LOW
    takeLowTime = false;       //make sure this is only done at the start of a LOW phase
    }
   //if the sensor is low for more than the given pause, 
   //we assume that no more motion is going to happen
   if(!lockLow && millis() - lowIn > pause){  
       //makes sure this block of code is only executed again after 
       //a new motion sequence has been detected
       lockLow = true;                        
       Serial.print("motion ended at ");      //output
       Serial.print((millis() - pause)/1000);
       Serial.println(" sec");
       delay(50);
       }
   }

}[/code]

Any ideas?

Ross, triple-check the radio connections to ensure you don’t have any pins mis-wired.

Bingo…had D10 and D9 in D9 and D8…at the angle the board assay is from me I didn’t see the gap.

Thanks dude! Got it included.

So what is the best way to remove the modules from Vera? Delete it from Vera and then do the Clear EEPROM sketch in the MySensors library?

Since some of this is just playing on a breadboard until I decide how I want to build the final units.

I ask that because a node keeps coming back, even though I’ve erased and reprogrammed that Nano and it is currently another module.

Arduino Motion 1:0 was deleted and that Nano reprogrammed and rewired as Arduino Motion 3:0.

No idea what happened to 2:0 either…but every time I delete Arduino Motion 1:0 it comes back. But 3:0 is online and reporting motion and all.

[quote=“rosskinard, post:13, topic:180255”]So what is the best way to remove the modules from Vera? Delete it from Vera and then do the Clear EEPROM sketch in the MySensors library?

Since some of this is just playing on a breadboard until I decide how I want to build the final units.[/quote]

I usually just delete the sensor and the Arduino node from the Vera UI and clear the EEPROM on the sensor.