Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. jpaulwhite
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    jpaulwhite

    @jpaulwhite

    0
    Reputation
    5
    Posts
    580
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    jpaulwhite Follow

    Best posts made by jpaulwhite

    This user hasn't posted anything yet.

    Latest posts made by jpaulwhite

    • Hello World. I'll keep it simply this time lol

      Hello,

      I am trying to send "Hello World" from my wireless sensor to my wireless gateway. If I am using the stock SerialGateway function on my gateway, would the below code send Hello World to it? If not can someone point me in the right direction?

      I took the presentation function out since I am not sending this to my Vera.

      #include <Sensor.h>
      #include <SPI.h>
      #include <EEPROM.h>
      #include <RF24.h>

      #define ID 1
      #define OPEN 1
      #define CLOSE 0
      Sensor gw;

      void setup()
      {
      gw.begin();

      }

      void loop()
      {
      Serial.println("Hello World!");
      delay(10000); // Wait 10 seconds
      }

      posted in My Project
      jpaulwhite
      jpaulwhite
    • Trying to build a wireless DHT22 sensor that logs data to PLX-DAQ

      I have a DHT22 Temperature/Humidity sensor. I can connect it wirelessly (And give it power), and read Temp and Humidity off it if I load some code from MySensors.org and use their version of the DHT library.

      If I flash my sensor with some code from Adafruit and use their DHT library, I can connect the sensor via usb, run PLC-DAQ on the computer it is connected to, and the Temp and Humidity values are passed into an Excel spreadheet.

      I am looking for some code to allow my sensor to connect wirelessly, then pass the data to PLC-DAQ.

      I got the code below to compile by copying and pasting the relevant parts of the Setup and Void functions (Again, terminology may be off) from the Mysensors.org and Adafruit code, then renaming all instances of the Adafruit DHT to DHTP. If you look in the code below, all the lines that end with // are the ones I edited. Except the ones where it's obviously a comment from the developer.

      I also had to rename one of the classes (Adafruit version of DHT.h, may be using the wrong terminology) to DHTP.h and DHTP.cpp.

      I have included the code I reworked below. Here is a link to the working Adafruit code http://108.51.175.78:8069/shelli-rae/sensor_plx_daq.ino , and here is a link to the working Mysensors.org code http://108.51.175.78:8069/shelli-rae/sensor_humidity_vera.ino

      If I flash my Arduino with either one and use their version of the DHT.h library either respective function works fine.

      Thank you for any help/suggestions.

      #include <Sleep_n0m1.h>
      #include <SPI.h>
      #include <EEPROM.h>
      #include <RF24.h>
      #include <Sensor.h>
      #include <DHT.h>
      #include <DHTP.h>//

      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      unsigned long SLEEP_TIME = 30; // Sleep time between reads (in seconds)

      #define DHTPIN 3//
      #define DHTTYPE DHT22//

      Sensor gw;
      DHT dht;
      Sleep sleep;
      float lastTemp;
      float lastHum;
      boolean metric = true;

      DHTP dhtp(DHTPIN, DHTTYPE);//

      void setup()
      {
      gw.begin();
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);

      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Humidity", "1.0");

      // Register all sensors to gw (they will be created as child devices)
      gw.sendSensorPresentation(CHILD_ID_HUM, S_HUM);
      gw.sendSensorPresentation(CHILD_ID_TEMP, S_TEMP);

      metric = gw.isMetricSystem();{

      Serial.begin(38400);//
      Serial.println("LABEL,Time,Temperature (F), Humidity (%)"); //

      dhtp.begin();//
      }
      }

      void loop()
      {
      delay(dht.getMinimumSamplingPeriod());

      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
      Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
      lastTemp = temperature;
      if (!metric) {
      temperature = dht.toFahrenheit(temperature);
      }
      gw.sendVariable(CHILD_ID_TEMP, V_TEMP, temperature, 1);
      Serial.print("T: ");
      Serial.println(temperature);
      }

      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
      Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
      lastHum = humidity;
      gw.sendVariable(CHILD_ID_HUM, V_HUM, humidity, 1);
      Serial.print("H: ");
      Serial.println(humidity);
      }

      {//
      // Reading temperature or humidity takes about 250 milliseconds!
      // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
      float h = dhtp.readHumidity();//
      float t = dhtp.readTemperature();//
      t = ((t*1.8)+32);//Converted from Celsius to Farenheit
      delay(60000);//

      // check if returns are valid, if they are NaN (not a number) then something went wrong!
      if (isnan(t) || isnan(h)) {//
      Serial.println("Failed to read from DHT");//
      } else {
      Serial.print("DATA,TIME,"); Serial.print(t); Serial.print(","); Serial.println(h);
      }//
      }//

      // 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
      }

      posted in My Project
      jpaulwhite
      jpaulwhite
    • RE: Humidity sensor DHT22. No temperature showing and error when clicking Poll Now button in Veralite UI5 for Temp and Humidity

      Success!!!!

      Thank you all for the assistance. I also posted in the Vera forums. I had SEVERAL problems. Most of which I should readily recognize and know how to correct, if they happen again. I'll go in the order of the ones I corrected first.

      #1 Configuration problem????

      Over and over I was told, it was a wiring issue. But initially, the gateway AND both devices showed up ( See screenshot http://108.51.175.78:8069/shelli-rae/pictures/misc/Capture1.PNG ) But there were no Temperature or Humidity numbers showing up. Another thing you can see is the Last Updated Time. That's a very important field, because if it is not updating you know something is going on (At a glance)

      So initially, even though signs pointed to a wiring issue the fact that both sensors showed up led me to believe it was something else. So I checked all the wiring connections on the sensor device and everything had continuity. I then checked all the wiring connections on my gateway device and they were fine. I was PISSED! lol. I then noticed that the status window at the top of Vera had some Lua error and the Gateway device had a red status bar going across the bottom. I knew that meant something was going on with the Gateway device but I had already spent a lot of time troubleshooting so I ignored it for two weeks.

      I came back from vacation yesterday and decide to give it another go. I notice the error at the top of the Vera status said it couldn't communicate with the I/O port. I go to Apps|Develop Apps|Serial Port Configuration and notice it is not detecting the USB device.

      What in tarnation! I don't know if it's been like this the whole time, but I unplugged and replugged in the Gateway device, reload the Vera, and now the Vera is detecting the USB device. I then pull up the Gateway device (In my case it is named MySensors Plugin) and configure it per the instructions 8 data, 1 stop bit, and No parity. 115200 baud. I hit Reload and Voila! I error messages about Serial I/O are gone, the Lua Startup (What does THAT error mean in general?) error is gone, and the red status bar across the bottom of my Gateway device is gone.

      #2 I did not have the correct DHT library loaded, and I did not have the MySensors library (Sensor.h) loaded properly.

      I turn to the Humidity sensor device. Since it showed up initially, and the wiring was fine I am thinking it should work. However, I can't get the libraries loaded to get the sample code to compile. After checking the libraries and making sure I had the correct DHT library loaded (There's one library that works with plx-daq, and a DIFFERENT one that works with the MySensors code) the sample sketch would not compile. I then turned on verbose logging in my IDE (Arduino 1.0.5) and noticed that it was not finding Sensor.h I then found that was in the MySensors folder which was in my libraries folder. I then created a folder named Sensor.h in my libraries folder and put Sensor.h and Sensor.cpp in there. I compiled and now it said the version and ummmm config.h was missing. So I copied those into the folder as well and now it compiled. I then uploaded it immediately and Reloaded my Vera (Now I know you don't have to do that. As soon as you upload a sketch to your sensor device it normally connects to the Gateway device and Vera and begins working) and now I have numbers reporting for the Humidity and Temperature.

      posted in Troubleshooting
      jpaulwhite
      jpaulwhite
    • RE: Humidity sensor DHT22. No temperature showing and error when clicking Poll Now button in Veralite UI5 for Temp and Humidity

      @korttoma Thanks! So how do I get the temperature to read?

      I must be missing something here. Arrgghhhh lol.

      posted in Troubleshooting
      jpaulwhite
      jpaulwhite
    • Humidity sensor DHT22. No temperature showing and error when clicking Poll Now button in Veralite UI5 for Temp and Humidity

      Error says:

      Command Failed: No Implementation

      Here's some screenshots:

      http://108.51.175.78:8069/shelli-rae/pictures/misc/Capture1.PNG
      108.51.175.78:8069/shelli-rae/pictures/misc/Capture2.JPG
      108.51.175.78:8069/shelli-rae/pictures/misc/Capture3.JPG

      posted in Troubleshooting
      jpaulwhite
      jpaulwhite