Exploring Hardware-in-the-Loop Testing with Green Custard

Exploring Hardware-in-the-Loop Testing with Green Custard

Summary

Green Custard is at the forefront by using the Raspberry Pi Pico for Hardware-in-the-Loop (HIL) testing. This clever method combines real hardware with simulation software, allowing for thorough testing that traditional methods can’t achieve.

HIL testing creates a realistic environment to check how the hardware performs. In this blog, we’ll explore a case study on how Green Custard’s approach is changing the way we test technology and ensuring high quality and reliability. Let’s dive into the world of hardware testing!

Introduction

This is a case study of Aqua Libra Co an SME-sized company in the Testing, sensing, and control Industry.

Aqua Libra Co, a brand under UK drinks giant Britvic, is dedicated to creating a sustainable future for drink dispensing in workplaces and retail, driven by their “Healthy People, Healthy Planet” mission.

In collaboration with Amazon Web Services (AWS) and Green Custard, they developed the Aqua Libra Flavour Tap, which eliminates single-use packaging by delivering beverages directly into reusable containers.

This innovative tap offers still or sparkling water along with a variety of flavors.

Complex control systems within the tap react to user inputs and transmit flavor cartridge data to Amazon.com. A single system manages the dispensing procedure, regulating pumps and valves to guarantee precise dosages for every beverage composition.

In order to guarantee the seamless functioning of this state-of-the-art device, Green Custard needed a reliable way to test the hardware and software on the dispensing control board.

 

Also, read How Raspberry Pi Transformed Bio Business

The Challenge of Detecting Software Bugs in Embedded Systems

Finding bugs in software can get really expensive as you go through development and deployment. Some studies say fixing a bug early might cost about $100.

But if you find it after the software is already out there, it can cost tens of thousands of dollars! And those tricky bugs that pop up sometimes are even harder to deal with—they often can't be repeated in tests, so they might just be ignored.

While looking over the code can help catch some errors, testing is super important in software development. There are different kinds of tests, like unit tests and integration tests. But when it comes to embedded systems, things get complicated.

These systems need inputs from outside sensors that change over time, making it tough to test. That’s where Hardware-in-the-Loop (HIL) simulation helps.

It lets you create those external signals automatically, so you can see how the software acts under different situations without needing to do it by hand.

Take the Aqua Libra dispense controller, for example. It uses a small computer with a real-time operating system to check weight, fluid flow, and control motors and valves. When testing manually, you must first start the dispense by setting a container on a scale.

Then, you must keep an eye on the pumps and valves to make sure the correct liquid is dispensed. In order to replicate liquid flow, you must also generate pulses similar to those produced by an electronic flow sensor.

Though these may seem like a lot, they are necessary to ensure that everything functions properly!

 

Read this blog about The Role of Raspberry Pi in Sfera Labs

Implementing the Solution for Effective HIL Testing

The Raspberry Pi Pico, built on the RP2040 microcontroller, is a great fit for Hardware-in-the-Loop (HIL) testing. For Aqua Libra’s dispense controller, we used its Programmable Input/Output (PIO) block to create fast serial data, simulating a strain gauge like one from a 24-bit ADC. We can set the ADC output as needed, triggering events in the system we’re testing.

The PIO also helps mimic the output from a flow sensor, and the simulated data feels just like the real thing! Plus, it can track the movements of stepper motors, even when they’re moving really fast, giving us great insight with this low-cost testing tool.

As we run tests, we also keep an eye on solenoid and valve states. The RP2040 has two PIO blocks, but to monitor all the inputs and outputs, we daisy-chain multiple RP2040s together.

This means we need a special communication method to talk to each board during a test and collect data quickly. We sample the I/O states at 20Hz and save that info in a time series database with a unique test ID. After testing, we can use Grafana to create dashboards that show this data, which is super helpful for the hardware and mechanical teams.

The whole setup is automated and can run thousands of tests without needing anyone to help. Each testing node uses the same software, but we can identify them uniquely with jumper leads, making it easy to customize their functions.

 

Check out the case study of Remote Learning for Nursing Students in Kenya and Malawi with Raspberry Pi

