Hello, I’m looking to make a luxmeter with 4 sensors BH1750 and an Arduino Nano, I found the code and the diagram for a sensor and I liked if someone from you can help me to make it to 4 sensors ,
Maybe this page will help. Found with a search for "multiple BH1750 on Arduino".
Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.
Can you give a link to your BH1750 modules ? A link to where you bought it.
The BH1750 is a 3.3V sensor and the Arduino Nano is a 5V board. The means there is a voltage mismatch on the I2C bus, and you may not connect digital outputs from the Nano to the address line of the sensor.
Perhaps you better find a library for the BH1750, because you use the functions of the Wire library in the wrong way. See also my alternative explanation.
I don’t know anything about Arduino, I need to measure the light intensity in 4 rooms, looking on the internet I came across this model with Arduino, I bought the components that are on the schematic and I’m trying to find someone who can help me make it
azizouzzat:
I don’t know anything about Arduino, I need to measure the light intensity in 4 rooms, looking on the internet I came across this model with Arduino, I bought the components that are on the schematic and I’m trying to find someone who can help me make it
I can see from the replies that this project is flawed right from the starting gate, and would require a lot of work and changes to the design to do what you ask. So, people here don't think it is fun to help with that kind of project, it's often just an exercise in frustration. Also it seems like you won't be able to code it yourself, and generally people don't take on assignments like this for free, unless it is fun in some way. So, you might have to move the thread to "Gigs and Collaborations" and let people know how much you would pay to have it made for you.
@azizouzzat, aarg is right. Your project can not work. The I2C bus length is for 50 cm, not to another room. You can not connect those sensors to a Arduino Nano just like that. I even wrote a page to scare new users for the I2C bus. There are many bad examples online, and sadly you found a bad sketch.
Arduino is for learning about electronics and programming and having fun along the way.
Start with something that you can do and that will work. Adafruit has the best tutorials. For example a tutorial for ledstrips.
azizouzzat:
Hello, I’m looking to make a luxmeter with 4 sensors BH1750 and an Arduino Nano, I found the code and the diagram for a sensor and I liked if someone from you can help me to make it to 4 sensors
Do you like to try (as an exercise) the following proposed solution?
A single SCL for everything is okay.
A multiplexer for SDA requires that SDA has pullup resistors on both sided of the multiplexer.
A 3.3V I2C bus connected to a 5V Arduino board might cause trouble.
You can not use long wires to put sensors in other rooms.
The sketch in that Blog is not okay. It uses the Wire library in the wrong way.
The I2C bus is not supposed to go through a cable. It is not that kind of "bus".