You’ll have to change the pins around so that you have the same SDA and SCL pins (on PiicoDev SDA is Blue and SCL is yellow).
Just to confirm if you try all permutations of the scan code with your pins i.e. i2c = I2C(0,sda=Pin(21),scl=Pin(22)) and i2c = I2C(0,sda=Pin(22),scl=Pin(21))
@Phil204480
Just to confirm, you aren’t receiving anything back via the REPL, just empty square brackets?
Would it be possible to send through a screenshot of your REPL and code?
Hi Bob
Yeah very confusing, I’ve got a couple of custom boards running ESP32-C3 microcontrollers instead of the Pico (+ expansion board), the pins have swapped between them due to different needs for the boards.
Internally the ESP modules have a bus matrix so common comms protocols arent tied to particular pins, UART, I2C and SPI can be on any of the available pins, I’ll grab some pics of each board that I was using for testing when I get a chance
Confusingly its another completely different board - the only link between each of them being that they can run micropython and have some capability of running PiicoDev modules.
Hi Liam
Yes I just spotted the fact it is not a Pico with a W attached. I have just edited my post above to reflect this.
Still confusing for this old head. I have just purchased a couple of Picos to play with. Will try with the Arduino IDE first as I have a definite use if it will do the same as the Arduino NanoEvery which I have working at the moment.
Cheers Bob
Definetly agree that the ‘fragmentation’ around the ESP32 scene has made it harder for people to jump in and get running! I guess thats one of the big advantages of the older arduino boards, an Uno is an Uno…
Also one of the reasons for the vast majority of my projects I just use a Wemos D1 Mini, less pins = less confusion! That said, once the pico W matures a bit it will be mighty tempting for its low low price.
For sure, not to mention all of the unreleased modules that make their way into your head, I’d check out this amazing reference Tim put together!
The Pico W is a huge contender, the offered features become apparent when compared to some of the raw ESP32 modules, great feature sets on both sides of the fence at very similar prices!
With my projects atleast I’ve been using the Pico instead of other Arduino boards since micropython is just sooooooo much faster to develop with
Thanks for the reference, I’ve got some bedtime reading tonight now!
Agree, micropython and particualy Web REPL has completely revolutionised how I develop, deploy, and manage my microcontrollers! I generally flash my D1 mini’s with micropython, I’ve only got 2 left using the standard C++ firmware, both of which rely on libraries not yet ported to micropython (I haven’t yet psyced myself up to port them myself!).
I also much prefer python over C++ (but honestly I do still love C++ for it’s raw simplicity factor), just for the speed and flexibility of development. I’ve found it’s also shockingly memory efficient even on the ram anemic ESP8266 boards for such a high level language. Only thing you have to be careful with is the order in which you import modules to try and avoid memory fragmentation as much as possible!
Just to confirm everything above and to make sure we are nearing a resolution could you please reply to the following:
(Inc @ShaneC 's recommendation):
Paste a link to the product page of the ESP32 board that you are using, I’ve got a few lying around that I can test with, it would be good to confirm that it’s the correct one though
A picture of how you have everything setup and plugged into the ESP32, a photo from your phone is best here
Run the following code
from machine import Pin,I2C
i2c = I2C(0,sda=Pin(21),scl=Pin(22))
i2c.scan()
AND
from machine import Pin,I2C
i2c = I2C(0,sda=Pin(22),scl=Pin(21))
i2c.scan()
With a screenshot of the micropython code you ran and the REPL (Windows screenshot is Win + Shift + S)
What guide/connection method were you using for the BMP280?
Roll back the micropython version and complete the tests above
If you dont have any luck with the following you can go right back to confirm a couple of other things, DFRobot (presumably the manufacturers of the board) have linked the IO correctly and that the Pin library is working correctly.
Connect an LED, Pin 21 and 22 together, set one pin to read, another to write.
Then observe the LED turn on, and the Pin.value() function show the same result
As Liam has suggested in his last comment it would be very useful if you could post both;
A photo of your setup so we can see which pins are connected to the BME from the ESP
A link to the exact ESP board that you’re using, since the ESP uses a matrix for it’s pins, different boards can have different pin layouts, so on your particular board it may not be Pins 21 and 22.
As Liam has also suggested it might be beneficial to skip using the BME for now and just try bridging Pins 21 and 22 with an LED and setting one pin to on and one to off, you should see the LED turn on (make sure you get the LED the right way around with the neg lead going into the ‘off’ pin.) This will confirm if the pins your’re toggling are actually the pins on the board that you want to toggle.
It looks like the connector might need a bit more of a nudge to get in the connector.
I’d definitely give the trick that @Liam120347 mentioned with the LED and confirming that the pins are working correctly, as mentioned before you can swap just about all of the GPIO pins around, I’d suggest giving that a shot!
Another thing that @ShaneC and Liam recommended was to send through a link of the exact ESP32 board that you were using, some manufacturers of boards sneakily re-assign pins - if they have a schematic you could track down what the pins actually are.
I’ve had great experiences with the Unexpected Maker, Adafruit and Sparkfun ESP32 boards with I2C and PiicoDev
Liam