Abstract2actual
  • Home
  • Blog
  • Gallery
  • Buy stuff
  • Contact
  • About

Upgraded to Raspberry Pi 4 Model B

9/30/2020

0 Comments

 
      After four years of running OctoPi on my Raspberry Pi 2, I decided it was time for a hardware upgrade.  There's really nothing wrong with the old machine, except that I'm a few versions back on Octoprint because I've been reluctant to upgrade Python.  Having a new machine gives me the ability to play around with the new stuff without losing the basic capabilities I currently have.  The upgrade was a bit tedious because the original PiTFT package for the power off button is no longer available.  Of course I didn't find that out until after I disassembled the old Pi. The good news is that the PiTFT installation is a lot simpler thanks to the upgraded drivers from Adafruit. It turns out that I didn't need the power off package, because I was able to leverage the python script for the buttons.  Below the slide show, you can read how it all went down.
       I bought a brand new Raspberry Pi 4 Model B (2Gb), PiCam v2-8 Megapixel camera module, heatsink kit, and USB3 cable from Amazon.  There are some differences between the Pi 4 and Pi 2 that I noticed right away.  First, the board layout and external connections are very different, so the old case was not going to work.  I also noticed that the Pi 4 runs quite a bit hotter than the Pi 2, so I ordered a cooling fan.  I wanted to connect the fan to GPIO pins 2 & 6, but the PiTFT takes up the lower 2/3 of the GPIO so I also had to get a 26 pin flat ribbon cable to take advantage of the output jack on the bottom of the PiTFT.  I cut off all but 4 of the wires on the ribbon cable, leaving wires for pins 1, 2, 4, & 6.  I'm only using 4 and 6 to power the fan, but kept 1 & 2 in case I find a use for 3.3v and 5v power in the future.  I soldered the red fan wire to pin 4, and the black wire to pin 6. and plugged the connector into the PiTFT output jack.
      I modeled a new case in Sketchup that accommodates the Pi 4B connectors, the fan, and a folding camera mast.  The case also needed vents which I created in 3D text with the name of my big printer, X3REX. I blinged it up by turning the hole in the "R" into a D and I printed that in a contrasting color, just for fun.  I also liked the idea of yellow and magenta, as if it's radioactive. Routing the fan wires to prevent them from hitting the fan took a few attempts and changes in the case design, but ultimately, I got them out of the way.  The new case design is available on Tingiverse.   I assembled everything and got ready for the software installation.
      I chose to just download a system image from Octoprint.org as the basis for this project. Just follow the installation instructions on the Download page to create the bootable microSD card and configure the network.  I put the SD card into the Pi and booted it up and was happy that no smoke came out.  The Octoprint image is for a headless system, so there was just a login prompt on the display.  I plugged in a keyboard and mouse, logged in, and moved on to install the PiTFT drivers.  As I stated in the opening paragraph, it was much easier than it was 4 years ago.  Since the operating system is already installed, you can jump down to the Installer script section of the Adafruit PiTFT Easy Install page.   The installer walks you through display selection, screen rotation, and if you want to the console to appear on the PiTFT rather than HDMI output.  If you mess this up, don't worry, just run the script again and choose the correct configuration.
      Getting the tactile buttons to work was a whole different story since the Adafruit site doesn't have any information on this any longer.  Fortunately, I had that in my earlier blog post, so I simply copied the python script and updated the /etc/rc.local file to run it at boot up.  But it didn't work! I took a look at the file and saw that it was trying to execute  os.system("sudo sh -c \"echo '0' > /sys/class/gpio/gpio508/value\""),  which was not a valid command.  I went back to the Adafruit site, digging deep into the PiTFT support documentation and found a page on Backlight Control.  Here i found that turning on and off backlight was accomplished with sudo sh -c 'echo "1" > /sys/class/backlight/soc\:backlight/brightness' .  I replaced the lines in my original python script with these lines, and button 3 on the PiTFT now switches the backlight on and off.  Since the original power down script no longer worked, I edited button 1 in the python script to execute sudo halt.  The new python script and instructions are available on my GitHub project.
0 Comments
    View my profile on LinkedIn

    TJ Emsley

    Lifetime tinkerer.

    Archives

    October 2022
    January 2021
    November 2020
    October 2020
    September 2020
    February 2018
    January 2018
    January 2017
    October 2016
    August 2016
    July 2016
    June 2016
    May 2015
    April 2015
    March 2015
    February 2015
    December 2014
    October 2014
    August 2014
    July 2014
    May 2014
    April 2014
    March 2014
    November 2013
    October 2013

    Categories

    All
    3d Design
    3d Printing
    Open Source

    RSS Feed




Proudly powered by Weebly