Navigation

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

    Best posts made by 1kohm

    • RE: Wall mounted 'mood light' v2

      FIXED!
      Happy 🙂

      Issue was so obvious...
      I was supplying Neopixel LED's with 5V trought Arduino pro mini... so when node was starting everything was ok till sending light pattern to node. When data was send, LED's took to much Watts, and radio was crashing...
      So now I just powered LED's with 5V parerall to the node ( LED's are supplied before node).

      Now, I need to understand your code, how "buttonPin" is working and how to set patterns. It seems that the code is acting wired sometimes, but I think that's due to my less knowledge about it now.

      Thanks for guidlines!

      posted in My Project
      1kohm
      1kohm
    • RE: Gateway update?

      topic to close.
      I've neede to allow new hardware to add in Domoticz.

      posted in General Discussion
      1kohm
      1kohm
    • RE: Dust sensor and wrong values

      OK,
      I was tired...
      I've figure it out and have sketch running 🙂
      Beta version:

      // Enable debug prints
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      
      #define CHILD_ID_DUST 0
      #define MIN_VOLTAGE              600 // mv - the lower threshold voltage range for the lack of dust
      #define VREF                    1100 // mv - reference voltage of the comparator
      #define DUST_SENSOR_DIGITAL_PIN    3 // pin number ILED
      #define DUST_SENSOR_ANALOG_PIN     1 // pin number AOUT
      #define MAX_ITERS                 10 // liczba pomiarow do sredniej
      
      
      unsigned long SLEEP_TIME = 1000;    // Sleep time between reads (in milliseconds)
      
      int SAMPLING_TIME = 280;
      int ADC_VALUE; // read value A1
      int ITER; // value read
      float VOLTAGE; // voltage value
      float DUST; // result
      float AVG_DUST; // average result
      
      MyMessage dustMsg(CHILD_ID_DUST, V_LEVEL);
      
      void setup(){
        analogReference(INTERNAL);
        Serial.begin(115200);
        pinMode(DUST_SENSOR_DIGITAL_PIN,OUTPUT);
        digitalWrite(DUST_SENSOR_DIGITAL_PIN, LOW);
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Dust Sensor", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_DUST, S_DUST);  
      }
      
      float computeDust()
      {
        // Flash IR, wait 280ms, read ADC voltage
        digitalWrite(DUST_SENSOR_DIGITAL_PIN, HIGH);
        delayMicroseconds(SAMPLING_TIME);
        ADC_VALUE = analogRead(DUST_SENSOR_ANALOG_PIN);
        digitalWrite(DUST_SENSOR_DIGITAL_PIN, LOW);
       
        // Calculate to mV. whole multiplied by 11, because in the module
        // applied voltage divider 1k/10k
        VOLTAGE = (VREF / 1024.0) * ADC_VALUE * 11;
       
        // Calculate pollution if the measured voltage over prog
       
        if (VOLTAGE > MIN_VOLTAGE)
        {
          return (VOLTAGE - MIN_VOLTAGE) * 0.2;
        }
       
        return 0;
      }
       
      void loop()
      {
         AVG_DUST = 0;
         ITER = 0;
       
         while (ITER < MAX_ITERS)
         {
           DUST = computeDust();
           // For medium liczmy only correct measurements
           if (DUST > 0)
           {
             AVG_DUST += DUST;
             ITER++;
             delay(50);
           }     
         }
         
        AVG_DUST /= MAX_ITERS;
         
         Serial.print("D = ");
         Serial.print(AVG_DUST);
         Serial.println("ug/m3");    
      
        send(dustMsg.set((int)ceil(AVG_DUST)));
        
        sleep(SLEEP_TIME);
      
      }
      

      Values are send, but I want to send to gateway values exact as computed by sketch, wih 4 ditits - D = 60.79ug/m3

      But sketch is sending only 2 digit - ok:61

      D = 60.79ug/m3
      TSP:MSG:SEND 8-8-0-0 s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=ok:61
      D = 59.61ug/m3
      TSP:MSG:SEND 8-8-0-0 s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=ok:60
      

      I guess that I should change something here:

        send(dustMsg.set((int)ceil(AVG_DUST)));
      

      But not know what to change.
      Help here.

      posted in Bug Reports
      1kohm
      1kohm