# Read BH1750 Sensor

**URL:** <https://discourse.nodered.org/t/read-bh1750-sensor/3378>\
**Category:** Hardware\
**Created:** [23 September 2018 14:00 UTC](https://discourse.nodered.org/t/read-bh1750-sensor/3378 "2018-09-23T14:00:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [23 September 2018 16:44 UTC](https://discourse.nodered.org/t/read-bh1750-sensor/3378/3 "2018-09-23T16:44:28Z")

</div>

I have a working BH1750 on a raspberry pi using the following:  
Node **node-red-contrib-i2c**

![Screenshot_2018-09-23_17-33-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a871d38a4c4fd7bae9a47ccd0a405b6853dc5350.png)  
35 is the address of the sensor, 16 is the command to get the lux value.

Followed by a change node:  
 ![Screenshot_2018-09-23_17-34-40](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/68a8484a5cc0f05bc25459ad37bb466f9b621e08.png)

The JSONata expression is:  
 ![Screenshot_2018-09-23_17-35-39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4b8f9b734fd0f1f1a6e826f10205e13f9d6375a8.png)

Which is converting the two byte value returned by the i2c node to a decimal value and dividing the result by 1.2 as described in the datasheet (the sensor returns values that are typically 20% too high), and rounding to 2 decimal places.

msg.lux contains the result.

---

_[View the full topic](https://discourse.nodered.org/t/read-bh1750-sensor/3378)._
