US
16 MIN READ TIME
Pi PICO

Build a Raspberry Pi Pico voltmeter

Tam Hanna uses the Raspberry Pi Pico’s analog-to-digital converter and an OLED display to create a small, but decently useful voltmeter.

QUICK TIP

» WHAT TO DEVELOP WITH?

QUICK TIP

» GAINING HIGHER ACCURACY

QUICK TIP

This multimeter could also have been written in C. Doing so would have forced us to miss out on various libraries, which led to more compact code. In today’s age of highperformance microcontrollers (this is a 100MHz class unit), sacrificing some efficiency for faster development is a tradeoff worth considering.

The Raspberry Pi Pico is impressive in that it provides a highly flexible development environment. For reasons of convenience, the following steps were performed using the stock MicroPython firmware readily available at www.raspberrypi.org/documentation/pico/gettingstarted. Our program isn’t large enough to warrant the creation of a custom build, which would only slow us down.

Both alternating and direct current are lethal. Don’t perform experiments with voltages larger than 50VCAC or 120VDC. For safety reasons, stay below 25V AC and 60VDC – and if you have cardiac problems, be especially careful of AC. Neither the publisher nor the author can be held responsible for damages to health and equipment.

Creating a high-accuracy instrument is an interdisciplinary task. One nice area of improvement involves the reference voltage fed into the ADC. The Raspberry Pi Pico board doesn’t enables us to harness the entire capabilities of the RP2040 microcontroller. A detailed explanation of the issues faced can be found in section 4.3 of the Raspberry Pi Pico datasheet document.

Metrology hasn’t changed significantly in the past few decades. Service manuals for vintage multimeters often contain accurate and commented schematics. These provide an excellent education for designers seeking to save themselves the effort of reinventing the wheel.

OUR EXPERT

Actual program development is then done on a workstation running Ubuntu 18.04 and the Thonny IDE. Unfortunately, it can’t be installed from the package repository of the distribution: the Raspberry Pi Pico core expansion works best with at least version 3.3.3+ of the product.

Should you feel like improving your reference voltage, please avoid falling victim to the accuracy fallacy. The reference voltage doesn’t necessarily need to be precise: in the end, no one cares if the absolute value is 3.205V or 3.235V. Instead, absolute stability is important – keep in mind that components are affected both by ambient temperature and aging.

Tam Hanna has developed, and made hardware for various civil and militia applications. He lives in a bunker full of test equipment in Budapest, and is always looking for well-paid jobs…

Given that MicroPython is an interpreted language, you don’t need to worry about connecting a PicoProbe or similar debugging hardware. The USB interface of the microcontroller is used to host a REPL console – the IDE running on the PC takes control of the microcontroller board via the serial link used for communicating with the bootloader. As for actual hardware development, DuPont headers can be soldered on to the board. It then fits a breadboard comfortably, thereby freeing you from designing a custom PCB during the initial stages of the project.

If you have a stable voltage reference at an odd voltage level, values can be massaged using various algorithms. Compensating temperature or aging effects, on the other hand, isn’t possible due to entropy. The same is valid for a resistor: if the voltage divider is constant with a ratio of 1:2.201, computing values isn’t an issue.

QUICK TIP

This multimeter could also have been written in C. Doing so would have forced us to miss out on various libraries, which led to more compact code. In today’s age of highperformance microcontrollers (this is a 100MHz class unit), sacrificing some efficiency for faster development is a tradeoff worth considering.

Incidentally, voltage reference design is one area where each multimeter vendor cooks their own soup. Datron, Hewlett Packard and Schlumberger Solartron take their own approach to the problem, the service manuals of the high-end products make for highly recommended reading. Finally, don’t forget mathematical processes. Using sophisticated filters lets you “eke out“ additional information from imperfect hardware. Grouping together ten samples into one measurement, for example, eliminates some noise sources.

ew tasks in the life of an engineer can compete with the degree of satisfaction achieved by creating test equipment. Be it a testing rig or a generic piece of equipment, there’s always something to learn (and fun to be had).

Unlock this article and much more with
You can enjoy:
Enjoy this edition in full
Instant access to 600+ titles
Thousands of back issues
No contract or commitment
Try for 99c
SUBSCRIBE NOW
30 day trial, then just $9.99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
April 2021
VIEW IN STORE

Other Articles in this Issue


