Things I wish I had known about Raspberry Pis

Sunday, 3 January 2021

Things I wish I had known about Raspberry Pis

Raspberry Pis are very fun to play with and are relatively cheap —I believe I have 6 or 7 Pis running across the house. However, very often I learnt a thing or two that I wish I had known beforehand —sometimes rather fortuitously. So here is my list of top "in-hindsight" tips from the perspective of a seasoned coder with no prior electronics experience.
That latter sentence contains a detail, which is itself a tip! Most Pi/Arduino project notes or tutorials are written by folk knowledgeable in both coding and electronics... However, this is not always the case as you may encounter projects where the coding is shocking, yet the author discussed something very complicated on the electronics side. This is also true in reverse, but as a coder, I rarely spot cases where the electronics side is questionable. So caveat emptor.

Buying stuff

  • There is always something to buy. If you know you need something that is actually good. It is worse not knowing something useful exists. A curious case is when the the thing in a photo is not named: "crocodile clip" was a word that alluded me, until I browsed some shop's website —possibly Pimoroni— much like a child circling items in an Argos catalogue before Christmas.
  • PiHut and Pimoroni are the official distributors of Pis. All other shops (e.g. Amazon and eBay) resell them at a higher price. However, many components can be bought for cheaper off eBay, especially as a multi-buy. Other microcontroller boards may have a similar situation: I wanted an STM32 Nucleo because unlike other Arduino alternatives it has a cool cyan on white colour scheme and RS components was the correct seller.
  • Always get or make a case even if it costs more than the damn board, accidents happen, full stop.
  • The official Pi 4 case looks oh-so sleek but cannot accomodate a fan and majorly does not have a flap for GPIO cables. Compare with the official Pi zero case which does.
  • eBay is full of folk selling unused Pis. A Pi Zero costs £10+3 (you can only buy one at the time), but a larger pi has the advantage of multiple USB, no shims, no squeezing, ethernet etc. So it is rather a convenience thing than a cost thing —although a lot seem kit purchases of a Pi in a case with fans.
    (1) the audio jack gets tarnishes after prolonged Pi usage, so a shiny audio jack means an unused Pi —so zero chance the PMC is fried
    (2) a Pi 2 does not have WiFi but goes for £10-15 (auctions)
    (3) a Pi 3 goes for £20-25 depending on the extras


I have wasted so much time trying to remember what is what because I did not start off with a system... even a paper notebook would have helped.
  • add in each microSD cards a file describing what it is
  • Set up a jupyter notebook and slack notification on boot: details of common tasks here
  • post-it notes come off, sharpies don't.
  • decide where to keep your code or you have to relearn what you did. And always save a copy of your history just in case.
  • Sending 5V to 3.3V will fry the PMC. The power out of the pins will be low. It is not worth desoldering and resoldering a new one. Add Tippex on the chip to mark it —as opposed to testing it each time one is in doubt.
  • Tupperware boxes are great for storing components
  • Print several pages of the GPIO pins ...and use a pencil: like a DnD character sheet it will be a mess, but mighty handy.


  • Do not go cheap and get a 30W soldering iron. 60W or nothing: it works so much better and the tips are standard.
  • Also indispensable are flux, sponge and possibly cleaning ball
  • Safety specs are a must
  • Solder on a wooden chopping board
  • If soldering is not working, it's the tip: learn how to re-tin the tips, do not listen to the sand down your tips advice.
  • Bluetack is great. It is not electrically conductive and does not burn, but leaves a residue that works as an anti-flux basically, preventing solder from sticking.
  • Header pins make soldering so much easier
  • The cable bundles are okay, but no way as handy as a spools of wire. Solid-wire 22 gauge is perfect for breadboards. Even if it's not elegant, 18 gauge stranded-wire makes a perfect female adaptor for 22 gauge solid-wire — 18 gauge is larger than 22. 22 gauge stranded-wire fits through the holes, so is best for soldering as it's flexible, but will require a crimper and JST connectors for the ends —very handy though.
  • About JST connector crimping tool, read the reviews on Amazon for it —mine despite being "Amazon's choice" is far from ideal as confirmed by the reviewers.

