I’m excited to announce a new training I’m conducting at the upcoming NERD Summit at UMass Amherst on March 18, 2023.
Microcontroller Introduction with Raspberry Pi Pico is for beginners interested in home automation, robots, or IoT (Internet of Things). Microcontrollers are the brains behind most electronic devices. They are everywhere; in your washing machines, cameras, security alarms, smart devices, traffic lights, and more. The Pi Pico is Rasberry Pi’s microcontroller development board that makes learning this technology accessible and affordable.
Training Overview
This three-hour training combines lectures and hands-on with a Pi Pico. Topics covered include:
Basics of a microcontroller
Capabilities and features of the Raspberry Pi Pico
Ways to use a microcontroller in your home
Basic electronic and physical computing concepts
How to control the Pi Pico using Micropython
How to write simple Micropython programs and install them on a Pi Pico
Hands On
Students will use a Pi Pico to control LEDs and sensors using Micopython. Experience will include:
Installing and getting familiar with the Thonny IDE
Writing Micropython programs
Wiring a breadboard to connect a Pi Pico to LEDs and sensors
Setuping up Pi Pico to execute Mircopython
Copying files and libraries Pi Pico
Finding and using sample programs for online resources
Each student is provided a starter kit with a Raspberry Pi Pico, breadboard, wires, resistors, LEDs, and sensors. These kits are available to take home for a small fee
Cost
The NERD Summit includes training for free with conference registration. And the conference registration fee is ‘pay what you can’. The recommended fee is $50 for three days, but you can pay any amount, including $0.
There is a suggested donation for ticket purchase to help pay for the event and support NERD, for those who want to donate and can afford it.
NERD Summit Registration.
A three-day conference with sessions, training and meals for $50 (recommended price). This is truly accessible for all. I orignaly
The NERD Summit
With its original roots as a Drupal conference, the NERD Summit is now a general technology conference whose mission is to provide ‘positive and supportive learning opportunities for people who work, or want to work in web and related technologies in the New England area.’
This three-day conference has presentations, panels, discussion groups, and training. Topics covered include:
Accessibility
Coding
Maker / Lego
Professional growth
Project management
and more
When and Where
March 18,2023 – UMass Amherst. Seating is limited, register early! Learn more about NERD Summit.
It’s possible to develop Drupal websites on a Raspberry Pi, and the performance is pretty good considering the specs of this sub $75 computer.
While I expect no professional Drupal developers are using a Raspberry Pi as their primary development environment, everyone starts somewhere. If a computer like a Raspberry Pi is all someone has, they can begin a Drupal career and someday earn, at least, an hourly rate equal to the cost of a Raspberry Pi.
This post details the steps to install DDEV, Docker, and a Drupal 9 website. DDEV is an open source tool that makes it dead simple to get local PHP development environments up and running within minutes. You can follow the written steps and watch along with the video below.
NOTE: I wrote this post many months ago but decided not to publish it. Running Drupal via DDEV requires a 64-bit OS, and Raspberry Pi OS’s 64-bit version has been stuck in beta for a few years. In my experience, alternative 64-bit operating systems available for the Pi were not stable enough to recommend. Yesterday, the 64-bit version of Raspberry Pi OS was released. I successfully retested the installation steps in this post with the 64-bit OS. It’s time to publish.
Requirements
Raspberry Pi 400 or Pi 4 B with minimum of 4GB RAM
Micro SD
Desire to learn
The steps below will install DDEV, Docker and a Drupal 9 website.
64-bit OS
A 64 bit OS is required to install DDEV. Start by downloading a Raspberry Pi OS 64 image to a Micro SD with Imager. If you are not familiar with this process, you can learn more on the Raspberry Pi website.
Pi Imager now includes Raspberry Pi OS 64-bit
After booting your Pi with the new Micro SD, complete the setup process. Reboot the Pi.
USB SSD Drive – For faster, more reliable drive access, consider running your Pi from a USB SSD instead of the Micro SD card. You can find instructions for setting this us at Tom’ Hardware.
SSH Agent Forwarding is used to share ssh keys with a remote computer.
Use Case
You SSH into a remote computer, and from there, you need to access a remote server that requires your ssh keys. A typical example of this is cloning a repository on a remote computer. However, you don’t want to copy your local ssh keys to the remote server or create new ones. SSH Agent Forwarding allows a remote computer to use your local SSH keys without leaving your credentials on the remote computer.
Basic Concepts
SSH Agent: A program that keeps track of identity keys and passphrases. The SSH Agent is needed for Agent Forwarding. You can use SSH Agent to remember your SHH passphrase; therefore, you don’t need to type your passphrase each time you use your private key. This post does not cover passphrases.
SSH Agent Forwarding: A feature of SSH that allows an SSH server on the remote computer to use the client’s SSH Agent to access SSH keys on the local computer.
SSH Agent Setup Steps:
Start the SSH Agent on your local computer
Add your ssh leys to the agent
Connect to the remote computer via SSH with forwarding turned on
Demonstration
In the example below I will share SSH keys with a remote computer to access a git repository.
Verify the local computer has SSH access to Github using the ssh -T command.
SSH into the remote computer and verify it does not have access to Github. On the remote computer, we will receive a ‘permission denied’ error from Github because the remote computer does not have my SSH credentials.
On the local computer, check if the SSH Agent is running by displaying the $SSH_AGENT_ID environment variable. If it’s running, the agent process ID will be displayed. If it’s not running, blank will be returned.
On the local computer, start the SSH Agent using the eval command. On success, the Agent process ID will be displayed.
On the local computer, list SSH identifies assigned to the agent using ssh-add -l. Since the SSH was just started, no identities will be returned.
Add the SSH identities, aka SSH keys, defined in the ~/.ssh folder with ssh-add. The ssh-add command will add all identified in the ~/.ssh folder by default. To add a specific identity, use the -T parameter.
Verify the identities were add by running ssh-add -l
Reconnect to the remote computer with SSH and use the -A parameter to set Agent Forwarding on.
On the remote computer, verify Github is now accessible.
Additional SSH Tip
SSH Config
You may have noticed in the demonstration above, the ssh command does not include an IP address or user name. ssh pi3b vs. ssh pi@192.168.1.10. This is accomplished by using an SSH config file in ./ssh/config:
Host pi3b
HostName 192.168.1.10
User pi
SSH Config can also automatically set Agent forwarding for an SSH connection, removing the needs to pass -A with the SSH command.
Host pi3b
HostName 192.168.1.10
User pi
ForwardAgent yes
As long as I’ve been using SSH, I only recently started using SSH Config.
I have many Linux computers (Raspberry Pis, desktops and laptops) on my local network. It’s difficult to remember each computer’s IP address and username when using SSH. SSH Config allows you to define ssh connection options in one location. Note: SSH Config is available on Mac and Linux when using OpenSSH Client.
Given the following ~/.ssh/config file:
Host pi3b
HostName 192.168.1.245
User pi
Host pizerow
HostName 192.168.1.210
User pi
The SSH command ssh pi@192.168.7.245 is replaced with ssh pi3b .
Common Options
Below is a list of common options used in ~./ssh/config. A full list of config option are available at ssh.com.
HostName – IP address or URI to a remote computer
User – SSH username
Port – SSH port different than the default 22
IdentityFile – Specify a specific key file
ForwardAgent – (no/yes) Allow SSH server access to client SSH Agent for sharing SSH keys
Example:
Host stephencross
HostName ssh.stephencross.com
User sshuser
Port 2222
IdentityFile ~/.ssh/stephencross.pub
Host Matching
SSH options are used for all Hosts that match from top down in the config file. Given the follow ~/.ssh/config file:
Host pi3b
HostName 192.168.1.245
Host pizerow
HostName 192.168.1.210
Host picm4
HostName 192.168.1.234
Host pihole
HostName 192.168.1.134
User piadmin
Host nuc
HostName 192.168.1.196
User stephencross
Host pi*
User pi
Host * !nuc
Compression yes
Host pi* – User is set to ‘pi’ for all Hosts that begin with ‘pi’. Because Host pihole has User define higher in the file, it’s user name is ‘piadmin’
Host * !nuc – Compress is ‘on’ for all Hosts, except Nuc
I’m a Linux desktop user and have been for three years. A driving reason for my switch from Mac to Linux was performance. As a LAMP stack web developer, using Docker-based tools for local development is a must. A nagging problem for developers is the performance of Docker on macOS, specifically file system performance. I share some performance comparisons in the January 2020 blog post, Faster Drupal Development on Linux.
On a recent episode of Talking Drupal, #318 DDEV, Randy Fay, the maintainer of DDEV talked about the DDEV’s recent addition of Mutagen. He claimed DDEV with Mutagen on Mac runs “almost as fast as native Linux.” I had to check it out.
Randy discussing DDEV implementation of Mutagen (5 minutes)
Testing Environment
I configure a newly acquired Mac with an existing Drupal project running locally with DDEV. I also installed this project on my Linux desktop.
Mac mini (M1, 2020) – 8GB RAM – 250GB SSD – macOS BigSur 11.5.2
I followed the steps below with Mutagen turned on and off and ran the test multiple times to verify the results were consistent. I followed the same steps on Linux without Mutagen.
ddev stop --remove-data
ddev poweroff
(set mutagen on or off)
ddev auth ssh
ddev start
ddev mutagen status
rm -rf vendor
time ddev composer install --no-cache
Results
DDEV without Mutagen on Mac:
composer install --no-cache - 4:41.91 total
DDEV with Mutagen ddev on Mac:
composer install --no-cache - 16.602 total
DDEV without Mutagen on Linux:
composer install --no-cache - 13.658 total
Caveats and Conclusion
I only recently started using DDEV after listening to Randy on Talking Drupal, so my experience with it is not much more than conducting this experiment. However, I believe the testing process had enough controls to fairly evaluate a single action; composer install. If I’ve missed something here, I expect someone will let me know.
If you are a PHP developer using a Mac, the results of 4.5 minutes vs. 16.5 seconds demonstrate that DDEV with Mutagen should be evaluated as a local development environment. However, the Mutagen implementation is new and there are some caveats outlined in the Performance Documentation.
While I tested on Apple new M1, I would expect similar results from the Intel line of computers.
I’m glad to have been exposed to DDEV and its helpful community. I will continue exploring a switch to it, even in my Linux environment.
This project uses the Circuit Playground Express to create a visual thermometer. The current temperature is measured and represented with LEDS.
Using Circuit Playground Express is a great way to start programming a microcontroller and components. The Playground Express contains components on one small board; including 10 NeoPixels, motion sensor, temperature sensor, light sensor, sound sensor, mini speaker, pushbuttons, slide switch, infrared receiver/transmitter, and capacitive touchpads. Without wiring and soldering, you can write programs that interact with one or all of these components.
Adafruit Circuit Playground Express
This project uses the temperature sensor and all ten RGB LEDs (aka NeoPixels), Every ten seconds, a temperature reading is taken and represented by lighting the LEDs. First, the tens are displayed in blue followed by the ones in yellow. 79 degrees Fahrenheit is displayed as seven blue lights, followed by nine yellow lights.
Circuit Playground temperature senors and ten RGB LEDs
# Import Libraries
import board
import time
from adafruit_circuitplayground.express import cpx
# LED Settings
cpx.pixels.brightness = 0.2
cpx.pixels.auto_write = True
RED = (255,0,0)
NONE = (0,0,0)
BLUE = (0,0,255)
YELLOW = (255,255,0)
# Defaults
led_degree_delay = .1 # Seconds between LED degree display
led_tens_delay = 2. # Seconds between display tens and ones of temperature
measurement_delay = 10 # Seconds between temperature measurements
# led_temp - display temperature with LEDS. First tens, and ones.
def led_temp (temp_f):
# Light an LED for each 10th dgree of temp, 72 degrees has 7 LEDs
tens = int(abs(temp_f // 10)) * 10
ones = int(abs(temp_f)) - tens
cpx.pixels.fill(NONE)
print("Update LEDs display")
# Display tens
for x in range(tens / 10):
cpx.pixels[x] = BLUE
time.sleep(led_degree_delay)
time.sleep(led_tens_delay)
cpx.pixels.fill(NONE)
# Display ones
for x in range(ones):
cpx.pixels[x] = YELLOW
time.sleep(led_degree_delay)
time.sleep(led_tens_delay)
cpx.pixels.fill(NONE)
while True:
# Take temperature measurement and convert for fahrenheit
temperature_f = cpx.temperature * 1.8 + 32
print(temperature_f)
led_temp(temperature_f)
time.sleep(measurement_delay)
Temperature Sensor
From the Circuit Playground Express datasheet, “There is an NTC thermistor (Murata NCP15XH103F03RC) that we use for temperature sensing. While it isn’t an all-in-one temperature sensor, with linear output, it’s easy to calculate the temperature based on the analog voltage on analog pin#A9. There’s a 10K resistor connected to it as a pull-down.”
Based on my testing, the starting temperature is not accurate, but the changes to temperature are. This project is not about getting an accurate room temperature, it’s about interacting with the components.
Increasing the temperature with a hair dryer, new reading every ten seconds
UPDATE 5/2/2021
After writing this post I continued testing with an additional temperature sensor, the AS2302. I connected it to the Playground Express and updated the to program take an additional reading from the AS2303. The reading was about 3 degrees lower than the Playground’s onboard sensor. It took about ten minutes for the AS2303 to settle in, it’s initial readings were five degrees higher.
AM23002 Digital Temperature and Humidity sensor.
Updated output including both temperature readings:
Temp: 74.8 F, DHT22 71.8 F
Update LEDs display
Temp: 74.8 F, DHT22 71.8 F
Update LEDs display
Temp: 74.8 F, DHT22 71.8 F
Update LEDs display
Updated Program
# Import Libraries
import board
import time
from adafruit_circuitplayground.express import cpx
# For DHT22 (AM2302)
import adafruit_dht
# LED Settings
cpx.pixels.brightness = 0.2
cpx.pixels.auto_write = True
RED = (255,0,0)
NONE = (0,0,0)
BLUE = (0,0,255)
YELLOW = (255,255,0)
# Defaults
led_degree_delay = .1 # Seconds between LED degree display
led_tens_delay = 2. # Seconds between display tens and ones of temperature
measurement_delay = 10 # Seconds between temperature measurements
# Initial HST22(AM2302) device
dht = adafruit_dht.DHT22(board.A7)
# led_temp - display temperature with LEDS. First tens, and ones.
def led_temp (temp_f):
# Light an LED for each 10th dgree of temp, 72 degrees has 7 LEDs
tens = int(abs(temp_f // 10)) * 10
ones = int(abs(temp_f)) - tens
cpx.pixels.fill(NONE)
print("Update LEDs display")
# Display tens
for x in range(tens / 10):
cpx.pixels[x] = BLUE
time.sleep(led_degree_delay)
time.sleep(led_tens_delay)
cpx.pixels.fill(NONE)
# Display ones
for x in range(ones):
cpx.pixels[x] = YELLOW
time.sleep(led_degree_delay)
time.sleep(led_tens_delay)
cpx.pixels.fill(NONE)
while True:
# Take temperature measurement and convert for fahrenheit - 1.8 + 32
temperature_f = cpx.temperature * 1.8 + 32
# Temp from DHT22 (AM2302)
dht22_temperature_f = dht.temperature * 1.8 + 32
# print(temperature_f)
print("Temp: {:.1f} F, DHT22 {:.1f} F".format(
temperature_f, dht22_temperature_f
)
)
led_temp(temperature_f)
time.sleep(measurement_delay)
In the article, “Raspberry Pi — Expanding My Mind with the GPIO,” I describe my discovery of the Raspberry Pi GPIO and my first project using it. While my second project, Mouse Shake, is a small step forward in complexity, I use it daily. It’s exciting to make something useful.
This article reviews the Mouse Shaking program and its journey from a Raspberry Pi Pico on a breadboard to an Adafruit Neo Trinkey.
Mouse Shake is Raspberry Pi used as a USB mouse that continuously moves the cursor on a computer screen. It’s used to keep my computer from sleeping. One of the computers I use daily is a locked-down Windows PC; I cannot change any of its settings. For security reasons, the PC locks and requires a password after a few minutes of inactivity. In an office environment, this functionality makes sense, but for a remote worker, this is a nuisance. I discussed my frustration with the helpdesk and their recommendation was to run a short video looping all day to prevent the PC from locking. Mouse Shake is a better solution.
Mouse Shake – Raspberry Pi Pico
The functionality of Mouse Shake is straightforward. Pressing a button will trigger the cursor to move back and forth and illuminate an LED. A second button press will stop cursor movement and turn off the LED. Curson movement will also stop when a time limit is reached.
The idea for Mouse Shake was inspired by a YouTube video from Novaspirit Tech.
The button is used to toggle cursor movement on and off. On a button push, the active_state is toggled:
active_state=not active_state
Active State defaults to False. On button press, the value of active_state is set to “not False” which is True. On the next button push, it’s set to “not True”.
Cursor Move
When in Active State, the cursor is moved, and the LED is turned on. Curosor movement is on the X access, which is from right to left. The distance moved is controlled by a variable and defaults to 100 pixels. The time delay between each movement is also controlled by a variable and defaults to half-second.
Cursor movement is not indefinite. max_shake_minutes defines how long Active State will last and defaults to four hours (240 minutes). When Active State is turned on, the current time is saved. In each iteration of the main program loop during Active State, the elapsed time is calculated, (current time – start time). If the elapsed time exceeds max_shake_minutes, Active State is turned off.
Because I use the Mouse Shake daily, I wanted to progress from a breadboard to a finished project using a case and soldered components. Before this project, my first time soldering was adding pins to the Raspberry Pi Pico.
First soldering -Raspberry Pi Pico pins
I purchased an Illuminated Red Momentary Pushbutton but couldn’t find an enclosure to hold it and the Pi Pico. After looking around the house I found a pill bottle. While it appeared to be a good solution, it didn’t work well. The Pi Pico and button fit well into the pill bottle and cap, but I didn’t plan for the USB cable. As a result, the pill bottle wouldn’t stand up. Despite my poor soldering job, Mouse Shake did work, lying on its side.
Soldering the Pi PicoAttaching the buttonCompleted product
Raspberry Pi Gateway
While tinkering with the Raspberry Pi GPIO and physical programming over the past month, I discovered the “maker space” is large with many products and vendors. I found Adafruit while searching for a LED button.
Adafruit was founded in 2005 by MIT engineer, Limor “Ladyada” Fried. Her goal was to create the best place online for learning electronics and making the best-designed products for makers of all ages and skill levels.”
Adafruit designs and sells boards and components. They have a large selection of microcontrollers of all sizes and capabilities. They are also an excellent resource for learning through their website content and YouTube channel. Sparkfun is the next company on my list to explore.
The Raspberry Pi Pico was my gateway to the larger microcontroller world.
Adafruit Neo Trinkey
Adafruit recently released the Neo Trinkey, a small USB board with two touch sensors, four RGB LEDs, and an ATSAMD21 microcontroller. The Trinkey caught my attention as a possible hardware solution for my Mouse Shake application. It’s a perfect size and has enough power to handle the needs of Mouse Shake. At $6.95 it was worth a try.
Adafruit Neo Trinkey
CircuitPython supports both the Raspberry Pi Pico and Neo Trinkey, as well as two 198 other boards. With some minor changes, I expected the Mouse Shake program created for the Pi Pico would run on the Neo Trinkey. I needed to update the program to accommodate different components. Two touchpads replaced the switch, and four RGB LEDs replace the single LED.
As my first experience with conductive touch pads and RGB LED, I needed to learn how to use them in CircuitPython. With help from CircuitPython documentation, I wrote a program that activated the LEDs by touch. There are three touch points, Touch 1, Touch 2, and both at the same time. My test program lights up all four LEDs based on these patterns. Touch 1 – Red, Touch 2 – Blue, and both yellow. This test program for Neo Trinkey is available on Github.
Neo Trinky Test
Button to Touch Pad
The code below shows the different between using a button and touch pads with CircuitPython.
Button:
# Import library
import digitalio
...
button = digitalio.DigitalInOut(board.GP13)
button.switch_to_input(pull=digitalio.Pull.DOWN)
...
while True:
# When button pushed
if button.value:
Touch Pads:
# Import library
import touchio
...
# Initialize touch pad
touch_pad_1 = board.TOUCH1
touch_pad_2 = board.TOUCH2
touch1 = touchio.TouchIn(touch_pad_1)
touch2 = touchio.TouchIn(touch_pad_2)
...
while True:
# When either pad is touched
if touch1.value or touch2.value:
active_state = not active_state
LED to RGB LEDs
The code below shows the difference between using LED and RGB LED with CircuitPython.
LED:
#Import library
import digitalio
...
#Initialize LED
led = digitalio.DigitalInOut(board.GP14)
led.direction = digitalio.Direction.OUTPUT
...
# Initial LED state
led.value = False
I had one problem moving Mouse Shake from the Pi Pico to Neo Trinkey. There was something wrong with the code, but Thonny, the Python IDE I was using, did not display a helpful error message. Then I tried running the code in MU, a different Python IDE, and found the error related to “long int type not supported”.
A key difference between the Pi Pico and Neo Trinkey is the processor. Pi Pico has a RP2040 chip (32-bit Dual ARM Cortex-M0+ @ 133MHz), while the Neo Trinkey has a SAMD21 (32-bit Cortex M0+ @ 48 MHz ). The SAMD21 does not support Long Int data types, but it does support Int data types.
The time.time() function used to track elapsed time returns a Long Int data type; therefore, the line of code: active_time = time.time() failed execution on the Neo Trinkey. I discovered the time.monotonic() function returns a smaller integer and provides the same functionality. Updating the code to use time.monotonic()corrected the issue. According to the CircuitPython documentation, Long Int data types are not supported at all. More research is required by me to understand why Integers work differently between the two boards.
Mass Storage Device
When connecting a microcontroller running CurcuitPython to a USB port, the computer recognizes it as a mass storage device (USB drive). Having the board connected as a USB drive is helpful when programming because you can easily edit the code directly on the device. For my Mouse Shake project, I don’t want the microcontroller recognized as a USB drive; it should be an input device only. While CircuitPython defaults “mass device storage” set on by default, it can be changed. This change requires rebuilding CircuitPython. It was surprisingly easy to do with the help from an Adafruit tutorial. The CircuitPython USB device defaults are also documented at AdaFruit.com.
In Conclusion
This was a fun and educational project. I’m happily using Mouse Shake daily on the Neo Trinkey. I plan to use the RGB LEDs more effectively:
Active – All four LEDs solid blue
5% Active time remaining – All four LEDs solid yellow
1% Active time remaining – Circular motion of RED LEDs
I love technology and tinkering with it. After fifteen years of being a devout Apple fanboy, I switched to Linux. While there were many reasons for this significant change, at the core, it was about learning. Since the switch, I’ve learned more about how computers work, both the hardware and software. I’ve built a desktop computer and breathed new life into older computers with Linux. My recent acquisition of the Raspberry Pi 400 started me on a new journey learning physical computing.
Since the Raspberry Pi 3 release in 2016, I’ve been using Pis for single-purpose servers. I’ve set up a network print server, Home Assistant server (home automation), Plex server (media server, mostly for streaming home videos), and a Pi-Hole (network ad blocker and DNS server). I once set up a cluster of Raspberry Pis to emulate a high availability web hosting environment.
Raspberry Pi rack.
As a career software developer, with most of that experience building websites, I’m comfortable writing programs that humans use to interface with information. I’ve also interfaced with software systems to share data, but I have never written software to interface with the physical world; lights, sensors, and devices.
Enter the Raspberry Pi GPIO.
This article is an overview of the things I’m learning in my first experiences with physical computing.
GPIO
The General Purpose Input/Output (GPIO) header on the Raspberry Pi allows you to interface with the physical world. The GPIO has 40 pins used for input and output. Four pins provide power (3v3 and 5v), eight are ground, twenty-six GPIO, and two for advanced use, which does not apply to me yet.
Pi 400 GPIO — Image source: Magpi Magazine
Getting Started
In addition to a Raspberry Pi, you need a few more things to get started with physical computing.
Breadboard —A breadboard, also know as a solderless breadboard, allows you to connect electronic components without soldering.
Full size breadboard
Components — There are many components you can interface with, including LEDs, temperature sensors, moisture sensors, motors, and switches.
Miscellaneous components
Cobbler — A cobbler connects the GPIO header directly to the breadboard, eliminating the need to connect jumper wires directly to the GPIO. A cobbler is not required, but it makes wiring easier — more about this below.
Cobbler
Starter Kits — You can find starter kits online as low as $10USD. The larger your budget, the more components you will get. I recommend choosing a kit that includes a full-size breadboard and Raspberry Pi cobbler.
Starter kit with full-size breadboard and cobbler ~ $28 USD.
First Project — Step 1
While I was lucky to have access to a Personal Computer relatively early in my life (1979 — Heathkit H-88), I never touched electronics, and if I did, it wasn’t memorable and didn’t stick with me. Now, in my fifties, I’m learning basic electronics. The photo below shows a breadboard with a yellow and red LED, two resisters, and a power supply module. While it’s easy to get the LEDs to illuminate, it’s challenging to understand how and why it works. this is what I learned:
Series and Parallel Circuits — In a series, components are connected in a chain. “If one goes out, they all go out.” In a parallel configuration, there is more than one path for an electrical flow.
Resisters — Resisters are Pi 400needed to limit the amount of current going to a component.
Ohms Law — Ohms Law is a formula used to calculate the relationship between voltage, current, and resistance in an electrical circuit
First LED project on a breadboard.
The LEDs illuminated when the power turned on. While this project is simple, it is exciting to see the LED come alive. My wife wasn’t so impressed when I proudly presented the yellow and red lights I had been working on for hours.
As I learned some electronic basics, I’ve only scratched the surface. I’m still trying to get my head around some of the basic concepts.
First Project — Step 2
After understanding how this circuit works, the next step was to replace the power module with the Raspberry Pi 400. I didn’t want to get cocky about my new found skills, so I simplified my project using only one LED. The GPIO has three pins that provide power and eight ground pins. I wired one of the power pins to the positive rail on the breadboard and the ground pin to the negative rail. The LED lit, as expected — another win!
Breadboard wired directly to GPIO.
Since I use the Pi 400 as an everyday computer, having the breadboard wired directly to the Pi 400 is not convenient. This is where the cobbler comes in. It’s connected to the Pi via a ribbon cable, then all of the wires are on the breadboard. It’s easy to remove the ribbon and put the project aside.
Cobbler replaces direct wiring.
First Project — Final Step 3
At this point, the LED is continuously on. My goal is to control the LED with software. The only wiring change required is moving the positive wire from the power pin to a GPIO pin; I chose GPIO 21. The next step is to write a Python program to turn GPIO 21 on and off, making the LED blink.
As I mentioned earlier, the software side is my comfort zone, but this was my first Python program and first time accessing the Pi GPIO. I’m impressed with how Raspberry Pi Foundation has made this easily accessible for people of all skill levels. There are many resources available to step you through a Pi project, from physical books to videos and blog posts.
I chose a tutorial on RaspberryPi.org and used the Thonny IDE to write and execute Python. After a few lines of code, the LED was blinking.
Thonny — Thonny is a Python IDE for beginners provided with Python 3.7. It’s is available from the Programming menu in Raspberry Pi OS. An IDE, Integrated Development Environment, is an editor that makes programming easier. It’s a good place to start with Python.
Thonny and my first Python program.
Yes — it blinks.
Next Projects
The starter kit I purchased came with several components. I’ve had fun experimenting with them. I was also lucky to get my hands on the new Raspberry Pi Pico, the new flexible $4 microcontroller board. I’m going to continue learning through some of the typical Raspberry Pi projects that build your skills and then take on a more significant project.
LCD controlled by Pi 400.
Raspberry Pi Pico.
Pi 400
While I’m using the Raspberry Pi 400, everything covered in this article can be accomplished with previous generations of the Raspberry Pi. The form factor of the Pi 400, as a complete personal computer, allows you to use the Pi as a computer and maker tool at the same time. It’s an excellent way to approach the Raspberry Pi for a non-techie.
Resources
The books and magazines produced by the Raspberry Pi Foundation are available for free in digital format. The physical books are high quality, loaded with information, and well worth the price.
Official Raspberry Pi Guides
Final Thoughts
Over the years, I haven’t spent much time on hobbies. With a mindset of ‘not wasting time,’ I’ve focused my time on activities that forward my career and have an end goal. One gift of the global pandemic is time. The quarantine kept us home with more free time than in the past. In my home, the amount of time we watched TV dropped. We started playing more games, reading, and other activities.
The Raspberry Pi 400 and GPIO has given me an avenue to expand my mind and start a new hobby in a subject area that interests me. I’m not going to be an electrical engineer, but I’ve learned it’s okay to do something because it’s interesting and fun.
The Raspberry Pi Foundation makes learning affordable, fun, and accessible for all ages.
When the Raspberry Pi Foundation announced the release of the Pi 400, the company described it as “a complete personal computer, built into a compact keyboard.” This is a bold statement from a company selling project-based single board computers since the first Raspberry Pi release in 2012.
To me, “complete” means including everything needed, hardware and software, to use the Pi 400 as an everyday computer. Let’s explore the Pi 400 as a complete personal computer.
My first Raspberry Pi was a Pi 3, and I use them for specific purposes, such as a media server, print server, and home automation server. I ordered the Pi 400 on November 13 and received it on November 30. Using it for three weeks now as a desktop computer, I’m impressed with what it can do, and I learned what it does not do so well.
What follows is my review of an ‘out of the box’ Raspberry Pi 400 Personal Computer Kit.
Pi 400 Hardware Basics
The Pi 400 is described as a Pi 4 inside of a keyboard. While that is not technically true, the Pi 400 has mostly the same components as a Pi 4 in a different form factor. More importantly, it has the components you would expect in a personal computer.
CPU/GPU — 64-bit quad-core ARM (Cortex-A72 at 1.5ghz), VideoCore (VI at 500MHz)
4 GB RAM (LPDDR4)
3 USB Ports (2 USB 3.0, 1 USB 2.0)
2 HDMI Ports (mini)
Networking — Gigbit Ethernet port, Wifi (dual-band 802.11ac), Bluetooth (5.0).
Raspberry Pi 400 Personal Computer Kit — includes Pi 400 (keyboard and computer), mouse, power supply, HDMI mini cable, microSD with Rasberry OS installed, and Raspberry Pi Beginners Guide (book). With this package, you supply only the monitor (or television). Cost $100 USD.
Raspberry Pi 400 Unit — includes Pi 400 (keyboard and computer) only. With this package, you supply themouse, power supply, HDMI cable, microSD with Raspberry OS. Cost $70 USD.
I purchased the Pi 400 Personal Computer Kit, which is a great value.
Pi 400 Setup
No technical skills required.
Setting up the Pi 400 Personal Computer Kit is easy. After removing all parts from the package, connect the monitor with the supplied HDMI mini cable, mouse, and power cable. The microSD containing the operating system is already in the microSD slot. That’s it!
Upon boot up, a setup screens walk you through a few prompts: location and timezone, password, and wifi connection. The last step, the system update, took twenty minutes for me. The length of time likely depends on how outdated the software is on your microSD.
When the update is complete, you will reboot. Your new PC is ready!
Raspberry OS and MicroSD
The official operating system for the Pi 400 is Raspberry Pi OS, a Linux distribution, which comes pre-installed on a microSD.
The Raspberry Pi OS Desktop is not a modern looking interface, but it’s straight-forward and easy to use. I expect anyone familiar with Windows or Mac OS will not have trouble using Raspberry Pi OS. Other Linux distributions are also available for the Pi 400. With the Pi using microSD as its primary storage, it’s inexpensive and easy to download a few other operating systems to try out. But this review is of Raspberry Pi OS only.
Technical Note: As of this writing, Raspberry Pi OS is 32-bit. I bet you are thinking, “a 32-bit OS can only access 4GB of memory,” and you are correct. Pi Os 32-bit was modified to access all 8GBs of memory, as the Pi 4 has a 8GB option. A 64-bit version of Raspberry Pi OS is available as a beta release. While stress testing will show the 32-bit OS version is not as performant as 64-bit, it’s unlikely you will not notice a difference for everyday use on the Pi 400.
The Pi 400 Computer Kit comes with a 16GB microSD. There is 6GB of free space after installation, which is adequate to get started. A larger microSD, 32GB or 64GB, would be a useful upgrade. You can also boot from a USB drive; details are available at RaspberryPi.org.
Software
Raspberry Pi 400 comes with dozens of software applications for system management, productivity, programming, and gaming out of the box. They provide a good representation of the Pi 400 capabilities, such as LibreOffice, Scratch, Python, and Mindcraft.
Thanks to the evolution of web browser capabilities and browser-based services, a well-functioning browser checks the box for many personal computing needs, such as browsing the Internet, Facebook (and other social media), Youtube, and e-mail.
Pi OS provides a utility to add software from a repository of hundreds, or maybe thousands of applications. The user interface is not very friendly, and it is challenging to find the software unless you know the application’s exact name, but it works.
Streaming Services — Out of the box, Chromium browser does not support DRM video streaming from services like Netflix, Hulu, and Disney+. With “The Office” leaving Netflix on December 31, 2020, I had a problem. I needed to get as much Michael Scott as possible (That’s what she said). The Pi community has solved this problem, thanks to Veselin at blog.vpetkov.net. With just a few commands in the terminal, a media friendly version of Chromium is added to your menu.
Performance
Performance is important. To call the sub-$100 Pi 400 a “personal computer,” it needs to perform well in that environment. I’ve used the Pi 400 daily for three weeks for common computing tasks. While it’s not as quick as my high-end computers, it performs well. It’s an uncompromising solution for everyday computer tasks.
During the Covid-19 Pandemic of 2020, video calls have become critical in people’s lives with families, friends, teachers, and students all connecting on Zoom, Teams, Meet, and many other platforms.
Zoom is my primary tool. I tried a Zoom client, installed with PiKiss, and Zoom in the browser. Neither approach worked well; in fact, it wasn’t usable on the Pi 400 or Pi 4 (8GB) with Raspberry Pi OS, but I’ve seen others on YouTube having success with Zoom.
Both Facebook Messenger and Google Meet worked well in the browser. I’ll be keeping my eye on the developments in this area.
Sound and Printing
The Pi 400 does not include a 3.5mm audio output jack for speakers, which is available on the Pi 4. Sound can come from a monitor or TV through the HDMI connection, a USB speaker connected through the USB Port, or Bluetooth.
When I received the Pi 400, sound through a USB speaker was not working. In early December, a new version of Pi OS, 5.4, was released and it included Pulse Audio, a sound server. After the upgrade, the sound worked as expected.
The 5.4 release of Pi OS also included CUPS, Common Unix Printing System, to access and manage local and network printers. My LaserJet network printer was recognized and worked without issue.
It’s encouraging that the Raspberry Pi Foundation recognizes ‘must-haves’ for the Pi to become a personal computer and are actively making improvements.
Computer Noise
Because there is no fan or spinning drive, the Pi 400 is silent. Passive cooling keeps the Pi 400 from overheating and throttling the CPU. A keyboard-size heat shield is connected to the top of the CPU with a thermal pad, resulting in heat being dispersed through the shield.
Heat shield inside the Pi 400 keyboard.
Power Consumption
The Raspberry PI is a low powered, single-board computer. Using an Energy-Use Monitor to measure the power usage at the outlet, the Pi 400 uses 2.5 watts at idle. To put “low powered” into perspective, I also measured a few other computers in my house at idle and played a YouTube video in the browser. I’ve included an estimated cost per year at idle (given my utility rates).
For a personal computer, the Pi 400 is very power efficient. As an experiment, I used it for 8.5 hours, watching Netflix, browsing, and writing this article powered by a 10000mAh portable charger.
Pi 400 powered by a portal charger.
Keyboard
The computer is the keyboard. It’s solid and feels good to type on. To me, it’s not the best or worst I’ve used. There’s not much more to say.
Not So Smart: Apple’s Smart keyboard for the iPad is $159, and is pretty dumb compared to the Pi 400!
Help and Documentation
In addition to the “The Official Raspberry Pi Beginner Guide” that comes with Pi 400 Personal Computer Kit, there is a virtual bookshelf full of digital resources available in Pi OS’s Help menu. For example, it contains “Getting Started” guides and every edition of the MagPi magazine. The Raspberry Pi has a large online community with answers to many questions you may have.
Conclusion
Is the Pi 400 a “complete personal computer”? Yes.
Is there is room for improvement? Yes.
With the Raspberry Pi being a project-based computer for most of its life, a consumer-focused desktop interface has not been a priority. While it’s usable, it has a long way to go to compete with mature distributions like Ubuntu. I’m in the process of reviewing alternative OSs and will be sharing my findings. Stay tuned.
While the Pi 4 is available in an 8GB RAM model, the Pi 400 is not. For the purposes of my “daily use” testing, 4GB was enough RAM. I hope to see an 8GB model in the future; the more RAM the better!
Where is the Pi 400 a good fit?
A computer for someone that needs day-to-day computing tasks, browsing, writing, e-mail, social media, and casual video streaming.
A secondary, or family computer, online access, and homework.
The Pi 400 runs on Linux, a great computer to use and learn Linux.
While I’m evaluating the Pi 400 as a desktop computer, it’s still a Raspberry Pi, an amazing single-board computer that took the world by storm. Its 40-pin GPIO connector interfaces with additional hardware; such as temperature sensors, LEDs, pulse rate monitors, and much more. The perfect computer for a budding engineer.
The Pi 400 is this generation’s Commodore 64, making computing accessible in a form factor that’s approachable with endless possibilities.
I switched to Linux three years ago. After being a Mac fanboy for fifteen years, this was a significant change in my life. Most of the hardware and software I used daily changed. For sure, the software transition was slightly painful but worth the upside. The most significant benefit of switching from Mac to Linux is choice.
Software Choice
While software availability is sometimes a blocker for Mac users to switch to Linux, it’s more of a benefit. Except for a few Adobe products, I found strong Linux alternatives for the Mac applications I relied upon. Since switching, I’ve been surprised by the amount of quality software available.
Moving away from the Apple software ecosystem is freeing. Do your phone, computer, and tablet need to be one symbiotic system? Previously I thought that was a significant benefit of using Apple, but it’s limiting and smothering. The opposite of choice. After my family switched from Apple’s Messages to Telegram for texting, we had more phone options. At the time, a recent college graduate living independently, my daughter needed more room in her budget for technology. She switched to a budget-friendly Windows laptop and now uses Android phones. Telegram, a simple software choice, made her transition easier and allowed our family to stay in touch across platforms.
If you’re considering a switch, start thinking about the applications you use. Can you switch to multi-platform, open-source solutions? Is there a browser-based application available? For example, Libre Office could likely replace MS Office for most people. It’s available on Windows, Mac OS, and Linux.
Choosing open-source applications often leads to more flexibility. For example, I was using Lightworks video editing software. While it runs on Linux, it’s proprietary with usage restrictions. I was not able to run it on multiple computers or easily move it from machine to machine. Switching to KdenLive, an open-source alternative, gave me the flexibility to use it wherever I need to. Linux-based, open-source application a made to run a wide range of hardware configurations. KdenLive runs on high-end hardware and older hardware. As demonstrated by Jason Evangelo, it also runs on a Raspberry Pi.
Good software choices lead to more hardware choices.
Hardware Choice
In the earlier days of Apple, it was possible to replace and upgrade Mac hardware. Over time, Apple’s mission to get smaller, lighter, and be “the most beautiful ever” resulted in hardware designs that limit DIY upgrades and non-Apple repairs. There are very few hardware choices with Apple. The differences between computer models are minor, and your choice comes down to how much you want to spend, not what you want or need.
After switching to Linux, I discovered endless hardware choices.
High-end, Apple-quality laptops are available from many vendors. Most will run Linux, and more are coming with Linux pre-installed. Mac OS and Windows are heavy, bloated operating systems that require relatively current hardware. For example, Apple’s current operating system, Big Sur, requires a 2014 or later iMac, which has a 3.5GHz quad-core Intel Core i5 processor. The current version of Ubunutu recommends a 2 GHz dual-core processor or better. Theoretically, because I haven’t tried it, Ubunutu will on the first Intel iMac model from 2005; it has an Intel Core 2 Duo 2.8 GHz.
While I have a high-performing desktop and laptop, I also use a 2011 Thinkpad T420 whenever I’m away from my desk. While it doesn’t have the best display or speakers, it performs well and has a great keyboard. If needed, I could use it for my day-to-day work. I bought it for $45 on eBay, replaced the battery, and upgraded to an SSD for another $55. I run the same operating system, Pop!_OS, and software on these three computers. That’s choice.
With Linux, you have a vast pool of new and used hardware to choose from. You can have a computer with USB ports, MicroSD ports, and HDMI ports. Pick the hardware for the purpose and the price that works for you.
Visual Validation
Since the start of the Corona Virus pandemic a year ago, I’ve traveled farther than 20 miles from my home three times:
Helping my daughter relocate to Phoenix with a cross-country trip from Rhode Island to Arizona (2,700 miles).
To visit my sister in Milford, Connecticut (126 miles).
A few weeks ago, my first visit to a Micro Center in Cambridge, Massachusetts (57 miles).
Micro Center, Cambridge, MA
I wanted to visit Micro Center for two reasons. First, they are selling the new Raspberry Pi Pico 50% off, $1.99. Second, a car ride on a Sunday afternoon gave Erica and me something to do. Walking into Micro Center is overwhelming. Being mindful of the ongoing pandemic, I limited myself to one section of the store with single board computers and parts. I could have spent at least two hours visiting each section.
My Micro Center heist
The inspiration for this article came from my visit to Microcenter. The number of choices struck me. An entire aisle with motherboards, another with graphics cards, and hard drives, power supplies, or so forth. My choice to switch to Linux made all the aisle a possibility for me.