Hi there @Nick101707, and welcome to the forums, glad to have you here.
There’s definitely something wrong with your I2C addresses there.
The error message ‘incorrect device found at address 53’ indicates that the sensor is not where it’s supposed to be. The 0x35 address is in hexadecimal, or base 16, which means that 0x35 address translates to the decimal 53.
That is triggered because PiccoDev-Ultrasonic class expects itself to have the i2C address of 0x01 when it has the device ID of 578. But, for some reason in your setup, it does not.
One of two things is most likely occuring:
Wiring could be off. Could you please upload photos of your setup, taking particular attention to show wiring, so we can confirm if its ok.
If you’re getting environment errors in Thonny, it’s likely you have not configured a Virtual Environment. Did you follow the steps here:
So here’s a pic of the setup producing this problem.
The environment errors were not in Thonny, I did create the environment there OK.
Problems were when trying to get Thonny to add the piicodev package, eg Using Tools > Manage packages, enter “piicodev” > Search on PyPI gave blank, no results found.
It is quite strange that you couldn’t find PiicoDev in Thonny. I just tried on a random computer and it was the top search result. So, I’m not sure what is happening there. But it sounds like you’re not using a Virtual Environment.
Essentially, Raspbian OS is refusing to download the code because it needs Python to function and doesn’t want any changes. To get around this, we need to make a Virtual Environment we can install the dependencies to.
cd /path/to/your/project
python3 -m venv ultrasonic #Anything you want, ultrasonic seems on theme.
source ultrasonic/bin/activate
sudo pip3 install piicodev
Then try running your code again.
Oh, and if you want to leave the Venv and go back to the regular shell, just type deactivate. Or close the terminal and open a new one (which is what I usually do…)
If you’re still receiving the same error, please upload a screenshot showing the error message. It will help us solve any issues.
Re the env error, this was the issue, solved earlier as Thonny does now have the piicodev package listed in installed packages list.
However, guide instructions didn’t mention this, I got the error, googled, did the above already. I’m guessing this has to be done after the Thonny environment creation & the Thonny env can be used for this? Hopefully posting it here helps others.
Unfortunately after several reboots, the code still glitches as described.
Update: I changed the device addresses with the switches, copying the “Multiple Rangefinders on the same PiicoDev Bus” section in the guide. I did connect both sensors. Suddenly it’s working perfectly, no more “incorrect device” errors.
I think the issue was the default address. Changing it from default 0000 with the switches seemed to get it going (1,0,0,0 & 0,1,0,0 switch settings worked).