Page 1 of 1

bh1750 i2c digital light sensor

Posted: Fri Oct 28, 2016 5:34 pm
by PinkInk
I modified this (https://gist.github.com/oskar456/95c66d564c58361ecf9f) RPi driver for the cheap bh1750 i2c digital light sensor for MicroPython;

https://github.com/PinkInk/upylib/tree/master/bh1750

Re: bh1750 i2c digital light sensor

Posted: Sun Feb 12, 2017 2:39 pm
by VDRainer
Hi All,

Im from Germany and new to the ESP8266 and MicroPython, so sorry for stupid questions and bad english.

Want to use this driver for measuring with the NodeNCU ESP8266 ESP-12E.

The code example gave me an error, so i tried:

import machine, bh1750
i2c = I2C(scl=Pin(5), sda=Pin(4))
s = bh1750.BH1750(i2c)
s.get_measurement()

This seems to work, but comparing the results with the RPi Driver on my Rasberry Pi gives me unrealistic values.

Examples :
RPI Driver: 63.33 lx
This Driver: 10239.9 lx
Holding a Lamp on the bh1750:
RPI Driver: 641,7 lx
This Driver: 3420.0 lx

What am i doing wrong?
Does anyone use this Driver and has some hints for me?

Thanks for reading!

VDRainer

Re: bh1750 i2c digital light sensor

Posted: Mon Feb 13, 2017 9:23 am
by deshipu
What happens when you remove this line and replace it with "count=data"? https://github.com/PinkInk/upylib/blob/ ... t__.py#L65

Re: bh1750 i2c digital light sensor

Posted: Mon Feb 13, 2017 10:16 am
by VDRainer
deshipu, youre my Hero!!

Now the results are as expected.

Thank you very much!