Browse Source

Removed lux-sensor, has been moved to a ESP8266

Thomas Chef 8 years ago
parent
commit
6e7aa3f6be
3 changed files with 8 additions and 114 deletions
  1. 8 0
      README.md
  2. 0 82
      luxsensor.ino
  3. 0 32
      repeater.ino

+ 8 - 0
README.md

@@ -0,0 +1,8 @@
+#This is the Arduino 433MHz Repeater-project.
+
+It is placed in the garage and listens to one Nexa-code and sends out with the code +1.
+
+Previously it contained a Lux-sensor, but that has been moved to a ESP8266-board instead.
+
+Board: Arduino Nano (Ali-copy)
+CPU:   ATmega328

+ 0 - 82
luxsensor.ino

@@ -1,82 +0,0 @@
-
-/* TSL25911 Digital Light Sensor */
-/* Dynamic Range: 600M:1 */
-/* Maximum Lux: 88K */
-
-#include <Wire.h>
-#include <Adafruit_Sensor.h>
-#include "Adafruit_TSL2591.h"
-
-Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591); // pass in a number for the sensor identifier (for your use later)
-
-
-/**************************************************************************/
-/*
-    Configures the gain and integration time for the TSL2561
-*/
-/**************************************************************************/
-void configureSensor(void)
-{
-  // You can change the gain on the fly, to adapt to brighter/dimmer light situations
-  tsl.setGain(TSL2591_GAIN_LOW);    // 1x gain (bright light)
-  //tsl.setGain(TSL2591_GAIN_MED);      // 25x gain
-  //tsl.setGain(TSL2591_GAIN_HIGH);   // 428x gain
-  
-  // Changing the integration time gives you a longer time over which to sense light
-  // longer timelines are slower, but are good in very low light situtations!
-  tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS);  // shortest integration time (bright light)
-  //tsl.setTiming(TSL2591_INTEGRATIONTIME_200MS);
-  //tsl.setTiming(TSL2591_INTEGRATIONTIME_300MS);
-  //tsl.setTiming(TSL2591_INTEGRATIONTIME_400MS);
-  //tsl.setTiming(TSL2591_INTEGRATIONTIME_500MS);
-  //tsl.setTiming(TSL2591_INTEGRATIONTIME_600MS);  // longest integration time (dim light)
-}
-
-/**************************************************************************/
-/*
-    Program entry point for the Arduino sketch
-*/
-/**************************************************************************/
-void initLuxSensor(void) 
-{   
-  if (tsl.begin()) 
-  {
-  } 
-  else 
-  {
-    //Serial.println("XNo sensor found ... check your wiring?");
-    while (1);
-  }
-  /* Configure the sensor */
-  configureSensor();
-}
-
-/**************************************************************************/
-/*
-    Show how to read IR and Full Spectrum at once and convert to lux
-*/
-/**************************************************************************/
-uint32_t readLuxSensor(void)
-{
-  // More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
-  // That way you can do whatever math and comparisons you want!
-  uint32_t lum = tsl.getFullLuminosity();
-  uint16_t ir, full;
-  ir = lum >> 16;
-  full = lum & 0xFFFF;
-  //Serial.print("[ "); Serial.print(millis()); Serial.print(" ms ] ");
-  //Serial.print("IR: "); Serial.print(ir);  Serial.print("  ");
-  //Serial.print("Full: "); Serial.print(full); Serial.print("  ");
-  //Serial.print("Visible: "); Serial.print(full - ir); Serial.print("  ");
-  
-  uint32_t lux = tsl.calculateLux(full, ir);
-  
-  if ( (lux > 4294966000.0) ||
-       (lux <-4294966000.0) )
-  {
-    return 0;
-  }
-  else {
-    return lux;
-  }
-}

+ 0 - 32
repeater.ino

@@ -37,8 +37,6 @@ void setup() {
   // ------------------ INIT THE TRANCEIVER -------------------------  
   
   Serial.begin(9600);  // USB Serial
-  
-  initLuxSensor();    // Init the lux sensor on i2c
 
   rcvInitQueue();
   
@@ -141,15 +139,12 @@ void loop() {
   
   static unsigned long txCode = 0;
   
-  static unsigned long previous_lux_time = 20000; // Start 1st measure after 20 sec
-  
   static unsigned long previous_now = 0; // Get the current time
   unsigned long now = millis(); // Get the current time
   
   // Check millis() for wrapping (after 49 days)
   if( previous_now > now ) {
     last_rx_time = 0; // Reset last rx time    
-    previous_lux_time = 0;
   }
   
   // Display version information 10 sec after startup
@@ -158,33 +153,6 @@ void loop() {
     firstRun = false;
   } */
   
-  if( now > previous_lux_time  ) {
-      // Yes ! It's time to measure lux value
-      uint64_t luxm=0;
-      for(int i=1; i<=10; i++ ) {
-        int32_t lux_temp = readLuxSensor();
-        luxm += lux_temp;
-      }
-      luxm /= 10;      
-
-      uint32_t lux = (uint32_t) luxm;
-      
-      if( lux > 0xFFFF ) lux=0xFFFF;
-      if( lux < 0 ) lux=0;
-      
-      Serial.println(lux);
-      
-      // Set next measure to 3 minutes +/- 20 sec
-      previous_lux_time = now + 120000 + (random(20)*1000);
-      
-      txDataReady = 1;
-                   
-      txCode  = 0x6AD50000;
-      txCode |= (lux & 0x0000FFFF);
-      
-      //blinkTheLED();
-  }
-  
   if( rcvDeQueue(&width) ) {
     
       // ********** NEXA ***********