adafruit / Adafruit_CircuitPython_Crickit

Convenience library for Adafruit Crickit robotics boards
MIT License
11 stars 11 forks source link

Add rotary encoder support? #13

Open zlite opened 5 years ago

zlite commented 5 years ago

The natural compliment to the motor API is a way to read quadrature encoders with the Adafruit Crickit RPi hat. Can that be added?

ladyada commented 5 years ago

there is rotary encoder support (like mechanical style) https://github.com/adafruit/seesaw/blob/master/include/AOEncoder.h but it hasn't been integrated. if anyone has time and wants to try compiling it into the SAMD chip and use two of the IO pins, it might 'just work' :) no ETA from us on when we'd get to it.

FoamyGuy commented 4 years ago

Does rotaryio solve this issue? Or is there a need for something more specifically inside of the Crickit library?

caternuson commented 4 years ago

In order for it to be taken care of by the Crickit hardware, it would need to be in the seesaw firmware. The only connection between the host and the Crickit is via I2C to the seesaw chip on the Crickit:

[host]--i2c--[seesaw]-[peripherals]

Since rotaryio is interrupt based, it wouldn't work over the I2C provided GPIO pins of the Crickit. Also, there is no rotaryio support in Blinka.

The capability would first need to be added to the seesaw firmware. Then, this library could be updated to access that new functionality.

FoamyGuy commented 4 years ago

Ah I see, thank you. Adding it to the seesaw firmware is probably a bit over my head at this point I think.

geekguy-wy commented 4 years ago

Am I correct in thinking that the seesaw firmware is in C/C++?

I would love to see quadrature encoder support added, but it does not necessarily need to be added to seesaw. Adding this to CRICKIT would make it a required addition if one just wants the quadrature encoder support. I would like to see this be usable for more than just two motors.

dhalbert commented 4 years ago

Yes, it's in C++: https://github.com/adafruit/seesaw. Feel free to add an issue.

geekguy-wy commented 4 years ago

To be fully useful the quadrature encoder support would have to be added in two places. It would need to be added to seesaw as well as to some library outside seesaw, like MotorKit. It should be usable with two-wheeled as well as four-wheeled or more-wheeled machines. Is there possibly a way that a quadrature encoder could be attached to a specific wheel or other rotatable device?

This could be added into rotaryio in order to be globally accessible from any other library or application. There are other places, besides a machine's locomotion wheel motors, where quadrature encoders could be useful.

geekguy-wy commented 4 years ago

Maybe this issue should be retitled to "Add quadrature encoder support."

tyeth commented 1 month ago

Seems like the seesaw library supports rotary encoders now, so this could be possible. I'm interested due to messing around with the crickit featherwing for the first time, and combining with the bluefruit connect remote control method via a learn guide of John Parks. I've got a websockets version that supports web workflow boards at https://github.com/tyeth/serialfruit-connect-bookmarklet with a plan to support USB-Serial and BLE too through the browser.