bob_smith
Posts: 15
Joined: Fri May 15, 2020 10:40 pm

I2C problems with BH1750 photoresistor

Fri May 15, 2020 11:52 pm

(Raspberry Pi 2, model B, V1.1 - buster OS - all updated / upgraded - smbus loaded on)

Hi,

I am quite new to the Raspberry Pi and recently I have hit a brick wall. I am trying to link the Raspberry Pi to a BH1750 photoresistor following this tutorial: https://www.raspberrypi-spy.co.uk/2015/ ... ty-sensor/

However, the I2C is not recognising it. When I type in the command: sudo i2cdetect -y 1 , instead of coming up with address 23, it outputs many addresses onto the screen.

I have checked connections, soldered the the pins onto the bh1750, but no change. Even used a different Raspberry Pi (Pi3, model B+), still no good.

I have attached some images of the setup. Any help would be gratefully received as I have run out of ideas on this one.

Much appreciated,

1. https://images.wgsbcomputing.com/20200516_002041.jpg
2. https://images.wgsbcomputing.com/20200516_002133.jpg
3. https://images.wgsbcomputing.com/20200516_004643.jpg
4. https://images.wgsbcomputing.com/20200516_004742.jpg

User avatar
joan
Posts: 15785
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C problems with BH1750 photoresistor

Sat May 16, 2020 6:48 am

SDA is connected to ground somewhere. Most likely candidate is a solder splash close to the SDA pin on the sensor. Check the solder side.

bob_smith
Posts: 15
Joined: Fri May 15, 2020 10:40 pm

Re: I2C problems with BH1750 photoresistor

Sat May 16, 2020 9:47 am

Hi,

I have put a multimeter across the SDA and ground and on a DC reading it came up with a 3.3v reading. Does this mean that it is not being pulled down as it is a high?

Much appreciated for you answering this query.

G

User avatar
joan
Posts: 15785
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C problems with BH1750 photoresistor

Sat May 16, 2020 10:16 am

That sounds okay.

I would check the GPIO using wiringPi's pintest utility or my gpiotest utility (https://elinux.org/R-Pi_Troubleshooting#Testing). Test with nothing connected to the GPIO.

User avatar
rpdom
Posts: 19281
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: I2C problems with BH1750 photoresistor

Sat May 16, 2020 11:16 am

It is odd that the i2cdetect doesn't show all addresses connected, just certain blocks. That is not the usual failure pattern. I have a feeling that the sensor itself could be faulty.

What does i2cdetect show if you just disconnect the SDA wire from the sensor? Leave the other end of that wire connected to the Pi, and all the other wires connected normally.
Unreadable squiggle

bob_smith
Posts: 15
Joined: Fri May 15, 2020 10:40 pm

Re: I2C problems with BH1750 photoresistor

Sat May 16, 2020 12:49 pm

Hi,

Thanks for the replies guys. Just plugged in a BME280 (temp, humidity, air pressure sensor) and that is picking the address x77 no problem.

I have ordered x3 new photoresistors to hopefully prevent me running round in circles. I'll get back to you tomorrow for an update, when hopefully things will improve!

Thank you for the suggestions - I will try them if it continues to fail.

bob_smith
Posts: 15
Joined: Fri May 15, 2020 10:40 pm

Re: I2C problems with BH1750 photoresistor

Mon May 18, 2020 12:33 am

Hi,

Just to let you know that today I received a new photoresistor, downloaded a fresh copy of 'buster' OS on an SD card, wired the wires directly to the photoresistor and when I types in the command: sudo i2cdetect -y 1 nothing showed up.

However, when I soldered the wires (with a fine soldering tip) it worked and now address 23 has showed up.

Maybe it was wiring afterall?

A big thank you for your contributions and being only too willing to help out.

Thank you!

bob_smith
Posts: 15
Joined: Fri May 15, 2020 10:40 pm

Re: I2C problems with BH1750 photoresistor

Mon May 18, 2020 7:51 pm

Hi,

Just one more observation before I close this post. When the address pin on the BH1750 was connected to ground GPIO pin the photoresistor worked and registered an address of 23 on I2C.

However, I shut down the Pi and disconnected the address pin on the BH1750 from ground GPIO pin to see what would happen. No address at all came up on I2C. When I shut down the Pi and tried to connect the address pin on the BH1750 back to the ground GPIO pin to return the Pi to it's original state, it would not work at all. I checked the voltages across the pins on the BH1750 with a multimeter and they were fine. Nothing I could do would make the photoresistor show an address on I2C.

So I got a new photoresistor, soldered the connections and connected the address pin on the BH1750 to the ground GPIO pin. It is worked now showing address 23 on I2C.

Thank you for your help with the above.

Return to “Beginners”