I’m on a journey to drive an EEZYbotARM with Rust. I have no idea what I’m doing. I’m learning electronics, rust, and the Embassy framework at the same time. This is probably not the best way to learn. Here is a link to my github repo such as it is.
2024-04-09
If you want to follow along, you’ll need a Pi Pico and a Debug Probe (or second Pico flashed to operate as one).
I picked the EEZYbotARM MK1 because it is made with the cheapest servos you can find and I happened to have 5 of them already. This is fine for me because I’m just looking for a platform to throw code at. There are more robust robot arms out there if that’s what you’re looking for.
Programming the pico
Cargo is set up such that cargo build
will automatically upload your compiled
code to the pico so long as it and the Debug Probe are connected. If either are
absent, it won’t work.
Next actions
- learn how to drive a servo with embassy
- I’ll use PWM, but will I use it directly or is there a lib/crate/utility to simplify the process?
- learn how to serve up a web interface on the pico w
- learn more about OTA firmware updates
- write code to move a servo based on the potentiometer values
This is a big wad of stuff I don’t understand
bind_interrupts!(struct Irqs {
ADC_IRQ_FIFO => InterruptHandler;
});
What is that bind_interrupts
macro about?
This defines the right interrupt handlers, and creates a unit struct (like
struct Irqs;
) and implements the right [Binding
]s for it. You can pass this struct to drivers to prove at compile-time that the right interrupts have been bound. —embassy source
What is Irqs?
The struct says:
Type representing a PIO interrupt
Ok, but what is PIO?
PIO is a standardized way to communicate with tech that doesn’t support protocols such as SPI and I2C. It’s a more formalized and performant means of bit banging. The “What is PIO” video went so far as to call out PIO is good for controlling robot arms. Sounds like I need to follow up and read [this hackspace] article(https://hackspace.raspberrypi.com/articles/what-is-programmable-i-o-on-raspberry-pi-pico).
Resources
- ADC example code (embassy source).
- Peripheral Trait (embassy docs)
- EEZYbotARM
- What is PIO (raspberrypi.com)
- What is Programmable I/O on Raspberry Pi Pico? (hackspace).
Published by Ryan Parsley