Page 1 of 1
ESP32 with BH1750!
Posted: Sat Dec 31, 2022 6:45 pm
by jgu1
Hi!
First happy Newyear to all!
I am trying to connect a BH1750 ligth sensor to he BH1750 but when I compile I get an error 01? As soon I remove the BH1750 component I can compile.
I see in the Properties that there are two serieal channel, but no pin are shown. I change to "software" and are then able to choose pin for SDA and SCL, no matter which pin I choose, it wont work, error 01, any idea please?
Br Jorgen
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 1:34 am
by chipfryer27
Hi Jorgen
Happy New Year to you.
I've had good results with that sensor using a PIC, but I've not tried yet with any ESP.
I see though that the component doesn't automatically populate SDA/SCL pins, you need to select them as appropriate depending on channel. Are they correct for your channel?
I'll connect a sensor to an ESP when I get a chance and see what I get.
Regards
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 12:20 pm
by medelec35
Hi Jorgen.
Happy new year to you and everyone else on the forums.
I have tried BH1750 with ESP32_DEVKITV1 target and it compiles for me with Channel1 for the sensor selected.

- BH1750 ESP32_DEVKITV1.png (141.68 KiB) Viewed 2535 times
Are all your components up-to-date?
If they are not and you do a full database update, don't forget to reload your project after.
In addition to chipfryer27 post, you will need to select the pins from SDA & SCL Remap pins.
When you first add the component it should state unconnected for both SDA & SCL pins.
You just select the pin from the Remap pin below, which will be blank for an unconnected pin.
Can you run ESP-IDF Command Prompt, which can be found on your desktop?
Alternatively, press your windows key and scroll down to ESP-IDF, select it, and you should see the ESP-IDF Command Prompt.
Type
then the enter key
Then paste the reported version.
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 3:31 pm
by chipfryer27
Hi
Just a quick follow up. I did use the component with an ESP and a I2C display. I only have a deleted photo so I'm guessing I was just testing code. However it did work as expected.
Incidentally, when I add the component, the SDA and SCL pins default to Port B4 including both remaps, so you will probably need to set yours to something suitable.

- Capture.JPG (35.43 KiB) Viewed 2527 times
Regards
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 3:57 pm
by jgu1
Hi Martin & Chipfreyer!
Thank´s for fast reply. Well my fault (of course) sorry

Of course I know *I have to go to the rigth side of the proporties panel and scroll down and choose the alternative pin number, forgot that, notice that when I saw your att. picture.
Now no problem with compiling and it work perfect.
By the way Martin, do you know when release of FC10 is it almost on the"corner"?
Br Jorgen
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 5:25 pm
by chipfryer27
Hi
Glad to hear it's working for you, it's a great little sensor.
So easy to overlook the simplest of things. Guess who reversed I2C pins yesterday and spent ages trying to figure out why things didn't work before resorting to the "sniffer"....?
Regards
Re: ESP32 with BH1750!
Posted: Sun Jan 01, 2023 8:09 pm
by jgu1
Hi Chipfreyer!
Yes, "So easy to overlook the simplest of things" Believe me, I have tryed this many times, but never give up, that´s how we learn best
And yes this BH1750 is a very reliable tiny component.
Do you know when FC10 will be released?
Again thank´s to you both.
Jorgen
Re: ESP32 with BH1750!
Posted: Tue Jan 03, 2023 9:14 am
by Steve-Matrix
jgu1 wrote: ↑Sun Jan 01, 2023 8:09 pm
Do you know when FC10 will be released?
It is quite close now. We will post some more details in the coming weeks.
Re: ESP32 with BH1750!
Posted: Wed Jan 04, 2023 10:53 am
by jgu1
Thank you Steve, look forward to hear.
Jorgen