I built my first Raspberry Pi Compute Module 4 project. A 1TB NAS Drive using an NVME drive.
CM4 with NVME on PCIe Connector
These are the required parts:
|CM4 2GB RAM 32GB eMMC||Raspberry Pi Compute Module 4 CM4102032||$55
|Carrier Board||Raspberry Pi Compute Module CM4 IO Board||$35
|Power Supply (various sources)||12 volt minimum 1.5 amps, 5.5 mm barrel plug||Had one laying around. Maybe $10-$15
|PCIe to M.2 Adapter||Xiwai Low Profile PCI-E 3.0 x1 Lane to M.2 NGFF M-Key SSD Nvme AHCI PCI Express Adapter Card||$8
|NVME SSD||SAMSUNG 970 EVO Plus SSD 1TB, M.2 NVMe ||$109
Let’s talk about the parts somewhat.
I’m writing this blog because of something I learned the hard way and that I just did not understand. I, of course, hopes this helps someone else.
I just start playing with the Raspberry Pi Compute Module and Carrier boards and I recently received the Official Pi IO Board for the Compute Module 4. I decided the first thing I wanted to do was make use of the PCIe slot on the board.
And that’s where the trouble began.
There are LOTS of great web pages on Pi Carrier Boards and PCIe configuration but this issue slipped me up for over a day.
I ordered an NVME adapter and a Samsung EVO 970 Plus NVME drive and the adapter arrived first. So I decided to go ahead and get it set up and ready for the NVME drive.
And this is really where the trouble began.
The Raspberry Pi debuted on February 29th, 2012. Wow, has it been 10 years already? Makes me feel old.
The original concept of the Pi was to teach British schoolchildren how to program and code. What really made it stand out was the COST which was $35. It also used Linux which meant it was relatively fast and ran on limited resources. The original Pi had some bottlenecks, especially around USB and Ethernet but it did all work and at a $35 price tag it was ripe for hacking and that’s just what the geeks did.
My first Pi was a breeze to set up and my first project was something called Logitechmediaserver (LMS) and Squeezelite which was a streaming media server and client for Pandora, Spotify, and a now defunct music platform called MOG. A comparable platform these days is something called Sonos. I challenge you build a Sonos System for as cheap as you can build an LMS server.
If you plugged in a Digital to Analog Converter (DAC) to the USB of the pi you could stream to any stereo aux input. To this day I have several Pi LMS clients in my house. Our current house has built in speakers all over the house and we can stream anything we want to them. Right now I just use Spotify and TuneIn. They have since added Tidal to their lineup as well.
I got my first Raspberry Compute Module 4 and installed it in a Geekpi CM4 Router Board. And then cue the fun. It is cool but it isn’t quite ready for plug and play prime time. It was quite a challenge to get everything running.
First of all there are several images to download on the GitHub page and I just wasn’t sure which one to use. The image that supposedly allowed the OLED display to work somehow or another didn’t have a working ETH1 wan port after installation. A router without a wan port isn’t worth a shit and it sure isn’t a router. Pardon my French.
So then the image with the ETH1 wan port working didn’t have a working OLED display. FML. In the great scheme of things the OLED being functional isn’t that important and that’s the direction I decided to go. Then I figured out how to get the OLED on which is a hack.
Here’s how it happened:
I bought my 1st Raspberry Pi when the 1st version came out. I think my intention was to make a streaming music server out of it, which I did using logitechmediaserver. Logitechmediaserver is a MUCH CHEAPER implementation of Sonos. You’ve heard of Sonos, right? Ever since them I have used the Raspberry Pi for all sorts of things. Off the top of my head I can list:
- Music Server
- File Server with Samba
- Temperature and Humidity Platform (with added sensors)
- Hot Tub Hot Water Sensor and Alarm
- 433 MHz Weather Station
- Motion Cameras
- NAS Server with OpenMediaVault
- Dakboard (showing news feed, weather, calendar, etc)
- Police Scanner with OP25
- Streaming police scanner with IceCast
- Home Assistant for Home Automation
- Software Defined Radio Spyserver
- PiAware for tracking aircraft
- Satellite Tracking
- 3D printer server with Octoprint
- CNC G Code Sender
- Kodi Media Server
I bet you that I’m missing a whole lot of stuff too. That’s all I could think of quickly. But that’s a lot. Raspberry Pi variants have served me well over the years, helped teach me Linux, and is still a workhorse around my house.
So why would you get a Raspberry Pi in a Compute Module footprint? I’ll try to answer that.
I have been using the Raspberry Pi since it was 1st generation. But I bought my very first Raspberry Pi Compute Module 4 along with a cheap Carrier Board . There are all manner of cool carrier boards. Just there is one problem. You can’t actually buy any of them. Supply Chain issues and stuff. LGB.
And that extends to the Pi Compute Module as well. There are a bunch of them……..but you can’t get ’em.
About the only one you CAN get right now is the CM4102032 with 2GB of Memory. Here is the data sheet for the CM4’s.
While it has an SD card slot (TF card slot, actually)………you can’t boot from it. Well, that’s new.
The eMMC memory has to be written to directly. Let me show you how.
UPDATE Jan 31 2021: I updated from Pi OS Buster to Bullseye which broke the Geekworm fan control. The only way to get it going again was to do a fresh installation.
This was a fun albeit unnecessary project that costs a few bucks. I wanted to build a small portable NAS around a Raspberry Pi 4.
I ended up buying parts to create a polished, professional looking solution that utilizes a SATA 2.5″ SSD. Here are the parts I bought:
This is a good looking case and I obviously have the front panel off of it for this picture.
There are a few things you need to know about this set up though. It may or may not be the solution for you.
First the case fit and finish is beyond exceptional. The SATA board is excellent for mounting the SSD on the bottom side and pogo pins make the appropriate connections to the Pi.
Make no mistake though. The SSD is connected via the USB 3.0 bus. And herein lies the rub.
So once I needed to add some storage to a Pi and I opted for an SSD. I added the SSD by installing a USB 3.0 to SATA adapter. It was a good solution for the price but configuration was somewhat involved.
But now Raspberry Pi OS supports SATA devices natively. That allows you to connect via a proper SATA add on board from Geekworm instead of a USB SATA device. At $30 (not counting a case, power supply, and Power Management with Safe Shutdown add on board which costs all total around $100).
What you gain here is the ability to boot the Pi from the SSD drive and not the SD card. This speeds things up. A LOT. You could take this device and install Plex and have your very own portable media server that you can travel with.
I’m not doing that here as I want to use 100% of my SSD drive for a SAMBA share. This gives me a terabyte (or more if I get a larger capacity SSD) of network attached storage. And while this isn’t a proper NAS with an array of drives, it is still pretty cool. You can never have enough network attached storage and you can use this device for specific tasks. In fact I was going to put Handbrake on it however there is no docker image for armhf7 for handbrake. Still, you get the idea. You can run any docker image and have it do a task or just be network attached storage. Or as I suggested above use it as a traveling media (music, movies, shows) server.
Pirate Audio Line Out Device
Here’s a fun little project. This is the Pimoroni Pirate Audio Line Out Device . Pimoroni sells several devices including a 3watt amp, a speaker, and a headphone amp but I chose the Line Out Device for home stereo use.
You could make a headphone amp and power it from a small charging brick and with a wireless Raspberry Pi (Pi Zero W) you could use your phone as a hotspot and have the most original “Walkman” on the block.
So what you need essentially is:
- Raspberry Pi – Get the Pi Zero W (W = WiFi) – links just below
- Pirate Audio Line Out Board
- SD Card – I use SanDisk cards 16 or 32 GB
- Micro USB power cable – you have one laying around already
- Y adapter cable to hook Line Out to your stereo.