You are currently viewing the Canada version of the site.
Would you like to switch to your local site?
7 MIN READ TIME

NODE-RED

Start using MQTT for sensor logs

Les Pounder is a sensitive soul and his new office needs sensors to record data. He’d better break out the maker kit!

Credit: http://nodered.org

OUR EXPERT

Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his adventures and projects at http://bigl.es.

YOU NEED

> Pico W

> Breadboard

> DHT11 sensor

> 3x male-tomale jumper wires

> Network

> Code: https://github.com/lesp/LXF312-PicoW-MQTT/archive/refs/heads/ main.zip

The Internet of Things (IoT) is hard, right? Wrong. It is easy thanks to MQTT and Node-RED. For this tutorial, we are building a simple Raspberry Pi Pico W-powered sensor that sends data to a Pi-powered dashboard running on Node-RED. The protocol that we’re using is called MQTT and there are more details in the boxout (opposite page).

There is only one sensor connected to the Pico W. This is a common DHT11 temperature and humidity sensor, which can be picked up cheaply and is often bundled in electronics kits. The DHT11 has only three connections to the Pico W: 3V, Data and GND (red, yellow and black wires in the diagram). Please refer to the high-res image in the download for this issue.

While holding the BOOTSEL button, connect your Pi Pico to your computer. Go to https://bit.ly/lxfupdate and download the version of MicroPython for your Pico or Pico W. Open your file manager, go to the downloaded file and copy it to the root of the RPI-RP2 drive. This flashes the new firmware to the Pico. Using your distro’s package manager, install Thonny. For the latest Ubuntu release we have to use a Snap package:

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 $1.39
SUBSCRIBE NOW
30 day trial, then just $13.99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
March 2024
VIEW IN STORE

Other Articles in this Issue


Linux Format
codeclub
www.codeclub.org.uk
Linux Format
The #1 open source mag Future Publishing Limited,
WELCOME
MEET THE TEAM
This issue, we’re looking at exciting new distributions, so what new distro have you tried recently that you would recommend readers try for themselves?
Cutting edges
Living in the open source world means if
REGULARS AT A GLANCE
Linux to save Windows 10 PCs from the apocalypse?
240 million PCs could be scrapped after October 2025, when free support ends for Windows 10. Or users could just switch to Linux.
Cosmic looking out of this world
Pop!_OS Cosmic DE is to be released as an alpha, with a new terminal and overhauled graphics support.
Chromium Wayland accelerated!
VA-API now works on Linux Ozone/Wayland platform.
NEW YEAR RELEASE!
Italo Vignoli is one of the founders of
DATABASE BASES
David Stokes is a technology evangelist at Percona.
Unity bans VLC plugin
Unity management making friends and influencing people.
OpenWrt router?
OpenWrt floats the idea of its own hardware router.
Man writes kernel in Rust
Maestro is a Unix-like kernel written from scratch in Rust.
Distro watch
What’s behind the free software sofa?
WILY WESTON
Marius Vlad is a senior software engineer at
REISER’S GUILT
Jon Masters is a kernel hacker who’s been
Kernel Watch
Jon Masters keeps up with all 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 answers@linuxformat.com
Mailserver
WRITE TO US Do you have a burning
HotPicks
Shotwell YouTube Downloader Plus Blue Recorder EncryptPad Buttercup Resources Rnote heXon EDuke32 Delta Chat Proton VPN
OLD-SCHOOL HACKING 101
CREDIT: Magictorch LXF313 will be on sale Tuesday
REVIEWS
Intel Core i7 14700K
Jacob Ridley thinks this is a perfectly good stand-in for a Core i9.
RlxOS 2023.11
Nate Drake finds himself washed up on the rock of ages that is RlxOS , only to discover that it still needs work.
Emmabuntüs 5
Nate Drake finds that despite being hard to pronounce, the name is the only complicated thing about this Debian-based distro.
Manjaro 23.1 Vulcan
Nate Drake boldly goes to take Vulcan for a test spin and finds an incredibly user-friendly and efficient operating system.
ROUNDUP
Password managers
RoboForm Keeper NordPass KeePass 2 Bitwarden
THE 5 BEST NEW DISTROS
THE 5 BEST NEW DISTROS
Blast off into the future with Matt Holder as he explores the technology powering a new generation of Linux distributions.
Pi USER
Let them eat lots of Pi!
Hundreds of thousands of Raspberry Pis are hitting the market, with production ramped to the max!
ProPico
Better by design.
Cyberdeck
Survive anything!
PEERLESS PIN NUMBERS
Les Pounder works with groups such as the
Official Pi 5 Case
Can the new official Raspberry Pi 5 case keep the Pi 5 cool? Les Pounder is – brace yourselves readers – on the case…
Geniatech XPI 3566 Zero
All brains and no brawn applies equally to this SBC and to Les Pounder.
IN DEPTH
Orange Pi vs Raspberry Pi
Tam Hanna compares the highest-end single-board computer offerings from Shenzhen Xunlong and the Raspberry Pi Foundation to find out which one is best suited for you.
TUTORIALS
Monitor systems in style
Shashank Sharma doesn’t look dapper in his quickly fading imitation leather jacket, but his terminal is always a sight to behold.
Secure and private comms made easy
Nick Peers takes a fresh look at an old favourite – Jami, a tool that aims to cover all your communication and sharing needs.
Make a Mealie of it
David Rutland dons a tall hat to prepare you a portion of Mealie – a sophisticated recipe management server with a side of meal planning.
Rescue and back up your retro media
Christian Cawley has some old Commodore 64 5.25-inch disks, and wants to revisit some personal files from 40 years ago.
Create NPCs and their conversations
Nate Drake invites you to relive the glory days of point-and-click adventure games by creating your very own.
Emulate an analogue computer digitally
In our continuing journey into analogue computing, Mike Bedford looks at another emulation approach, and how to get a real analogue computer.
The wire to faster Ethernet
Searching for faster than Gigabit Ethernet, the ever frugal Neil Mohr does that compromise thing his ex told him about.
ADMINISTERIA
Do Docker like an adult!
Stuart Burns is as mad as hell and he’s not going to stand for your shoddy Docker deployments any longer!
Starlink
Wherever he may roam, Nate Drake can enjoy fast internet at a fair price.
Hatch
An easy-to-use builder that empowers Mirza Bahic’s creative expression.
PROTECT YOUR SYSTEMS
Davey Winder reveals the biggest threats that hit systems in 2023 and what’s likely to happen over 2024.
CODING ACADEMY
Write and run C64-style 6502 code
David Bolton shows how to get started writing 6502 code and provides a useful example that sorts numbers.
The LXF Shell in… the redirection redemption
Ferenc Deák continues writing shell-enhancing redirection features and hiding the odd film title for you to spot, the little scamp!
Chat
X
Pocketmags Support