Close

Side-Hack: Connecting a Raspberry PI/Octoprint Directly

A project log for Monoprice Mini Marlin 2.0 Support

Getting Marlin to run on the Monoprice Mini/Malyan M200.

jc-nelsonJ.C. Nelson 05/26/2019 at 18:331 Comment

This began as an answer to the question "Is there any other way to hook up Octoprint that doesn't involve USB?" 

Why? Because the person in question had discovered that if one steps on the usb connector, it will transmit the force upward, outward, and other-wards. In the words of my 2 year old daughter, it "badded" the connector.  

Now, those with nimble fingers and usb-electron-robo-soldering irons will easily repair the port, sometimes even soldering on a different size/type. Not me. Soldering to the debug pads on a V2 is a complex operation for someone as shaky as I am. But there are other options. While I acknowledge that the Raspberry Pi Zero W isn't recommended for octoprint, that's primarily because of slowdowns when streaming video.  On this particular board, I had no LCD, so why not take the opportunity to make an all-in-one?

To do this, you'll need a Raspberry Pi Zero W (if you're going to attempt this with a B, A, or anything else, go ahead and wire up a power supply.

Some form of cable to connect it. - If your LCD works or you ever intend to replace it, a JST kit  in like SPH-001T in either P0.5L or P0.6L depending on whether or not you have a V1 or V2 (V2 uses the narrower pin connection).  See https://mpselectmini.com/parts/wire_connectors for a good breakdown of connectors and sizing. If your LCD is dead and you're never, ever going back, you could cut the display cable (shudder!) and use it.

To plot out our wiring, refer to https://pinout.xyz/pinout/pin1_3v3_power

It turns out, we can power the PI directly, feeding it 3.3v. The PI will report it's underpowered, since the 5v side isn't being supplied, BUT, it behaves fine in my testing, and since the 5v exists to feed the 3.3v regulator, we're probably fine. 

Probably. Proceed at your own risk.

Now, we need four things to power the PI and communicate: 3.3v power, which the display header gives us, Ground, which the display header gives us, TX, and RX, which...the display header gives us.

To begin with, setup OctoPi on your raspberry PI and ssh to it.

We need to enable the mini UART for serial in order to gain access to /dev/ttyS0 (the mini UART). Follow the instructions here:

https://www.raspberrypi.org/documentation/configuration/uart.md

Specifically, you want to run:

sudo raspi-config

Select option 5, Interfacing options, then option P6, Serial, and select No

You want login not running on Serial, and Serial enabled.

Exit raspi-config, saving changes, and reboot the pi.

Next, in the octoprint UI, choose the wrench, setting, and add the ttyS0 as an option:

If you are not running Marlin, you can try adding 500000 as a baud rate. There's a decent chance Octo will connect to the /dev/ttyS0 device at 500000, but I am running my own sotware, so I didn't need to do this.

Now, wiring:

If the display connector is closest to you, with the bed/hotend connectors away, power is on the left of the connector, ground on the right, and TX/RX are in between. A picture is worth more though, so see how this is run:

Wtih that done, a quick "connect" and I had Octoprint working straight through the display. And yes, it works perfectly well if I swap it out to the Serial2 connector above the MCU, allowing you to use both the LCD and Octoprint directly. Wifi printing does NOT work in this configuration. Marlin supports two Serial instances, and Wifi printing consumes one with its pass-through serial.

Discussions

Dzor wrote 02/21/2023 at 21:18 point

The second serial that has exposed tap points doesn't seem to be active in the stock 29.42 firmware. Octoprint and display doesn't function using it. Maybe it's there to flash the chip in the factory.

  Are you sure? yes | no