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 and have everything stored in Documents/PiicoDev
IC2 is enabled but when I run the code I get the following error:
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.
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
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.
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:
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:
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.