Husky-lens drivers fix/issues

Hey everyone!

I wanted to share some information regarding the HuskyLens and the SparkFun XRP robot. From my experience, the HuskyLens can work with the XRP, but the official drivers and instructions currently available do not work out-of-the-box. Getting it running often requires some knowledge of coding and tweaking the driver files.

To help with this, I’ve put together a GitHub repository with a rough working version of the drivers and example code here. While it’s functional, it’s still a bit rough around the edges.

I’d love to see better solutions or updates—either improvements to my repository or updates to the official XRP HuskyLens drivers/instructions—to make it easier for other users and educators to get the HuskyLens working without extra troubleshooting.

Any feedback, contributions, or suggestions would be really appreciated!

For more details or inquiries, please refer to the GitHub repository.
If you have questions that aren’t answered there, feel free to reply to this post—I’ll do my best to check and respond as often as I can.

Hi there, thanks for taking the time to help!

Could you please elaborate on what problems you encountered with the official SparkFun drivers? I looked at the changes in your repo, and the only functional difference I can find is changing the default I2C driver:

The qwiic_i2c driver has some magic code that’s designed to pick the default I2C bus for whatever board is in use:

If you were having trouble with the default I2C bus selection, there’s a couple possible reasons for that. But also curious to know if you were having any other trouble, since I can’t find any other functional differences.

Thanks!

Hi, thanks for your response, so the issue me and my class were faceing was when trying to use the drivers, they would not work, after a bit I figured out that the first issue is with the import at the top, so I renamed those to match, I can’t remember but I think I also changed a class later on in the code to work, but that didn’t solve this and since I’m very new to this it took me a bit to figure out, so when it calls the i2c driver, it puts it as none which now I don’t know why it’s originally like that but though testing I found that changeling it to (Id=1 sda=4 scl=5) (I’m doing this by memorie so bare with me) but that fixed it, those pin changes were in the actual husky lens driver part and not in the qwii i2c driver folder, but the issue with those is the miss named imports, if you have anymore questions I’ll answer them as quickly as possible but due to thanksgiving break there might be a slight delay.

Thanks for the info!

Given that the imports were not working, I wonder if the files were not installed to the correct locations. The file structure has to be:

/
├─ lib/
│  ├─ qwiic_i2c/
│  │  ├─ __init__.py
│  │  ├─ i2c_driver.py
│  │  ├─ micropython_i2c.py
│  ├─ qwiic_huskylens.py

(Ignore the random italics, Discourse uses underscores for italics, and it’s failing to not render the italics within the code block for some reason).

FWIW I just tested the official SparkFun drivers on my end, and the imports all work correctly, and I’m able to run the examples.

Hope this helps!

No worries, me too! I’m actually about to sign off for the week, so I’ll return next week if there’s more conversation here!

so we followed the steps laid out in here Huskylens blocly - #2 by Fgrossman from one of your reply’s, the issue is from line 36 in micropython_i2c.py which is from .i2c_driver import I2CDriver which dose not match the name so i changed that to from qwiic_i2c.i2c_driver import I2CDriver as otherwise it errors before as the i2c_driver isn’t in lib and in a sub folder. i also changed in the _init_.py the import from .i2c_driver import I2CDriver to from qwiic_i2c import i2c_driver. and then that’s it except for the pin, whilst renaming the rest showed less and less errors i kept getting the none is not attributable error and the way i fixed that is by manually setting the pin, i would love to hear from ya if my somewhat fix breaks a different part of the code that dose that automatically, as I’m very new and it took me a bit to make this somewhat work for my classmates

have a great thanksgiving break!

Could you please post the exact error message you’re getting? And could you also take a screenshot of your filesystem structure? Here’s mine for reference: