Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
TaliskerT

Talisker

@Talisker
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Pro Mini Adjustable
    TaliskerT Talisker

    @Terence-Faul

    Yes, I have two of them. They are working very well, on 5V as on 3.3V. These are my favorite pro mini clones. :)

    Hardware

  • HTU21D Humidity/Temperature Sensor
    TaliskerT Talisker

    Hi,

    I've tried the new humidity/temperature sensor HTU21D from sparkfun and really like this little breakout board.
    It is a much better replacement for the slow und sometimes unreliable DHTxx sensors. Because of the I2C interface wiring and programming is very easy.

    Here is my adapted version of the MySensors humidity sketch (you need the HTU21D library from sparkfun):

    #include <SPI.h>                                                                                                                                                            
    #include <MySensor.h>                                                                                                                                                       
    #include <Wire.h>                                                                                                                                                           
    #include <HTU21D.h>                                                                                                                                                         
    
    #define CHILD_ID_HUM 0                                                                                                                                                      
    #define CHILD_ID_TEMP 1                                                                                                                                                     
    unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)                                                                                             
                                                                                                                                                                            
    MySensor gw;                                                                                                                                                                
                                                                                                                                                                            
    //Create an instance of the object                                                                                                                                          
    HTU21D myHumidity;                                                                                                                                                          
                                                                                                                                                                            
    boolean metric = true;                                                                                                                                                      
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);                                                                                                                                      
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);                                                                                                                                   
                                                                                                                                                                            
    void setup()                                                                                                                                                                
    {                                                                                                                                                                           
      gw.begin();                                                                                                                                                               
                                                                                                                                                                            
      // Send the Sketch Version Information to the Gateway                                                                                                                     
      gw.sendSketchInfo("Humidity", "2.0");                                                                                                                                     
                                                                                                                                                                            
      // Register all sensors to gw (they will be created as child devices)                                                                                                     
      gw.present(CHILD_ID_HUM, S_HUM);                                                                                                                                          
      gw.present(CHILD_ID_TEMP, S_TEMP);                                                                                                                                        
    
      metric = gw.getConfig().isMetric;                                                                                                                                         
      myHumidity.begin();                                                                                                                                                       
    }                                                                                                                                                                           
    void loop()                                                                                                                                                                 
    {                                                                                                                                                                           
      float temperature = myHumidity.readTemperature();                                                                                                                         
      if (!metric) {                                                                                                                                                            
          temperature = (temperature * 1.8) + 32.0;                                                                                                                             
      }                                                                                                                                                                         
      gw.send(msgTemp.set(temperature, 1));                                                                                                                                     
    
      float humidity = myHumidity.readHumidity();                                                                                                                               
      gw.send(msgHum.set(humidity, 1));                                                                                                                                         
                                                                                                                                                                            
      gw.sleep(SLEEP_TIME); //sleep a bit                                                                                                                                       
    }
    

    cheers

    Hardware
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular