BH1750 lux sensor: reading 54612 lux???

Moderator: leecollings

ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

I just received my BH1750 lux sensor today and just built the sketch: http://www.mysensors.org/build/light (LightLuxSensor Example).

It is received fine by Domoticz, but it only displays 54612 lux the whole time??? I doublechecked my wires and it seems ok to me....
Image
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

i think you send the raw values.... could you log with the arduino ide and see what it sends?

if you know the max. value (maybe 65365), you could scale this to 0-100%

(100/65365)*value
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

The serial monitor also displays 54612 lux and it never changes. The 54612 value seems to mean = no communication with I2C device.
Tried with a different Arduino Nano, tried different pins (A2, A3), D4, D5. I think the sensor is just broken :roll:


http://playground.arduino.cc/Main/I2cScanner
Scanning...
No I2C devices found
The BH1750 board is a GY-302, the Arduino Nano's that i tried are 'betemcu bte14-01' (clones).
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

then the skecth should be modified so it will not use these values....

but you just got it in.... i had the same experience with a rfid reader, turned out with the right library it was working

please check outside mysensors, and search for a native arduino sketch to be sure
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

I also tried the BH1750 example sketch:

Code: Select all

/*

Example of BH1750 library usage.

This example initalises the BH1750 object using the default
high resolution mode and then makes a light level reading every second.

Connection:
 VCC-5v
 GND-GND
 SCL-SCL(analog pin 5)
 SDA-SDA(analog pin 4)
 ADD-NC or GND

*/

#include <Wire.h>
#include <BH1750.h>


BH1750 lightMeter;


void setup(){
  Serial.begin(9600);
  lightMeter.begin();
  Serial.println("Running...");
}


void loop() {
  uint16_t lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");
  delay(1000);
}
Result:
Running...
Light: 54612 lx
Light: 54612 lx
Light: 54612 lx
Light: 54612 lx
Light: 54612 lx


It's just broken i guess. Will try to get a new one.
Edit: Also tested it on the Raspberry GPIO, not even detected by i2cdetect -y 1
I am not active on this forum anymore.
MikeF
Posts: 350
Joined: Sunday 19 April 2015 0:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.2
Location: UK
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by MikeF »

I got this value too, for a light / pressure / temperature sensor I was building, when I ran the sketch before I wired in the BH1750. Once wired in, I got sensible values. You have to connect the ADDR pin to GND, to get the right I2C address, but it not showing up in i2cdetect suggests it's broken.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

I did try that, left ADDR floating and tried also with ADDR connected to GND. Not detected at all by Arduino / Raspberry.
In the meantime i have ordered two new ones from China, now the 1,5 week waiting begins :cry:
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

Received new BH1750 today, succes!:
Image
Lux reading with box placed to the window.

Image
(Box is not ready yet, just tucked everything in it quickly)
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

Looking good! Only that thing at the bottom i would have put inside as well ;)
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

This was just for testing, i think i will convert it to a 2xAA battery version. Arduino Nano will get replaced by Arduino Micro 3.3V then.

Btw, in the comments of the sensor: someone said:
For BH1750 Sensor you should use the mode BH1750_ONE_TIME_LOW_RES_MODE and put the begin() call before each measurement. Otherwise your battery will be empty within a few days.

Would this be correct:

Code: Select all

/**
 * The MySensors Arduino library handles the wireless radio link and protocol
 * between your home built sensors/actuators and HA controller of choice.
 * The sensors forms a self healing radio network with optional repeaters. Each
 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
 * network topology allowing messages to be routed to nodes.
 *
 * Created by Henrik Ekblad <[email protected]>
 * Copyright (C) 2013-2015 Sensnology AB
 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
 *
 * Documentation: http://www.mysensors.org
 * Support Forum: http://forum.mysensors.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 *******************************
 *
 * REVISION HISTORY
 * Version 1.0 - idefix
 * 
 * DESCRIPTION
 * Arduino BH1750FVI Light sensor
 * communicate using I2C Protocol
 * this library enable 2 slave device addresses
 * Main address  0x23
 * secondary address 0x5C
 * connect the sensor as follows :
 *
 *   VCC  >>> 5V
 *   Gnd  >>> Gnd
 *   ADDR >>> NC or GND  
 *   SCL  >>> A5
 *   SDA  >>> A4
 * http://www.mysensors.org/build/light
 */