Why Raspberry Pi Pico is Ideal for HIL Testing?

The Raspberry Pi Pico is a great choice for testing, and here’s why:

  • Cost: The whole PCB, including the power supply and flash storage, costs less than £4. This is perfect for setting up multiple testing stations, and if one gets damaged, it’s easy to replace without breaking the bank.
  • Size: The Pico uses 40-pin DIL headers, which can be directly soldered to a PCB or connected with low-profile headers, making replacements a breeze.
  • Programmable Input/Output (PIO): Green Custard says PIO is “a superb idea” because it offers incredible flexibility for testing.
  • Ecosystem: The Raspberry Pi community is large, with many blog posts, GitHub repositories, YouTube tutorials, and forums that provide useful information and aid in accelerating development.
  • Availability: Despite the global silicon scarcity, Raspberry Pi Pico was still widely available, allowing us to order with confidence.

“Programmable I/O (PIO) is an incredibly flexible feature of Raspberry Pi Pico. It allows for the development of hardware interfaces that would be difficult without a full-blown FPGA implementation. The parts cost and the power provided by PIO made Pico a compelling choice. The SDK is well documented and there are many useful code examples in the accompanying GitHub repo. Pico is my preferred part for low-cost, low-volume development. I am pleased with the HIL testing framework. It gives me confidence that any change made to the software running on the target hardware has not introduced any regressions and performs as expected.”

- Neil Bryan, Principal Consultant, Green Custard

 

Also know Yodeck’s Success Story

Comprehensive HIL Testing Results

Thanks to the flexibility of the HIL testing tool, Green Custard can run countless combinations of drink recipes in an automated setup. A single test can request thousands of dispenses, requiring hours to complete while verifying each pump step and valve cycle. Doing this by hand would be nearly impossible!

The test results can be viewed in two ways: as simple pass or fail texts, or as detailed graphs, similar to a logic analyzer.

In Green Custard’s system, the test results are saved as records in an Influx time series database. A JSON file holds metrics that help decide if a test has passed or failed. A Python script pulls the relevant metrics from this file and stores them for analysis.

After a test finishes, the Influx database is checked for specific details, like the number of pump motor steps or how long a valve stayed open, all measured to the millisecond.

For a more visual take, they use Grafana, an open-source analytics tool. This helps teams not directly involved in software, like flavor developers, see if the dispensing times and sequences are correct.

For example, one of the charts shows the dispensing progress, while another tracks changes over time and a third shows when the control elements open and close.

This level of information, combined with the ability to test numerous input situations, makes for an extremely effective testing tool.

The Raspberry Pi Pico allows Green Custard to develop a low-cost solution for emulating various sensors and measuring how outputs vary. They can monitor component states in real-time and save the data for future analysis.

The entire process is automated, running thousands of tests without any human help.

Green Custard’s Hardware-in-the-Loop system can also test failure conditions that would be hard or impossible to recreate in real life, helping to ensure the software is robust.

Without the Raspberry Pi Pico, finding intermittent bugs that could cause issues in the field would be very challenging. Thanks to HIL, Britvic can trust that the Aqua Libra Co Flavour Tap will work as intended!

 

Read the full case study here!

Source: “Hardware-in-the-Loop testing by Green Custard” https://www.raspberrypi.com/success-stories/hardware-in-the-loop-testing-by-green-custard/. Raspberry Pi, Accessed 27 September 2024.

To read the full story Download PDF

Conclusion:

Green Custard is making great strides with their use of Hardware-in-the-Loop (HIL) testing and the Raspberry Pi Pico.

This smart setup helps them find problems early in the Aqua Libra Co Flavour Tap, which aims to reduce single-use packaging and be more eco-friendly. By testing everything carefully, they make sure the tap works well and meets customer needs.

Their automated system's ability to independently execute hundreds of tests is astounding! Time is saved, results may be checked more easily, and the product can be improved for increased dependability.

It's an excellent illustration of how technology can support a healthier planet and make our jobs easier.

Components and Supplies

    You may also like to read

    Frequently Asked Questions

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.

    Components and Supplies

      You may also like to read