The death of a behemoth
If you follow me on twitter (@Pycro1) you will have recently noticed my beloved Raspberry Pi 4 passed away, I had been using it as a Linux desktop for a while, hosting and building projects for this blog. It has heavily featured in my node-RED work and as a side car for my iPad Pro.
It seems the EPROM on the Raspberry Pi 4 has become corrupt, after trying to repair it with the repair tool from the Raspberry Pi site it still failed to boot with several SD Cards. Whilst not completely written off yet although I do think it’s a terminal case, the knee jerk reaction was to pop online and order a replacement (something that still may happen as I do love the Raspberry Pi desktop at times).
Pausing for thought I decided to rethink the options and see if this was an opportunity to do things differently, this is after all what we strive to do on bloggedin. After assessing my use case it became clear that for what we like to do the Raspberry Pi 4 is in fact overkill for most of its purposes.
Whilst the Raspberry Pi organisation initially marketed the model 4 as a desktop capable device, for most of us who are fortunate enough to have other devices the need for a mini desktop was not the main driver for the purchase. When we stop and think to evaluate our use cases perhaps the Raspberry Pi 4 is not the best or cost effective of their options.
What do you use your Raspberry pi for?
Our primary use case for the Raspberry Pi can be summed up by the following requirements:
Low powered Linux device.
GPIO to hack about with sensors, hats and other electronics.
Providing for server services.
Running a node-RED instance.
Providing a shell environment for the iPad Pro.
Coding interpreters and compilers (again mainly for the iPad Pro).
When you look at those requirements, with the exception of the GPIO, you can of course run a cloud shell service however, there is no fun in that and potentially on-going charges. Indeed, when you look at the low tier offerings from cloud providers you are in effect paying (free tiers aside) for nothing more than a Raspberry Pi Zero spec shell.
Your own self hosted shell server
This is where it hit home, the Raspberry Pi Zero not only caters for all our requirements but is also cheap as chips plus you get full control of the administrative roles of the box. Already owning a Pi Zero I started to look at my options, Node-RED runs perfectly fine if you are not trying to run it on the Pi via its own browser and GUI. Simply running node-RED as a service and accessing it over the network is perfectly viable. Whilst mentioning the GUI the Raspberry Pi Zero is almost always best run in CLI mode and once set up they are best used headless, accessing them by SSH.
So the revelation following the death of the Raspberry Pi 4 is to look at using Raspberry Pi Zeros going forward (building our own mini server farm), since they are cheap as silicon chips and cost next to nothing to run, we can look to have multiple Pi Zero’s for different use cases. Our first one is already set up as a dedicated node-RED server, shell and MQTT server. We have another one on order for tinkering with the GPIO, others will come on-board to split out services and because they run headless it may be viable to install them behind our router and take advantage of Ethernet with mini dongles.
It is not all about mini servers
The Pi Zero also comes into it’s own when considering robotics solutions and IoT, having the full power of a mini computer at the heart of it tailors for additional functionality and having a low power draw is key for those applications (I still have ambition to build several rovers). The Pi Zero can run significantly longer off batteries such as powerbanks in relation to Raspberry Pi 3’s and 4’s.
Sadly for people who loathe soldering the Pi Zero is typically supplied without a header attached to the GPIO, but all is not lost the good people of Pimoroni sell them with a pre soldered header for just a few quid more. Equally you can also get hammer on GPIO headers, of course for builds that you intend to just run for shells and services you will not require a GPIO which can save you a few pounds.
Typically the Pi Zero W (WiFi version) comes in just less than £10 with a pre-soldered one just £3.60 more, if your soldering skills are as good as mine it is £3.60 well spent. Sadly though, at the moment you are limited to one per purchase as stock levels of the Pi Zero are sporadic at best. If you require a few you need to stage your purchases accordingly. It is worth remembering you can have three Raspberry Pi Zeros for the price of the entry level Raspberry Pi 4 and the running costs for a year is less than that of a server run shell instance.
Plenty of bling available but do you need it?
Accessories, whilst not required apart from an SD card are freely available. We tend to just go for a cheap acrylic case offering such as a PiBow or similar off Amazon, cooling is not required nor is the case in theory but they do at least look better in a housing of some description.
For power I tend to use a powered multi USB port from which I can power multiple Pi Zeros effortlessly, including a Pi 3 that I still have in service. The Pi 4 however, did not get on with this solution and required a dedicated higher amp power source.
The Raspberry Pi Zero sits in a niche all by itself really above the other devices such as the Arduino and micro:bit et al in terms of functionality as it has a full OS that can be employed on its own or with projects. Let us look at the technical specifications:
- BCM 2835 SOC @ 1GHz
- 512MB of RAM
- On-board Wireless LAN — 2.4 GHz 802.11 b/g/n (BCM43438)
- On-board Bluetooth 4.1 + HS Low-energy (BLE) (BCM43438)
- micro-SD
- mini-HDMI
- micro-B USB for data
- micro-B USB for power
- CSI camera connector
- 40-pin GPIO connector
- Compatible with existing pHAT/HAT add-ons
- Dimensions: 65mm x 30mm x 5mm
Whilst most of the connection options are superfluous if you plan to use them headless it is nice to have options, I would not recommend using the GUI on the pi zero it is an arduous affair but at a push if there is something you need it for as a quick fix it is possible to do things in the GUI.
Linux at heart, you’re so Linux at heart.
The beauty of having Linux at its heart is that all your programming options are largely catered for out of the box and if not only a sudo apt install away. Personally, I use Python for the most part but also install nodejs and npm for node-RED. GCC is available for C/C++ etc.
When it comes to editors you will want to get comfortable with a terminal based editor, again there is a plethora of options but I find nano is king for my needs it is simple to use and gets the job done, nano even recognises some of the Python syntax with colour coding.
Finally they are a very stable device I have had them running months powered up, unattended and accessible from any device on SSH and should you require it you can open a port on your router for external access.
Admittedly when it comes to tinkering we have not employed the Pi Zero enough, this something we shall remedy over the next few projects, when it comes to simple quick IoT projects the micro:bit and similar chips sport a lot of fun and challenges but now we will get more serious and look to build out off a small but powerful SBC.
Next time you are shopping for another Raspberry Pi, challenge yourself do you really need the power of the Raspberry Pi 4? If it is a robotic project your batteries may just thank you for it. I for one am looking forward to more exploration of the GPIO, sure probably with add on boards but it would be interesting to come up with some IoT devices and see how they compare to previous projects as we would typically not have to run rings around getting connected and finding solutions for data storage.
Thanks for blogging in.
more articles on www.bloggedin.co.uk