# Rasberry Pi 4 Red Using Piiicodev expansion and motion sensor

**URL:** <https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859>\
**Category:** Support\
**Created:** [30 July 2021 00:57 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859 "2021-07-30T00:57:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 00:57 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/1 "2021-07-30T00:57:03Z")

</div>

I am a newbie so please excuse my ingorance.

I have a Rasberry Pi 400 (red one with keyboard all in one) and connected the PiicoDev expansion board and motion sensor.

Following this guide: [Guide](https://core-electronics.com.au/tutorials/piicodev-motion-sensor-mpu-6050-raspberry-pi-guide.html) and have everything stored in Documents/PiicoDev

IC2 is enabled but when I run the code I get the following error:

```auto
Device 0x68 not found, trying again
Device 0x68 not found, trying again
Device 0x68 not found, trying again
Traceback (most recent call last):
  File "/home/pi/Documents/PiicoDev/motion.py", line 11, in <module>
    accel = motion.read_accel_data() # read the accelerometer [ms^-2]
  File "/home/pi/Documents/PiicoDev/PiicoDev_MPU6050.py", line 128, in read_accel_data
    x = self.read_i2c_word(self.ACCEL_XOUT0)
  File "/home/pi/Documents/PiicoDev/PiicoDev_MPU6050.py", line 85, in read_i2c_word
    rawData = self.i2c.readfrom_mem(self.addr, register_high, 2)
  File "/home/pi/Documents/PiicoDev/PiicoDev_Unified.py", line 69, in readfrom_mem
    self.smbus_i2c_read(addr, memaddr, data, nbytes, addrsize=addrsize)
  File "/home/pi/Documents/PiicoDev/PiicoDev_Unified.py", line 52, in smbus_i2c_read
    self.i2c.i2c_rdwr(msg_w, msg_r)
  File "/home/pi/.local/lib/python3.7/site-packages/smbus2/smbus2.py", line 658, in i2c_rdwr
    ioctl(self.fd, I2C_RDWR, ioctl_data)
OSError: [Errno 121] Remote I/O error
>>> 

```

Unsure what I am doing wrong and any help would be appreciated.

 ![20210730_105751](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/b/bb7b697362a223bd77be3368023846a6deda7952.jpeg)

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [30 July 2021 01:09 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/2 "2021-07-30T01:09:45Z")

</div>

Hi Tim, Welcome to the Forum!

The first step is to make sure your Piicodev module is being seen at all on your Pi. The easiest way to do this would be to run` sudo i2cdetect -y 1` (you may have to run `sudo apt install i2c-tools` first if that returns an error about not being installed)

Once you’ve done that, we can take a closer look at your code. Keen to see your project on its feet!  
-James

---

<div class="post-metadata">

**Author:** ![Bryce](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/bryce/32/3631_2.png) [@Bryce](https://forum.core-electronics.com.au/u/Bryce)\
**Post date:** [30 July 2021 01:11 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/3 "2021-07-30T01:11:37Z")

</div>

Hi Tim,

No worries, we’re here to help!

It does seem a little odd, as the default address on that chip is 0x68 (this is hex so in dec it’s actually 104 = 0x68) if for some reason ADR is high on your board it would actually appear to be at 0x69. Running the commands that James linked will let us know whether there’s an issue with the address of the PiicoDev sensor not being correct/unrecognised.

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:15 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/4 "2021-07-30T01:15:24Z")

</div>

Thanks for that. Here is a screenshot showing the terminal output.

 ![result](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/0/0b7adc338d72470ca68d120952b3abf3fc134b52.png)

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [30 July 2021 01:17 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/5 "2021-07-30T01:17:51Z")

</div>

Hi Tim,

Just to confirm, have you enabled i2c? Easiest way to check is to run `sudo raspi-config nonint get_i2c`

If it’s not (returns 1), `sudo raspi-config` has an option for enabling it.

-James

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:20 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/6 "2021-07-30T01:20:15Z")

</div>

yes i did that and rebooted after ensuring it was enabled

 ![2021-07-30-111821_1920x1080_scrot](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/4/4fedfbdedf5db4c8b3684e3104fe7b47f19e52ef.png)

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:21 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/7 "2021-07-30T01:21:42Z")

