From MalinWiKi
Revision as of 15:10, 15 December 2018 by Roy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is work in progress

Raspberry pi with touchscreen and octoprint

I found an old el-cheapo LCD for Raspberry Pi with resitive touch, something like this. Lacking something else to do, with -10°C outside, using a pi with OctoPrint with a touchscreen seems like a decent thing to do. For something close to production, you'll probably want capacitive touch and perhaps something larger than this, but hell, I'm bored.

Stuff needed

  • A raspberry pi model 2 or higher. The old 700MHz model 1 has too little CPU and memory - the others will do. As always, you'll need a power supply giving you 5V and at least 2A, preferably closer to 3A.
  • A Micro SD card, 4GB or larger - preferably 16-32GB since you'll probably use it to hold some gcode files as well.
  • A chassis for the pi and the touchscreen. If using the mentioned screen, something like this should do. All you need is access to a 3d printer, filament and some time.
  • Access to a PC and a SD Micro card reader.
  • A USB cable to be connected between the pi and the 3d printer. With my Ender 3, it's USB A <-> USB mini, but it may vary.

Initial setup

Download the latest raspbian lite, unzip it and dd it onto the SD card. To find your SD card device from Linux, run lsblk and to find it with macOS, run diskutil list. With Windows, search the net to find some tool to save the planet for you. Once downloaded, unzip the file and you're ready to create the boot image. Replace the X in the device name with the appropriate letter on your machine and don't blame me if you overwrite your harddisk with rubbish, and substitute 2018-11-13-raspbian-stretch-lite.img with the name of the file you downloaded.


# dd if=2018-11-13-raspbian-stretch-lite.img of=/dev/sdX bs=1M status=progress


# dd if=2018-11-13-raspbian-stretch-lite.img of=/dev/rdiskX bs=1024k

Note that using /dev/rdiskX instead of /dev/diskX on macOS speeds things up a lot because you bypass the system buffer, which for some reason slows things down badly.


If using cabled networking, just connect it and wait for it to get an IP address. If running headless (no monitor/keyboard attached), make sure to create an empty file ssh under the /boot directory (that little FAT partition on the SD card) to have it enable ssh. If using wifi, add another file to the boot dir, wpa_supplicant.conf, containing

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

I trust you'll find the pi's IP address easily by nmapping the network or similar if using a headless pi.

Install the pitft stuff

Below is a short script to download and install the parts you need for the touchscreen to work. It's ugly, but it works.

mkdir ~/pitft.tmp
cd ~/pitft.tmp
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
chmod +x adafruit-pitft.sh
sudo ./adafruit-pitft.sh