Navigation

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

    Topics created by GRB

    • GRB

      UI5 to UI7 update
      Vera • • GRB  

      16
      0
      Votes
      16
      Posts
      5161
      Views

      blacey

      @GRB Super! Let us know if the final verification with an actual sensor works and feel free to ask questions if it doesn't.
    • GRB

      Soil Moisture analog input question
      Troubleshooting • soil moisture • • GRB  

      3
      0
      Votes
      3
      Posts
      2798
      Views

      GRB

      Here is the sketch if anyone can help out. #include <SPI.h> #include <MySensor.h> #define CHILD_ID_LIGHT 0 #define LIGHT_SENSOR_ANALOG_PIN 1 #define NODE_ID 9 int BATTERY_SENSE_PIN = A2; // select the input pin for the battery sense point unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) MySensor gw; MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); int lastLightLevel; int oldBatteryPcnt = 0; void setup() { // use the 1.1 V internal reference //analogReference(INTERNAL); gw.begin(NULL, NODE_ID, false); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Soil_Moist_Sensor_grb", "1.15"); // Register all sensors to gateway (they will be created as child devices) gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } void loop() { int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; Serial.println(lightLevel); if (lightLevel != lastLightLevel) { gw.send(msg.set(lightLevel)); lastLightLevel = lightLevel; } // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); Serial.println(sensorValue); // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 - changed without ref volt float batteryV = sensorValue * 0.00305734; int batteryPcnt = sensorValue / 10; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep gw.sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } gw.sleep(SLEEP_TIME); }
    • GRB

      Device driver
      Troubleshooting • device driver • • GRB  

      2
      1
      Votes
      2
      Posts
      1022
      Views

      GRB

      Well I solved the problem... I had a power supply tied to the board and should not have while communicating via USB! https://ketturi.kapsi.fi/2014/04/how-to-fix-moody-arduino-nano/