</div>

sudo raspi-config nonint get\_i2c returns 0

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:24 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/8 "2021-07-30T01:24:17Z")

</div>

i noted in the tutorials the light is enabled on the sensor but i do not get the light on the sensor. could that be a hint?

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [30 July 2021 01:29 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/9 "2021-07-30T01:29:57Z")

</div>

Hi Tim,

Hmm, quite possibly. Maybe @Michael has an idea what is happening here? We test all Piicodev modules before they leave our warehouse, but something may be amiss here. I see you’ve got a couple cables to plug the sensor in, have you got the same symptoms on all? Have you tried different connectors on the Piicodev modules to try and find a fault there?

Whatever the problem turns out to be, we’ll try our best to get you sorted out.  
-James

P.S. On the schematic, the LED is just a power LED, so it’ll be lit regardless of communication with the Pi, just power:  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/5/5e50f576e2b11df7048763bbfa0f35166b470b18.png)

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:32 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/10 "2021-07-30T01:32:34Z")

</div>

I also have the distance sensor so i will try that and update shortly.

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:42 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/11 "2021-07-30T01:42:37Z")

</div>

same issue so I am starting to think its the expansion board

 ![distance1](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/e/ea4555390bdca5f1114015f0a56a9790cc7a5c1d.jpeg)

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 01:46 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/12 "2021-07-30T01:46:42Z")

</div>

here is another image of how i have it all connected

 ![20210730_114344](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/d/de8f3b5a5ab6501f8038e02ca0c64fbf37eb0d59.jpeg)

---

<div class="post-metadata">

**Author:** ![Trent5487676](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/trent5487676/32/4583_2.png) [@Trent5487676](https://forum.core-electronics.com.au/u/Trent5487676)\
**Post date:** [30 July 2021 06:05 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/13 "2021-07-30T06:05:59Z")

</div>

Hi Tim,

I’ve connected up the same setup here and the piicodev sensors light up.

 ![2021-07-30_15-57-11](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/d/d5dcfb32bdc1a3687f34dc2e0db1f7dc76788c58.jpeg)

I will add this isn’t my preferred setup, I think it would be more robust long term to use a ribbon cable to extend the headers, or at the very least stackable header pins to space the expansion board so it doesn’t press on the keyboard frame. The GPIO connector is a surface mount connector after all and not really a load bearing component.  
Something like this:

> **[40 Pin GPIO Extension Cable for any 2x20 Pin Raspberry Pi - 150mm / 6 long](https://core-electronics.com.au/40-pin-gpio-extension-cable-for-any-2x20-pin-raspberry-pi-150mm-6-long.html)**
>
> That new Raspberry Pi 400 computer you just got has a row of 2x20 pin headers on the right side - those are the GPIO (general purpose input/output) pins, and for those of Adafruit who like to hack electronics, they are where the real fun lies

or failing that just this [https://core-electronics.com.au/stackable-0-100-female-header-2x20-pin-straight.html](https://core-electronics.com.au/stackable-0-100-female-header-2x20-pin-straight.html)

Is there a chance the expansion board was missaligned on the GPIO pins like below?

 ![2021-07-30_15-52-20](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/3/3b303df0924ec20ec8889c7635b705d84f178bb2.jpeg)  
This would cause the LEDs not to light up.

---

<div class="post-metadata">

**Author:** ![Tim170340](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tim170340](https://forum.core-electronics.com.au/u/Tim170340)\
**Post date:** [30 July 2021 06:24 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/14 "2021-07-30T06:24:48Z")

</div>

Well that is embarrassing. ☹ Yep it was misaligned to the left. Repositioned it and the green light came up immediately. Thanks guys for all your help and patience today. Really appreciate it.

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [30 July 2021 06:26 UTC](https://forum.core-electronics.com.au/t/rasberry-pi-4-red-using-piiicodev-expansion-and-motion-sensor/10859/15 "2021-07-30T06:26:51Z")

</div>

Hi Tim,

Awesome to hear it works! We’re in the process of updating our product page to make sure no-one falls into the same trap 🙂

Good luck with your projects, and let us know if you need a hand with anything else!  
-James
