I thought I would make an attempt at inserting a Raspberry Pi Zero W into the serial communications line between the Raspberry Pi 3 and the RAMPS board. "Why would you do such a thing?", you might ask. Well, that's a good question...
If I can get this serial-to-serial gateway to work, then I hope to do some interesting things with it. The Raspberry Pi Zero W isn't too expensive at $10 plus the perhaps $8 for the microSD card and another perhaps $5 for a USB cable. And yet, why would I want to spend another $25 on my rig like this?
Because it will be interesting, I suppose. Maybe something big could come out of this.
[x] Get a Raspi Zero W, micro USB cable, 4GB microSD card and Raspbian Stretch Lite image
[x] Set it up in
dwc2 mode, remote in, configure things initially, setup wi-fi and change hostname
[x] Get a Raspberry Pi 3 B as test rig, power adapter, 16GB microSD card and OctoPi image
[x] Set it up, remote in, configure things initially, setup wi-fi
[x] Connect the two via GPIO pins and test with minicom to verify that this part works
screen so that I can setup a monitor to watch the Zero's output and adjust the resolution
[x] Adjust the settings manually in
~/.octoprint/config.yaml to select
[x] Confirm that OctoPrint will attempt to connect to the Zero when the Connect button is pressed and that the Zero sees this in the
[x] Install Node v8 on Zero and express-generator
[x] Scaffold Node JS app with
raspi-serial as dependencies, console.log()'ing inbound serial
[x] Send serial data from Raspi3 via GPIO pins 8/10 to the new service
[x] Connect in the RAMPS board and do and end-to-end test with OctoPrint
[x] Move the rig to the printer for a full test while printing
[x] Modified encryption method to accept Ethereum transaction hash and MAC address of recipient, modified decryption method to read transaction hash from file and to determine its own MAC address, both methods now generate new combined hashes for the cryptography involved
[x] Introduced new GCODE M888 command for communicating transaction ID
Not bad so far. I seem to have the Zero as a communications endpoint for OctoPrint, at least.
|Raspi3||Zero||RAMPS||<-- 24V Power Adapter|
|PWR <--||------------------------------||-- 5V pins|
|GPIO <--||--> GPIO|
|"USB" <-- adapter <--||--- Type B cable|
|USB -----||-------> "PWR"|
|micro HDMI --> display|
With the barest code of all, it appears to be working.
Perhaps you can tell from the wiring what's going on. At the moment, I have to throttle the GPIO-based serial to 9600 but that's not a big problem, to be honest since this is just a prototype.
There's a small glitch in that when OctoPrint disconnects it just basically ignores the RAMPS board rather than to issue an "M155 S0" before doing so. Other than that, it's reasonably well behaved.
I just moved the rig to the printer and it successfully printed a six-minute part. I worked on the web interface a little but it's nothing too fancy.