Navigation

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

    Topics created by tonbor

    • tonbor

      Connection ESP32 and NRF24
      Troubleshooting • • tonbor  

      7
      0
      Votes
      7
      Posts
      71
      Views

      tonbor

      @mfalkvidd That did it, thanks
    • tonbor

      Solar radiation type
      Domoticz • • tonbor  

      1
      0
      Votes
      1
      Posts
      127
      Views

      No one has replied

    • tonbor

      GUVA-S12SD UV sensor sketch
      My Project • • tonbor  

      2
      0
      Votes
      2
      Posts
      972
      Views

      tonbor

      /** DESCRIPTION Sensor: CJMCU-GUVA-S12SD/CJMCU-S12D Sensor Arduino SIG -> A0 GND -> GND VCC -> 5V or 3.3v part created by Henrik Ekblad henrik.ekblad@mysensors.org Copyright (C) 2013-2015 Sensnology AB Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors part Original link : CSDN 博客链接. part by Tonbor august 2018 */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_NRF5_ESB //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #include <MySensors.h> #define UV_SENSOR_ANALOG_PIN 0 #define CHILD_ID_UV 0 uint32_t SLEEP_TIME = 30*1000; // Sleep time between reads (in milliseconds) MyMessage uvMsg(CHILD_ID_UV, V_UV); int lastSend =0; int sensorValue; long sum = 0; int vout = 0; int uv = 0; int lastUV = -1; void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("UV Sensor", "1.3"); // Register all sensors to gateway (they will be created as child devices) present(CHILD_ID_UV, S_UV); } void setup() { Serial.begin(115000); } void loop() { uint32_t currentTime = millis(); sensorValue = 0; sum = 0; for (int i = 0 ; i < 1024 ; i++ ) { sensorValue = analogRead(UV_SENSOR_ANALOG_PIN); sum = sensorValue + sum; delay(2); } vout = sum >> 10; vout = vout * 4980.0 / 1024; Serial.print("The Photocurrent value:"); Serial.print(vout); Serial.println("mV"); if (vout < 50) { uv = 0; } else if (vout < 227) { uv = 1; } else if (vout < 318) { uv = 2; } else if (vout < 408) { uv = 3; } else if (vout < 503) { uv = 4; } else if (vout < 606) { uv = 5; } else if (vout < 696) { uv = 6; } else if (vout < 795) { uv = 7; } else if (vout < 881) { uv = 8; } else if (vout < 976) { uv = 9; } else if (vout < 1079) { uv = 10; } else { uv = 11; } //Send value to gateway if changed, or at least every 5 minutes if ((uv != lastUV)||(currentTime-lastSend >= 5UL*60UL*1000UL)) { lastSend=currentTime; send(uvMsg.set(uv)); lastUV = uv; } sleep(SLEEP_TIME); }
    • tonbor

      GUVA-S12SD UV sensor sketch made, hope to get response and help others
      Development • • tonbor  

      2
      0
      Votes
      2
      Posts
      689
      Views

      berkseo

      @tonbor And where is the sketch? It's a simple analog sensor. Examples: http://arduinolearning.com/code/arduino-guva-s12sd-uv-sensor.php or: https://github.com/ma2shita/GUVA-S12SD