GPIO pins and sensors

  • A sensor bundle mega kit is not worth the money. They are the cheapest sensors and as soon as you start a project you will upgrade to an ever so slightly more expensive sensor. A good example is the temperature sensor DHT11, which is nowhere as good as the £5 BME280. Another example is the cheap 433.92 MHz receiver, which has a 5 m range. Like all components, multi-buy of the same item is cheaper on eBay.
  • Breadboards are really handy. A T-cobbler seems handy but isn't really.
  • For a pi zero, the coluor-coded header pins are a must.
  • Mark the GND pins with a black Sharpie
  • Essentials: misc. resistors, misc. LEDs, MCP3008
  • Non-essential: rectifiers, shrink wrap tubing and capacitors (maybe with the exception of 10 nF ceramic caps)
  • The MCP3008 is a pain to set up. Testing it is set up correctly is essential using a 3.3V pin.
  • In Python Adafruit ditalio is definitely better than the RPi.GPIO module. Even if a lot of code online uses the latter, it is always handy to convert to the latter, which is cleaner and can be use with a context manager.
  • Graphite is conductive, so mechanical pencil leads make excellent rust-proof rods for things like water level
  • Cheap thin water tubing for irrigation is a bad investment as it's not flexible and prone to flick off the connectors.
  • HATs? Adafruit &co. want to sell you stuff and often what is needed is a dirt cheap component.

Pi camera

  • The official Pi camera (V2) costs £25 and is 8 MP. However, off eBay or Amazon you can buy for £10 or less as combinations a V1.3 5 MP camera. Who cares for the difference in resolution if the rate limiting part is the focus?
  • The ribbon of a Pi can easily damage: it is cheaper to buy a new 5 MP camera with different cables included.
  • The lens focal length of a pi camera can be altered with a pair of tweezers, however, there is a lens adjustment tool for the V2 camera that makes life easier.
  • Online there are some lenses available that are M12 lenses, which is 12 mm in diameter for which a standard M12 mount works on a pi camera. However, there are lots of clip on lenses for smart phones online, which need some tinkering as the lens sticks out, unlike a phone. The ring within the clip from the lens kit is a "lens lock", but the diameter is odd (2/3", 1.67 mm, possibly D mount?), so I've been unable to find a lens lock to space it out. Duck tape, plasticard and bluetack is a bad route. The distance between the lens and the sensor is called flange length: on clip-on lenses this is very small (lock ring height), so, proportionally, being off by a few millimeters ruins the photo, so sticking with M12 lenses is a better solution (or maybe the High Quality pi camera which has a CS mount already...).
  • Further on the above, many 3-in-1 lenses come with a macro that screws off a wideangle lens. This is actually is a M12 to C adaptor. Theoretically, one could go M12 to C to Nikon F-mount or Sony E-mount and use a DSLR lens... but in that case one really ought to be using the £50 high definition pi camera  or even better controlling a DSLR camera directly with a pi via gphoto2 (sudo apt-get install python3-gphoto2 and bob is your uncle).
  • In low light, when a LED ring is not an option stacking multiple photos, scaling and histogram stretching the image is good strategy.


Lure of 64bit

As of writing, Raspian comes stably only in 32bits, but a Pi 4 is 64bits. However, using Ubuntu comes with major complications on the GPIO front making it a path not worth going down. I use Ubuntu for a Pi 4 homeserver without using its GPIO. Were I to use the GPIO functionality I would likely opt to use a (fake) Arduino Uno board via pyfirmata.


A Pi can be powered not only via mains to USB, but also via power over ethernet (PoE), which means you can use 30m flat ethernet cables thus neatly fitting across doors. This standard basically sends 48V DC power across a signal-bearing ethernet cable, so it means it can also act as a network cable. This requires:
  1. PoE injector
  2. Cat 7 ethernet cable
  3. PoE splitter to 5V

Concluding remark

Summarising, I would say the take home messages are that cheapness is bad (unless it's the camera), however, non-standard better solutions may exists (such as gphoto2) that do not require yet another component.

No comments:

Post a comment