LINUX FORMAT
WHO WE ARE
This issue Jonni’s getting paranoid with securing and monitoring his Mint install, so we asked our writers what’s their favourite security or monitoring tool?
Puny humans!
I’d always say the biggest security threat to
REGULARS AT A GLANCE
LibreOffice Community Edition and NG project
OFFICE SOFTWARE
NEW WAYS OF MEETING
OPINION
Kernel Watch
Jon Masters summarises the latest happenings in the Linux kernel, so you don’t have to
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to lxf.answers @ futurenet.com
Mailserver
Write to us at Linux Format, Future Publishing, Quay House, The Ambury, Bath BA1 1UA or lxf.letters@futurenet.com.
CudaText
CODE EDITOR
Pdfarranger
PDF TOOL
Visum
OFFICE APPLICATION
Mint 20.1 “Ulyssa”
FRESH AND FLAVOURSOME  MIN SPECS: 64-BIT CPU, 1GB RAM, 15GB DISK SPACE, SVGA DISPLAY
SparkyLinux 5.14
LIGHTWEIGHT LINUX  MIN SPECS: i686 CPU, 256MB MEMORY, 10GB DISK SPACE
NEWSDESK
CentOS fallout continues
SERVER DISTROS
Rocky Linux gets a surprise backer
SERVER DISTROS
TRY MONADO OUT TODAY
OPINION
FUNCTION OVER FORM
OPINION
What’s coming to Ubuntu 21.04
DISTROS
24-year-old kernel bug found
LINUX KERNEL
Android ported to RISC-V
ANDROID
Distro watch
What’s behind the free software sofa?
LICENCE TO CHANGE
OPINION
REVIEWS
Cosmo Communicator
Is the Linux-compatible Cosmo Communicator PDA out of this world? Christian Cawley boldly launches a five-day mission to find out
Sabrent Rocket 4 Plus
A superfast, 2TB second-generation PCIe 4.0 drive that comes in at a decent price? Sign me up, says Alan Dexter
KDE neon 5.21.0
Jonni Bidwell has had it with Gnome, at least for this page, where he dabbles with KDE’s latest desktop delights
Siduction 2021.1.0
Jonni Bidwell is once again seduced by the dark side of the Linux Distribution community, or at least the Debian Sid side
Vivaldi 3.6
Will someone please stop Jonni Bidwell incessantly whistling the first movement of Four Seasons as he reviews this browser
Cyber Shadow
Management loves saving money, so when Stacey Henley says she’s using fewer pixels and reusing old ideas they were all aboard
ROUNDUP
Window Managers
Shashank Sharma shines a spotlight on a collection of window managers that can help you broaden your Linux desktop experience
The types of window manager
Does it really make a difference?
Installation
Are they available for your distribution?
User experience
Are they drastically different or disastrously so?
Documentation and support
When you can’t tell if you’re coming or going
Configurability
Are these windows managers easy to customise?
Standout features
What makes them special?
Appearance
Don’t like it? Then change it!
Windows managers The Verdict
T he fvwm3 window manager recently published 1.0.2
Fortress Linux!
FORTRESS LINUX!
Linux is pretty secure, but the ever-vigilant Jonni Bidwell has studied the threatscape and recommends applying reinforcements…
Viruses, villains and infection vectors
Linux does a lot to protect you, but should you do more to protect it?
Build that firewall
Protect your ports, lock down your sockets – there’s a packet storm ahead
Keys and signatures
Trust no one, unless their SSH key is signed by Linux Format’s public key
Web browsing and email
Our two favourite network applications are attractive targets for hackers and zombie scripts. Don’t let them in!
Pi USER
HOW THE PI OPENED DOORS
Caroline Keep is an awardwinning teacher at Spark
Controversy over Pi OS Microsoft repro
The community pushes back over official support for Microsoft’s Visual Studio Code repro in the Pi OS
Make your own silicon!
How the Raspberry Pi Pico was designed, a love story…
Thonny 3.3.0
Les Pounder has been tinkering with Python for many years. A recent change of editor revealed a fresh new way to write code
FydeOS
The ever-curious Les Pounder wonders if his trusty Raspberry Pi 4 can be used as another Chrome device?
Install a new OS to SD and USB media
Les Pounder is always flashing a new OS to his Raspberry Pi and these are the tools of his trade
IN-DEPTH
SENSORS AND SENSIBILIT Y
Recalling a past life where he gazed on dials and Galilean thermometers, Jonni Bidwell assesses Linux’s system monitoring offerings
TUTORIALS
Reduce spam emails
Shashank Sharma keeps the menace of spam at bay by using temporary email addresses from the comfort of the terminal
Back up and sync files quickly and easily
Nick Peers reveals how to back up and synchronise files over your local network and even further afield, enabling you to stay on top of your data
Master black and white photography
Mike Bedford reveals the secrets of good black and white photography, an art form that stands alongside its more colourful counterpart
Virtualising Arch the easy way
Want to test software without crashing your computer? Neil Bothwick creates a disposable system that you can crash without consequence
TUTORIAL
Control real-world hardware on your PC
Mike Bedford shows PC users how to add GPIO interfaces to their computers, just like those Raspberry Pi and Arduino users are familiar with
How to easily emulate 486 PCs and run DOS
Relive the halcyon 32-bit years of PC computing, play your favourite games and look back at OSes of yore with the ever-dependable Les Pounder!
HOTPICKS
Reco
Version: 2.4.2 Web: https://github. com/ryonakano/reco
Pingnoo
Version: 2021.01.10-develop Web: https://github.com/fizzyade/pingnoo
Farge
Version: 1.0.5 Web: https://github. com/sdushantha/farge
Tty-share
Version: 2.0 Web: https://github.com/ elisescu/tty-share
Png2svg
Version: 1.3.2 Web: https://github. com/xyproto/png2svg
Deskreen
Version: 1.0.2 Web: https://github. com/pavlobu/deskreen
Games HOTPICKS
Super Bombinhas
Version: 1.0.0 Web: https://github. com/victords/super-bombinhas
Pomodoro
Version: GIT Web: https://github.com/ nardinan/pomodoro
CODING ACADEMY
Coding the arcade classic Space Invaders
Calvin Robinson will always extend the hand of friendship – unless menacing aliens are descending from the skies, in which case… blast ‘em!
How to code diagrams, graphs and pie charts
Mihalis Tsoukalos explains how to use Mermaid to create beautiful technical graphs and diagrams you can reuse and update anywhere
Chat
X
Pocketmags Support