Navigation

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

    Artix

    @Artix

    11
    Reputation
    4
    Posts
    329
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Artix Follow

    Best posts made by Artix

    • Async sensor Libraries (SI7021, APDS-9306)

      Hello,

      Following the presentation of my project gdomotics : https://forum.mysensors.org/topic/9009/gdomotics

      I write this post to share my work on 2 new libraries :

      AsyncSI7021 : https://github.com/gmarti/AsyncSI7021
      AsyncAPDS9306 : https://github.com/gmarti/AsyncAPDS9306

      During my test of the existing libraries, I was really frustrated the way they were written, especially a lot of unnecessary waiting when measuring with multiple sensors.

      With those new libraries, you can start a measurement, continue any other task you want and get back the result when it is ready.

      Old way of measuring sensors:

      def syncMeasurement() : int{
        Wire.write(requestMeasurementRegister)
        delay(25)
        return Wire.read(resultRegister)
      }
      
      def syncMeasurement() : int{
        Wire.write(requestMeasurementRegister)
        While(Wire.read(mesurementStatusRegister) != terminated){ }
        return Wire.read(resultRegister)
      }
      

      Async measuring of sensors:

      def startMeasurement() : void{
        Wire.write(requestMeasurementRegister)
      }
      
      def isMeasurementReady() : bool{
        return  Wire.read(mesurementStatusRegister) == terminated
      }
      
      def getMeasurement() : int{
        return Wire.read(resultRegister)
      }
      

      With this you can write this:

      AsyncSI7021 si7021;
      AsyncAPDS9306 apds9306;
      
      
      while(!apds9306.begin()){} //Wait for sensor to be ready
      apds9306.startLuminosityMeasurement();
      
      while(!si7021.begin()){} //Wait for sensor to be ready (SI7021 has 18-80ms of powerup time)
      si7021.startHumidityMeasurement();
      
      bool isSi7021Measuring = true;
      bool isApds9306Measuring = true;
      
      do{
        if(isSi7021Measuring && si7021.isMeasurementReady()) {
          send(si7021.getTemperature());
          send(si7021.getHumidityFromTemperatureMeasurement());
          isSi7021Measuring = false;  
        }
        if(isApds9306Measuring && apds9306.isMeasurementReady()) {
          send(apds9306.getLuminosity());
          isApds9306Measuring = false;      
        }
      
         //Another task here !!
      
      while(isSi7021Measuring  || isApds9306Measuring);
      
      

      With this code, you don't know if si7021 or apds9306 will finish measuring first.

      And you don't care! Because the total measurement time will more or less be max(SI7021time, apds9306time, otherSensorTime, otherTaskTime)

      SI7021 max measurement time (12bit RH 14bit Temp) : 12 + 10.8 = 22.8ms
      APDS9306 max measurement time : from 25ms to 400ms

      With async code, you will spare more or less 22.8ms in your sketch with this 2 sensors

      With more sensors, you will spare a lot more! (async battery measurement, async everything !)

      Spare time == less battery use == happy me

      I really hope it will be useful for the community.

      Thanks

      Artix

      PS : This is the first release of those libraries, they have been tested only by me for the moment. Things can go wrong and some functionality (mostly interrupts)
      does not exist.

      posted in Development
      Artix
      Artix
    • gdomotics

      Hello,

      Today I present MyProject 😂 gdomotics

      It's a simple homemade board with those specifications:

      Size : 29.8 x 44.8 mm

      Content :

      • Atmega328p
      • RFM69
      • SI7021
      • APDS-9306
      • Sensor power on/off
      • Led
      • Optional : Flash
      • Optional : Atsha204a
      • Optional : Advanced low power management
      • Optional : External Battery measurement (voltage divider)
      • Optional : External pull-up for door switch
      • Some pin to add external sensors

      Started with a big board and removed everything on it but what I needed the most.
      I'm thinking about removing atsha, advanced power, external battery measurement because I will probably not use them. (atsha indoor is pretty much useless)
      Remove Flash too, if OTA is developed for RFM69 (I may try to help with this development)

      Actually connected to a raspberry 1 with MySensorsGateway + Mosquitto (Will probably move to WEMO or something else, raspberry not working well for the moment)
      My controller is Home Assistant

      I will not release any board/sketch before I feel the project is mature enough but...

      Today, I release my new libraries for SI7021 and APDS-9306 full rewritten from scratch with async programming in mind.
      https://forum.mysensors.org/topic/9010/async-sensor-libraries-si7021-apds-9306

      And the photos :
      0_1518392794891_20180212_001513 (2).jpg
      1_1518392794891_20180212_001459 (1).jpg

      posted in My Project
      Artix
      Artix
    • RE: gdomotics

      @hek pictures and library post link added

      posted in My Project
      Artix
      Artix

    Latest posts made by Artix

    • RE: gdomotics

      @hek pictures and library post link added

      posted in My Project
      Artix
      Artix
    • Async sensor Libraries (SI7021, APDS-9306)

      Hello,

      Following the presentation of my project gdomotics : https://forum.mysensors.org/topic/9009/gdomotics

      I write this post to share my work on 2 new libraries :

      AsyncSI7021 : https://github.com/gmarti/AsyncSI7021
      AsyncAPDS9306 : https://github.com/gmarti/AsyncAPDS9306

      During my test of the existing libraries, I was really frustrated the way they were written, especially a lot of unnecessary waiting when measuring with multiple sensors.

      With those new libraries, you can start a measurement, continue any other task you want and get back the result when it is ready.

      Old way of measuring sensors:

      def syncMeasurement() : int{
        Wire.write(requestMeasurementRegister)
        delay(25)
        return Wire.read(resultRegister)
      }
      
      def syncMeasurement() : int{
        Wire.write(requestMeasurementRegister)
        While(Wire.read(mesurementStatusRegister) != terminated){ }
        return Wire.read(resultRegister)
      }
      

      Async measuring of sensors:

      def startMeasurement() : void{
        Wire.write(requestMeasurementRegister)
      }
      
      def isMeasurementReady() : bool{
        return  Wire.read(mesurementStatusRegister) == terminated
      }
      
      def getMeasurement() : int{
        return Wire.read(resultRegister)
      }
      

      With this you can write this:

      AsyncSI7021 si7021;
      AsyncAPDS9306 apds9306;
      
      
      while(!apds9306.begin()){} //Wait for sensor to be ready
      apds9306.startLuminosityMeasurement();
      
      while(!si7021.begin()){} //Wait for sensor to be ready (SI7021 has 18-80ms of powerup time)
      si7021.startHumidityMeasurement();
      
      bool isSi7021Measuring = true;
      bool isApds9306Measuring = true;
      
      do{
        if(isSi7021Measuring && si7021.isMeasurementReady()) {
          send(si7021.getTemperature());
          send(si7021.getHumidityFromTemperatureMeasurement());
          isSi7021Measuring = false;  
        }
        if(isApds9306Measuring && apds9306.isMeasurementReady()) {
          send(apds9306.getLuminosity());
          isApds9306Measuring = false;      
        }
      
         //Another task here !!
      
      while(isSi7021Measuring  || isApds9306Measuring);
      
      

      With this code, you don't know if si7021 or apds9306 will finish measuring first.

      And you don't care! Because the total measurement time will more or less be max(SI7021time, apds9306time, otherSensorTime, otherTaskTime)

      SI7021 max measurement time (12bit RH 14bit Temp) : 12 + 10.8 = 22.8ms
      APDS9306 max measurement time : from 25ms to 400ms

      With async code, you will spare more or less 22.8ms in your sketch with this 2 sensors

      With more sensors, you will spare a lot more! (async battery measurement, async everything !)

      Spare time == less battery use == happy me

      I really hope it will be useful for the community.

      Thanks

      Artix

      PS : This is the first release of those libraries, they have been tested only by me for the moment. Things can go wrong and some functionality (mostly interrupts)
      does not exist.

      posted in Development
      Artix
      Artix
    • gdomotics

      Hello,

      Today I present MyProject 😂 gdomotics

      It's a simple homemade board with those specifications:

      Size : 29.8 x 44.8 mm

      Content :

      • Atmega328p
      • RFM69
      • SI7021
      • APDS-9306
      • Sensor power on/off
      • Led
      • Optional : Flash
      • Optional : Atsha204a
      • Optional : Advanced low power management
      • Optional : External Battery measurement (voltage divider)
      • Optional : External pull-up for door switch
      • Some pin to add external sensors

      Started with a big board and removed everything on it but what I needed the most.
      I'm thinking about removing atsha, advanced power, external battery measurement because I will probably not use them. (atsha indoor is pretty much useless)
      Remove Flash too, if OTA is developed for RFM69 (I may try to help with this development)

      Actually connected to a raspberry 1 with MySensorsGateway + Mosquitto (Will probably move to WEMO or something else, raspberry not working well for the moment)
      My controller is Home Assistant

      I will not release any board/sketch before I feel the project is mature enough but...

      Today, I release my new libraries for SI7021 and APDS-9306 full rewritten from scratch with async programming in mind.
      https://forum.mysensors.org/topic/9010/async-sensor-libraries-si7021-apds-9306

      And the photos :
      0_1518392794891_20180212_001513 (2).jpg
      1_1518392794891_20180212_001459 (1).jpg

      posted in My Project
      Artix
      Artix
    • Very low power with alkaline battery

      Hello,

      I'm building my own pcb for mysensors and i'm doing a lot of tests since 1 year now.

      My parts are all selected to work between 1.9 and 3.3V :

      • Atmega328p (100na interrupt powerdown, 4.3uA watchdog powerdown)
      • rfm69 (100na powerdown)
      • SI7021 (powered by pin)
      • OPT3001 (powered by pin)
        etc...

      To power my pcb i have done two tests :

      Something like https://hallard.me/category/ulpnode/ where i'm able to get less than 1uA (between 400nA and 1uA) of current when sleeping using only 1xAAA battery
      Used/tested/documented by @scalz too.

      Directly powered by 2xAAA battery where i get ~4.3uA of current when sleeping (due to 328p watchdog)

      Then i checked about alkaline discharge rate... that's < 0.3%/month (wikipedia) I take an optimistic value of 0.15%

      For a 1200mAh AAA battery that's : (0.15/100)1200 / (3024) = 0.0025mAh per battery.

      For the first test it's 2.5uA self-discharge for <1uA consumption
      For the second test that's 5uA self-discharge for 4.3uA consumption

      Now i'm asking myself if it's worth trying to go under battery self-discharge rate for sleeping node ?

      posted in Hardware
      Artix
      Artix