#include <SPI.h>
#include <MySensor.h>  
#include <BH1750.h>
#include <Wire.h> 

#define CHILD_ID_LIGHT 0
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

BH1750 lightSensor;
MySensor gw;

// V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
// If your controller supports the new V_LEVEL variable, use this instead for
// transmitting LUX light level.
MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
// MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
uint16_t lastlux;

void setup()  
{ 
  gw.begin();

  // Send the sketch version information to the gateway and Controller
  gw.sendSketchInfo("Light Lux Sensor", "1.0");

  // Register all sensors to gateway (they will be created as child devices)
  gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
  
  
}

void loop()      
{     
lightSensor.begin(BH1750_ONE_TIME_LOW_RES_MODE);  
uint16_t lux = lightSensor.readLightLevel();// Get Lux value
  Serial.println(lux);
  if (lux != lastlux) {
      gw.send(msg.set(lux));
      lastlux = lux;
  }
  
  gw.sleep(SLEEP_TIME);
}
I have that sketch running now on the Arduino and seems to work fine, but i'm not sure if it is optimal enough for battery usage.
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

nice ;)

(or a sense bender)

could you post a link to the 'case' you are using ?
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

The case is a Waterproof Plastic Electronic Project Box Clear Cover Enclosure Case 85*58*33MM
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

Quality outlives Quantity!
MikeF
Posts: 350
Joined: Sunday 19 April 2015 0:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.2
Location: UK
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by MikeF »

Strangely, I'm getting the 54612 value amongst otherwise 'normal' readings, as here:

Image

This occurs in bright sunlight, as if the BH1750 is maxing out (but it should go up to 65535).
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

I'm seeing the same. But it isn't that important i think? A value higher than that is not very interesting, you already know it is very bright then :mrgreen:
I am not active on this forum anymore.
MikeF
Posts: 350
Joined: Sunday 19 April 2015 0:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.2
Location: UK
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by MikeF »

True!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by gizmocuz »

Light: 54612 lx
Had the same problem, turned out I connected it to digital pin 4 and 5, instead of analog, and you also get this when the sensor is not connected at all

the chop-off is not a domoticz issue, and could be caused by the breakout board, but then again as mentioned above, its still a nice value !
Quality outlives Quantity!
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by thecosmicgate »

Using this mysensors sensor for 3 day's, but the value I'll get is very low . For example now (12:09 ) it says 38 lux ?
If I read this topic, then 38 is much to low.
What could be the issue?The sensor is not okay?


Sent from my MotoG3 using Tapatalk
It's nice to be important, but it's more important to be nice
Scooter ;)
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by ThinkPad »

Mine is reading 2460 lux right now (behind a window facing South). I would try a different BH1750.
Like i posted earlier i first received a defective one.

I must say the MySensors lux node + BH1750 is really great, it works fine in my situation. I get a nice parabolic curve out of it. Steadily climbing in the morning, peaks at midday and then slowly dropping after midday, just like you would have expected. On a sunny day it reaches 53k lux.
A Z-Wave multisensor i have also does lux measurement, but it goes to 1000 lux very quickly, and stays there the whole day, and in the afternoon it drops very quickly to almost 0 lux.

And the costs of a Arduino, nRF24L01+, BH1750 is hilarious, maybe 5 euro's or so.
I am not active on this forum anymore.
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: BH1750 lux sensor: reading 54612 lux???

Post by thecosmicgate »

Changed the lux sensor
uploadfromtaptalk1446064249702.png
uploadfromtaptalk1446064249702.png (153.04 KiB) Viewed 18011 times
So the lux(es) are still low, what are the measurements you've got now (21:31)
It's nice to be important, but it's more important to be nice
Scooter ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest