A Hobbyist's Journal
So it turns out that all the effort to get the servo and sensor off to another processor, the Trinket, was not needed.
I had forgotten that the encoder signals can be processed using pin interrupts, which is the recommended way to do things. When I was first implementing the encoders, on a different bot, availing of the pin interrupts was not possible so was forced to used a timer interrupt to sample the encoders instead.
For the Zumo build the pin interrupts are available and I’ve reimplemented the encoders accordingly. The result is that the pin interrupts work perfectly and do not cause problems for the rest of the system, unlike the high frequency timer interrupt which was eating up all the CPU cycles. So problem solved with much less effort than adding the second processor.
Still, having the option to off-load the servo and sensor may come in handy if there is a need to free up pins on the Arduino. It was also great to have an excuse to play with the Trinket.
Feeling much better about using the Arduino for the rest of this project.
You can view all the code on GitHub.
Purchased an inexpensive Bluetooth transceiver module from Amazon. Just got it today.
Doesn’t get any simpler than this device. Just plug in 5V, GND, Tx to pin 0 and Rx to pin 1, fire it up and pair it to your computer (type in 1234 if asked for a code).
For now I just stuck it on the rear of the bot.
Eventually I’ll figure a better location for it.
And the timing is perfect. I’m in the process tuning the PID controller. Before this would mean having to tether the bot to my laptop and follow it around to collect data. Now the laptop stays on the desk and collects data untethered. It’s surprising how nice this is. Definitely my favorite piece of kit so far.
Also thinking about creating an app that acts as a remote UI, over the serial link, so that realtime data can be collected and displayed, and even provide simple inputs/settings to the bot. Maybe such an app exists already. I’d much rather that than mess around with an LCD display.