Posts

How to write reliable tests for Python MQTT applications

More and more IoT applications use MQTT. It's a simple and very useful messaging framework which runs on small boards like the Raspberry Pi Pico as well as systems running under Linux, MacOS and Windows. I recently decided to add some extra functionality to Lazydoro using MQTT. The code seemed to work when run manually but I had a lot of trouble getting my automated tests working. It took quite a while to understand the problem, but the fix was simple. Intermittently failing tests are bad In the end-to-end test that was causing the problem, the code simulated the start of a pomodoro session and then checked that the correct MQTT message had been  sent. The test usually failed but sometimes passed. When I manually ran a separate client that subscribed to the message stream I could see that the right messages were being sent. Intermittently failing (or passing) tests are a nuisance. They do nothing to build confidence that the application under test is working reliably, and they are ...

How can you make your Pico/Pico W project portable?

Image
In this article you'll learn how to solder the Pimoroni Lipo Shim for Raspberry Pi Pico/Pico W and use it to power your project from a single LiPo battery. You'll also discover a problem, and a solution, if you want to check the battery level remotely. Some Pico W projects need to work anywhere. Wi-Fi takes care of the connectivity, but the projects need battery power to make them truly portable. If you're building a portable project you'll find the Pimoroni Lipo Shim for Pico is a great solution. Here's how to attach and use it. Powering the Pico While you're writing the software for your Pico or Pico are you'll be using a USB cable to linking it to your host. Once your hardware and software are working you may want to free the Pico from its umbilical cord. The Pico can be powered from a battery; it's very adaptable, working off an input voltage that can range from 1.8 to 5.5 volts. The Pimoroni Lipo Shim for Pico takes advantage of t...

Raspberry Pi PicoW projects on Tom's Hardware PiCast

Image
A few days ago I was asked to present some of my Raspberry Pi Pico W projects on the PiCast from Tom's Hardware . Editor Avram Piltch ( @geekinchief ) was the super-friendly host as usual, and Les Pounder ( @biglesp ) told us about his Pico W-based webserver. Raspberry Pi expert  Ash Hill  added to the fun. Ash edits Tom's hardware's monthly Best Raspberry Pi Projects feature - always worth a read. Pico W projects a-plenty I had to dig out an extra USB hub to drive all the projects I showed! Missed it? Don't worry! You can watch a recording on YouTube :

Connect the Raspberry Pi Pico to an OLED using Grove breakouts

Image
In this short article you'll learn how to make and use a compact, inexpensive adapter that will allow you to connect a Raspberry Pi Pico/PicoW to Grove I2C peripherals. With a Grove to Stemma QT/Kwiic adapter cable, you can also connect your Pico/PicoW to Adafruit and Sparkfun I2C devices. You'll laso learn a useful hack that lets you connect the 2mm spaced Grove adapters to a 0.1" spaced (2.54mm) pcb. Grow with Grove Regular readers will know I love breakout boards. One of the projects that I've been working on is a Raspberry Pi Locator. It reads updates from the @rpilocator RSS feed, and it tells you when and where Raspberry Pi stock is available. The Pico W will sound a buzzer when there's stock around, but it would be great if it could tell you which stores had the Pis. On OLED display would keep things compact, and I thought I'd hook one up. Seeed studios have a great range of Grove breakouts with an easy-to-use connection system, and I knew...

Simple, repeatable deployments in a MicroPython environment

Have you ever suffered from "It works on my machine"? Most of us have, as users (well, it doesn't work on mine!") or as developers ("what have I done wrong this time?".  The cause is almost always down to something that's on the developer's machine that they have forgotten about, but make use of. That something doesn't get included in the installation process, so users may not have it installed. There's a great way to avoid that. Testing an installation process if you have an OS If the software you're developing runs under an Operating System, run the installation in a freshly-created virtual machine. That will ensure that you start without  somethings installed. You'll only have the software that's specified in your installation process. If that works, you're in good shape. What about installing MicroPython software on devices like the Raspberry Pi Pico? Testing an installation process for MicroPython projects A comparabl...

Seven secrets of the Raspberry Pi Pico's success

Image
The Pi Pico sold well; the Pico W has sold out several times since its launch. With two million units planned for production this year, the Pico shortage will be temporary, but it's a sign that the new Pico W is going to repeat the amazing success of the original Raspberry Pi. Pico W Why is it selling so well? What's the secret? Yesterday I jointed a group of friendly and knowledgeable enthusiasts for  an online meeting of the Melbourne MicroPython Meetup . It's not just a user group. Damien George gave a talk about the Rapsberry Pi Pico W. Damien is the creator of MicroPython, and he was responsible for the MicroPython port with Wifi support. The software was available on the day that the Pico W launched. In the discussion that followed, several of us speculated about the secret sauce that made the Pico/Pico W so successful. We concluded that there was no single factor, but that several features combined to make them so attractive. Seven key features What helped to catap...

Make your own strip-board breakout boards

Image
A useful trick for Makers In this article you'll see when you should build your own breakout boards, and you'll learn a useful trick to use when making them. Breakout boards rock Digital Makers can often make projects faster by using breakout boards. A breakout board is a small but useful module that you can use to compose your project. There are hundreds of breakout boards available. Many are based on tiny SMD chips that are tricky to solder. You can save time and reduce the risk of mistakes by buying a ready-made breakout board. Here's an Adafruit breakout board I used in the Raspberry Pi version of Lazydoro. Of course, you can only buy a ready-made board if you can find one that does what you need, If there isn't, consider making one! Why bother with self-built breakouts? Why not just put everything you need on the main project board? There are advantages to a design that uses pluggable modules. You can usually test the module on its own, and th...