cujomalainey / antplus-arduino

An Implementation of the ANT+ Network on top of ant-arduino
GNU General Public License v2.0
145 stars 24 forks source link

Will this work with the ESP32? #29

Closed bsperryn closed 3 years ago

bsperryn commented 3 years ago

Hi, I've read that the ant arduino only with this the NRF51/52, but this library is said to work with all architectures, so does it work with the ESP32?

cujomalainey commented 3 years ago

Hi @bsperryn,

Yes you can use this with an ESP32 with an external nRF52/51. Dynastream only supports nordic chips to run their radio firmware so you have to have a nRF52 somewhere to actually use ANT. The reason all archs are supported is because nRF chips directly from Dynastream come loaded with a serial/spi interfacing driver (called the network processor) so you can communicate over serial with the radio. (see in ant-arduino *SerialAnt vs *NativeAnt (ignore the comments in NativeAnt header, i realized it is a copy paste error) Typically in my testing I use a Huzzah32 (aka esp32) with this nifty board an old roommate made for me with the ArduinoSerialAnt driver from ant-arduino. If you are not using the feather ecosystem and are just breadboarding you can grab a D52 dev module (an nRF52 just preloaded with ANT) and just wire your communication pins directly. Another option (with a bit of fiddling around to replace the radio firmware) you can use something like the Feather nRF52840 Express and use ArduinoNativeAnt and use ANT via the onboard radio firmware.

Hope that clears things up, let me know if that answered everything or if you have anymore questions.

bsperryn commented 3 years ago

Thank you! Would I also be able to use the BLE at the same time with the d52 dev or separate board?

cujomalainey commented 3 years ago

If you use the ESP32 you can use the ESP's BLE. If you program the nRF52 directly you can load firmwares (s340) that support BLE+ANT.

cujomalainey commented 3 years ago

If you have any questions feel free to post to the google group or reopen this bug

hayschan commented 1 year ago

I am familiar with the ESP-IDF framework, and the ESP32-S3 and ESP32-C3 MCUs. Planning to use them to build some open source ANT+ sensors for cycling, e.g. cadence, speed, lights.

Does this library support ESP-IDF?

cujomalainey commented 1 year ago

@hayschan not currently but it should be very easy to implement. You just need to add a shim for what type of port you are using.

E.g. Arduino serial is less than 40 lines of code. If you want to use antplus-arduino you will also need to add the callbacks class another like 5 lines of code.

I tried esp-idf a long time ago but couldnt figure out the pin mapping and got distracted by something else, if you are willing to send PRs I will happily review and integrate them.

hayschan commented 1 year ago

What is the relationship between antplus-arduino and ant-arduino?

Just saw the dependency relationship. I understand now. I will try it on my ESP-IDF hardware first.

if you are willing to send PRs I will happily review and integrate them.

Yeah sure.