Open xgpt opened 1 year ago
Looks like you're using a QT Py RP2040. This project was created before those existed, and only works with the original QT Py M0.
Oh interesting, I wasn't sure why that might be happening!
Sorry to bump, but @xgpt , did you find a workaround? I may just cut my pins and bridge with wires to sequential pins... :/
And @todbot , would you be willing to update the "components" section to call out the M0? I didn't realize there were different versions of the QT Pi and I didn't order directly from the link. Thank you both!
@adalovebass Yep I'll do that. I'll also see about a solution for the RP2040.
That's awesome! Technically I'm on a xiao-rp2040, but all the pins are in the same spot as the QT Pi, I just have less memory (and need to cherry-pick my python modules).
Sorry to bump, but @xgpt , did you find a workaround? I may just cut my pins and bridge with wires to sequential pins... :/
And @todbot , would you be willing to update the "components" section to call out the M0? I didn't realize there were different versions of the QT Pi and I didn't order directly from the link. Thank you both!
I'm out of town and away from my desk, but I can look at the prototype I ended up with and send you a schematic of the pinout when I get back from my trip!
Ooo, @xgpt, I'd love to see that!
I also just updated qtpy_knob.py
to use a new fakerotaryio
module I created and put in this repo that will let you do rotaryio stuff on non-sequential pins. It's not as good as real rotaryio
but should work for this application.
Omgosh thank you both! I am kind of new, so figured I could remove the rotary encoder lead from D1 and wire it to D4 instead, so the pins used were D3 and D4:
But apparently in the GPIO sense D3 and D4 are not actually sequential. I found this thread that mentions help(microcontroller.pin)
, the output of which indicates that on the Adafruit QT Py proper, D3 and D5 are actually GPIO sequential (link and screenshot):
https://github.com/adafruit/circuitpython/issues/5334
This seems like a potential location for the rotary encoder, if you can do a fake ground on D10 for the push-button.
Unfortunately, between my D3/D4 attempt, and moving the bridging wire from D4 to D5, my board doesn't seem to be recognized by Windows any more (have tried unsoldering everything, and boot mode, to no avail) (and it was a comparatively clean, cool, and successful desoldering and resoldering, so not sure what's happening with that). 😄 Regardless, I haven't been able to run help(microcontroller.pin)
, nor test the concept.
In the meantime, thanks for the update to use fakerotaryio, I'll check it out when my new board shows up 😠(I bought 2 so I can put header pins in one and prototype on a breadboard this time!)
@adalovebass looks like you're running Adafruit QTPy firmware on that XIAO. They're pretty different internally, I'd recommend installing XIAO RP2040 CircuitPython
Thanks for lookin' out for me! To clarify, I am running the firmware you linked, the output of the help(microcontroller.pin)
command was not my own, but from a QTPy user in the linked thread, which supports my hypothesis about pins D3 and D5 being sequential. I'll run it on my own board to make sure, or to find a similar pattern, when I get my replacement board :)
@adalovebass ahh got it! In the XIAO pinout diagram, the gray labels are the chip GPIO pin numbers and it's those that must be sequential. (e.g. D3 & D5 are GPIO P29 & P7) It's confusing and I've been bit by it multiple times too, with both rotary encoders and I2S audio. And it doesn't help that rotaryio
's error message isn't clear on this even with the fix (most users I think don't get the difference between silkscreen pin names and GPIO pin names)
Oh gosh! :D Yeah, the message about GPIO pins meaning "micropython pin numbers" was certainly not clear! But it does seem like D10 and D8 would be sequential, as their micropython pin numbers are P3 and P2. I figure I can get D9 to do the "fake ground." Then I see your code uses MISO and MOSI (shared with D8 and D9) for the Neopixel Ring and Rotary Encoder's button, but I am pretty sure those can use any digital pin based on some other example I've seen. I'll let you know if I find a solution that works with the standard rotaryio library. I really appreciate you sharing your expertise, and hope this is all still relevant to this ticket :)
So I did find a solution that works:
+--------+
LED Din--|D0 5V|--LED 5v
|D1 G|--LED G
|D2 3V|
+-|D3 D10|-+
| |D4 D9|-)-+
+-)-|D5 D8|-)-)-+
| | |D6 D7| | | |
| | +--------+ | | |
| | XIAO RP2040| | |
| | | | |
| | Rotary Enc | | |
| | +------+ | | |
| +--|SW1 A|--+ | |
| | G|----+ |
+----|SW2 B|------+
+------+
Code changes:
Since I have limited storage space I manually added these to /lib directory:
Zip file with libraries here: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20231013
Specifically I used the 8.x bundle from there (direct link here: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/download/20231013/adafruit-circuitpython-bundle-8.x-mpy-20231013.zip )
Of course the .stl's won't necessarily fit, as the USB port and encoder knob are now on opposite sides of the board. BUT, it's possible to run this on the XIAO RP2040, using the elegant direct-mounting-of-encoder-to-board solution!
le. main.py output: Traceback (most recent call last): File "main.py", line 30, in
RuntimeError: Pins must be sequential GPIO pins
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.