Iteration continues, and I've reached some design points which I think are interesting.
In the
reef-pi megathread I called out the idea of using an expansion system based on the commonly available microcontroller platform in addition to the MCP23017 I2C I/O expanders for more GPIO, as it would also gain analog and PWM capabilities in one shot. Specifically, we were looking at the Arduino Zero (ATSAMD21G) derived controllers.
As I'm looking at what I/O I'm exposing, and based on testing, I2C over longer lengths starts to become more problematic (and random flakiness can be pretty frustrating), especially when I2C is routed near higher power wires around LED lighting and pump controllers. It works in HDMI cables as they're shielded, but not everyone is going to have shielded cables (would have to use ... USB cables, or HDMI, but they're thick and somewhat frustrating).
I wanted to originally expose this using a CAN bus UART interface, stealing some ideas from the APEX line. CAN is pretty robust over quite a distance, and has a much higher tolerance to electrical issues as its a differential bus. The problem is of course, the hardware here would be entirely custom.
Then, looking at the Pi hardware, it somewhat hit me:
USB. We've been entirely ignoring USB. Pretty much any modern cheap microcontroller has USB capability, its plug and play, it provides auto-detection of new hardware, and we can make it use easy USB device classes like the USB CDC (Serial Port) to make it look like other hardware. USB also means we can actually use the I/O modules on hardware beyond the Pi (not that someone would want to do that, I mean it is called Reef-Pi after all ;)).
The biggest hurdles:
- USB does require hubs if you want more than one device.
- USB is 5V only and the Pi can't supply a lot of power on the USB downstream ports
We can avoid making a wiring mess with hubs by actually baking an optional 2-3 port USB hub into each product. The cost for a standard USB 2 hub parts is surprisingly... low.
The current limit means we do need to bring in extra power for things like extra relay control, but 0-10V analog products can be easily run off a small boost converter as they're very low power.
I'm still going to break out I2C on a header, but looking at turning any functional extension devices into USB devices instead.