# Pimoroni Pico LiPo I2C Not Connecting

**URL:** https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284
**Category:** Product Questions
**Created:** [2 February 2023 05:22 UTC](https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284 "2023-02-02T05:22:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Lochlan195576](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Lochlan195576](https://forum.core-electronics.com.au/u/Lochlan195576)
#### Post date: [2 February 2023 05:22 UTC](https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284/1 "2023-02-02T05:22:29Z")

</div>

I have been trying to use a Pimoroni Pico LiPo with the latest 1.19.12 ([Releases · pimoroni/pimoroni-pico · GitHub](https://github.com/pimoroni/pimoroni-pico/releases)) MicroPython. However, I have been unable to get it to connect to my PiicoDev Buzzer Module or PiicoDev Magnetometer QMC6310.

When using:

```auto
from machine import Pin, I2C
i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=100000)
print( i2c.scan() )

```

The Piico will output the correct address. However, when running though either of the below guides I get the error “OSError: [Errno 5] EIO” when trying to initialise either sensor.

[Compass Guide](https://core-electronics.com.au/guides/raspberry-pi-pico/piicodev-magnetometer-qmc6310-guide-for-raspberry-pi-pico/)

[Buzzer Guide](https://core-electronics.com.au/guides/raspberry-pi-pico/piicodev-buzzer-module-raspberry-pi-pico-guide/)

Finally, I tried following some of the recommendations from this thread but was unable to make any progress. [Similar Issue Thread](https://forum.core-electronics.com.au/t/piicodev-tmp117-could-not-communicate/15647/9)

Any help would be amazing.

My Code:

```auto
from PiicoDev_QMC6310 import PiicoDev_QMC6310
from PiicoDev_Unified import sleep_ms # Cross-platform compatible sleep function

compass = PiicoDev_QMC6310(range=800) # Initialise the sensor with 800uT range
# compass = PiicoDev_QMC6310(0, sda=Pin(5), scl=Pin(4), freq=100000, range=800)

# Calibration recommended for best results.
compass.calibrate() # only need to calibrate once

# Optional: Declination is the difference between magnetic-north and true-north ("heading") and depends on location
# compass.setDeclination(12.3) # Found with: https://www.magnetic-declination.com/Australia/Newcastle/122944.html

while True:
    heading = compass.readHeading() # get the heading from the sensor
    if compass.dataValid(): # Rejects invalid data
        heading = round(heading) # round to the nearest degree
        print( str(heading) + "°") # print the data with a degree symbol
    sleep_ms(100)

```

---

<div class="post-metadata">

### Author: ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)
#### Post date: [2 February 2023 05:34 UTC](https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284/2 "2023-02-02T05:34:32Z")

</div>

Welcome Lochlan!!

With all PiicoDev device drivers on the Pico it is assumed that the Expansion board is used where the default pins are 8/9 for SDA and SCL respectively.

Just like in your I2C scan code if you setup the magnetometer with the correct arguments it should work no worries

```auto
from PiicoDev_QMC6310 import PiicoDev_QMC6310
from PiicoDev_Unified import sleep_ms # Cross-platform compatible sleep function
from machine import Pin

compass = PiicoDev_QMC6310(bus=0, sda=Pin(4), scl=Pin(5), freq=100000,range=800) # Initialise the sensor with 800uT range
# compass = PiicoDev_QMC6310(0, sda=Pin(5), scl=Pin(4), freq=100000, range=800)

# Calibration recommended for best results.
compass.calibrate() # only need to calibrate once

# Optional: Declination is the difference between magnetic-north and true-north ("heading") and depends on location
# compass.setDeclination(12.3) # Found with: https://www.magnetic-declination.com/Australia/Newcastle/122944.html

while True:
    heading = compass.readHeading() # get the heading from the sensor
    if compass.dataValid(): # Rejects invalid data
        heading = round(heading) # round to the nearest degree
        print( str(heading) + "°") # print the data with a degree symbol
    sleep_ms(100)

```

Let us know how you go!  
Liam

---

<div class="post-metadata">

### Author: ![Lochlan195576](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Lochlan195576](https://forum.core-electronics.com.au/u/Lochlan195576)
#### Post date: [2 February 2023 07:00 UTC](https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284/3 "2023-02-02T07:00:20Z")

</div>

Hi Liam,  
Thank you so much I can now see a heading.

Unfortuantely, the calibration is quite far off with it limited to about 150-240 and no matter what I change it doesn’t want to get much better.

Looking at the raw data I got the values below when rotating the the sensor on a table and writing down the highest / lowest values I could manage.

Max Min  
X - -410 -910  
Y - 1530 1020  
Z - 590 580

---

<div class="post-metadata">

### Author: ![Lochlan195576](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Lochlan195576](https://forum.core-electronics.com.au/u/Lochlan195576)
#### Post date: [2 February 2023 09:32 UTC](https://forum.core-electronics.com.au/t/pimoroni-pico-lipo-i2c-not-connecting/16284/4 "2023-02-02T09:32:59Z")

</div>

Update:  
It turns out just deleteing the calibration file and commenting out the line  
`compass.calibrate() # only need to calibrate once`  
got the compass within 2 degrees for me according to my phone.
