bh1750 i2c digital light sensor

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
PinkInk
Posts: 65
Joined: Tue Mar 11, 2014 3:42 pm

bh1750 i2c digital light sensor

Post by PinkInk » Fri Oct 28, 2016 5:34 pm

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

VDRainer
Posts: 2
Joined: Sun Feb 12, 2017 1:59 pm

Re: bh1750 i2c digital light sensor

Post by VDRainer » Sun Feb 12, 2017 2:39 pm

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

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: bh1750 i2c digital light sensor

Post by deshipu » Mon Feb 13, 2017 9:23 am

What happens when you remove this line and replace it with "count=data"? https://github.com/PinkInk/upylib/blob/ ... t__.py#L65

VDRainer
Posts: 2
Joined: Sun Feb 12, 2017 1:59 pm

Re: bh1750 i2c digital light sensor

Post by VDRainer » Mon Feb 13, 2017 10:16 am

deshipu, youre my Hero!!

Now the results are as expected.

Thank you very much!

Post Reply