ESP32 with BH1750!

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jgu1
Posts: 777
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 175 times

ESP32 with BH1750!

Post 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
Attachments
NewSun.msg.txt
(48.52 KiB) Downloaded 71 times

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: ESP32 with BH1750!

Post 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

medelec35
Matrix Staff
Posts: 1924
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 623 times
Been thanked: 645 times

Re: ESP32 with BH1750!

Post 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
BH1750 ESP32_DEVKITV1.png (141.68 KiB) Viewed 2436 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

Code: Select all

idf.py --version
then the enter key
Then paste the reported version.
Martin

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: ESP32 with BH1750!

Post 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
Capture.JPG (35.43 KiB) Viewed 2428 times

Regards

jgu1
Posts: 777
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 175 times

Re: ESP32 with BH1750!

Post by jgu1 »

Hi Martin & Chipfreyer!

Thank´s for fast reply. Well my fault (of course) sorry :lol: 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"? :D

Br Jorgen

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: ESP32 with BH1750!

Post 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"....? :oops:

Regards

jgu1
Posts: 777
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 175 times

Re: ESP32 with BH1750!

Post 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 :lol:

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

Steve-Matrix
Matrix Staff
Posts: 1472
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 204 times
Been thanked: 349 times

Re: ESP32 with BH1750!

Post 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.

jgu1
Posts: 777
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 175 times

Re: ESP32 with BH1750!

Post by jgu1 »

Thank you Steve, look forward to hear.

Jorgen

Post Reply