78 views|0 replies

143

Posts

0

Resources
The OP
 

Raspberry Pi Pico can also support powerful and reliable automated testing! [Copy link]

This post was last edited by Raspberry Pi Developer on 2024-7-29 15:23

The sustainability initiatives of Britvic-owned Aqua Libra Co rely on robust, reliable dispensing equipment. Green Custard designed a testing solution that leverages the flexibility of the Raspberry Pi Pico to provide rigorous testing that would be difficult to achieve otherwise.

solution

Raspberry Pi Pico

Enterprise scale

Small and Medium Enterprises

industry

Testing, sensing and control

In line with its mission of "Healthy People, Healthy Planet", Aqua Libra Co, owned by British beverage giant Britvic, is working towards a sustainable future for workplace and retail beverage dispensing. The company has partnered with Amazon Web Services (AWS) and Cambridge-based professional services company Green Custard to develop the Aqua Libra Flavour Tap, which eliminates the need for single-use packaging by delivering beverages directly into reusable containers. The tap can dispense still or sparkling water and a variety of flavours.

There are several control systems within the faucet, one of which reacts to user input and passes flavor cartridge information to AWS. Another controls dispensing directly, switching valves and solenoids at precisely controlled times, and actuating pumps to get the exact amount of flavor for a specific beverage recipe. As part of Green Custard’s work to help develop the faucet, a solution was needed to test the software and hardware running on the dispensing control board.

challenge

The cost of finding bugs increases exponentially throughout the development and deployment process. Several studies have revealed the cost of resolving bugs, ranging from $100 for an early change request to tens of thousands of dollars for a fix after the software has been deployed. It can be very difficult to replicate an intermittent bug seen in the field, and unless the bug can be observed, it is likely to be marked as "unreproducible" and ignored.

Reviewing code can reveal implementation errors that may manifest as bugs, but testing is the cornerstone of modern software development. It comes in many forms, including unit testing, integration testing, and more. Testing software running on embedded systems can be particularly difficult because the device under test often requires input from external sensors that provide signals that change over time. The solution is to simulate these external signals, which allows the embedded software to run as if it were running in a complete system, not just an isolated test setup.

Inputs can be simulated using a technique called Hardware-in-the-Loop (HIL). Using HIL, sensor inputs can be generated automatically without user interaction. This helps in testing the behavior of the software under different conditions.

The Aqua Libra dispensing controller consists of a microcontroller running a real-time operating system to monitor weight and fluid flow, as well as drive stepper motors and electromechanical valves. Manual testing requires placing the container on a weight measuring device for dispensing. The subsequent valve switching and pump activity need to be monitored to confirm that the expected beverage has been dispensed. At the same time, the flow of the liquid needs to be simulated by generating a series of pulses, just like the pulses produced by an electronic flow sensor.

solution

The Raspberry Pi Pico is based on the Raspberry Pi's RP2040 microcontroller and has peripherals that are very useful for HIL testing. In the test harness for the Aqua Libra dispensing controller, the Programmable Input/Output (PIO) block is used to generate very fast serial data, as if from a 24-bit ADC, to simulate a strain gauge. The ADC output can be set arbitrarily and trigger events on the system under test. The PIO is also used to simulate the output of a flow sensor, with the simulated output being indistinguishable from the output of the real hardware. The unit under test drives a number of stepper motors, and the PIO is used to read the two-phase motor drive output, regulated via optocouplers. This approach can measure every step applied to the motor, even when the step rate is in the kHz range. It provides an unprecedented level of instrumentation for low-cost test harnesses.

Likewise, solenoid and valve states are monitored as the test progresses. The RP2040 contains two PIO blocks, with a single stepper channel using all programs from a single PIO. Therefore, it was necessary to daisy-chain multiple RP2040s to be able to monitor all I/Os of the board under test. This required a novel serial communication technology that could address a unique board or all boards to be configured at the start of the test and recover the data as quickly as possible during the test. The I/O state of the unit under test is sampled at 20Hz, and the collected data is written to a time series database along with a unique test identifier. After the test, the collected data can be plotted using Grafana, with the dashboard configured to represent a logic analyzer. This is very useful for system development by hardware and mechanical teams.

The database can also be queried and depending on the type of test the data may be processed to indicate a pass or fail condition. The entire system is fully automated and can run thousands of independent tests without human interaction. The software running on the RP2040 is the same for each test node and the GPIOs are used via jumpers to provide a unique node identification which the RP2040 application reads at runtime. This customizes the node functionality, loads the PIO program for that node and means only a single image needs to be maintained.

A PCB was designed and fabricated with a Raspberry Pi Pico on Node 0 as the master controller, with the option of connecting multiple nodes to provide more input monitoring.

The Raspberry Pi is mounted on top of the center of the board; the I/O is located on the periphery of the board

Why Raspberry Pi?

The Raspberry Pi Pico is attractive as a basis for such testing for several reasons:

  • Cost: The entire PCB, including on-board power supply and flash storage, cost less than 4. This is advantageous because multiple test setups can be made for different sites, and if the Pico fails during development, it is not a big deal.

  • Form Factor: Pico uses a 40-pin DIL connector that can be soldered directly to the PCB or use a low-profile adapter for easy replacement.

  • PIO: Green Custard reports that PIO (Programmable I/O) is an excellent design concept and allows so much flexibility that its usefulness cannot be overstated."

  • Ecosystem: The entire Raspberry Pi ecosystem—from blog posts to GitHub repos, YouTube tutorials, and the Raspberry Pi forums—provides a lot of useful information that significantly reduces development time.

  • Availability: Even during the global chip shortage, the Raspberry Pi Pico remains in stock, so you can place your order with confidence.

The board being tested is in the middle, and the Pico-based HIL boards are on the left and right.

"The Programmable I/O (PIO) is an incredibly flexible feature of the Raspberry Pi Pico. It allows for the development of hardware interfaces that can be implemented without a full FPGA implementation. The part cost and power offered by the PIO makes the Pico a compelling choice. The SDK is well documented and there are many useful code examples in the accompanying GitHub repo. The Pico is my preferred part for low-cost, low-volume development. I am happy with the HIL test framework. This gives me confidence that any changes made to the software running on the target hardware have not introduced any regressions and are behaving as expected."

result

The flexibility provided by HIL test tools allows many combinations of dispense recipes to be run in an automated environment. One test can require thousands of dispensers, and these dispenses take hours to complete, checking every pump step and valve open and close cycle. This is nearly impossible to accomplish manually. The test results can then be viewed as text-based results, ultimately a pass or fail condition, or as a graphical display similar to a logic analyzer.

In Green Custard’s system, test results are converted into records and written in batches to an instance of the Influx time series database. The test input JSON file contains the metrics used to determine whether the test passed or not. A Python script parses the JSON file, extracts the relevant metrics for that test, and stores them for use. When the test is complete, the Influx database is queried and can check for specific features; for example, the number of steps of a pump motor, or the time and duration of valve opening to millisecond accuracy.

Successful test cases

Test failed; controller 1 out of tolerance

The second graphical display of the data is provided by Grafana, an open source data analytics and visualization platform. This view allows teams not involved in software development—for example, people who develop flavors and liquid experts—to use test data to determine whether switching times and sequences are as expected. For example, the figure below shows three different charts generated in sequence during the dispensing of four separate drinks. The top chart shows data around the progress of the dispense; the middle chart shows more data related to the dispense, which changes over time; and the bottom chart shows the opening and closing of control elements within the tap.

Grafana dashboard showing system status; data descriptions have been obfuscated

This level of detail, combined with the ability to test many input conditions, makes it a powerful testing tool.

In this application, the Raspberry Pi Pico enables Green Custard to provide a low-cost solution to simulate different types of sensors and measure the resulting changes in output. The status of different components can be monitored in real time, and the collected data can be written to a time series database. Finally, and crucially, the data can be plotted on a dashboard for further analysis. The entire process is automated, with thousands of tests being run without human interaction.

Green Custard’s Hardware-in-the-Loop system supports test cases that inject failure conditions that are very difficult or even impossible to recreate on real systems, making it possible to evaluate the robustness of the software under test.

Without the Raspberry Pi Pico, identifying intermittent errors that could impact performance in the field would be difficult, if not impossible. Using Hardware-in-the-Loop, Britvic can be confident that the Aqua Libra Co Flavour Tap will perform as expected.

To learn more about how Green Custard helped develop the Aqua Libra Co Flavour Tap, read their full case study here .

This post is from Release of Information
Personal signature

WX:上海晶珩电子科技

 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Analog Circuit Basics Tutorial (eBook)

Come and download http://www.netyi.net/Resource/13373d8c-cc93-4c91-b5d2-199c75f46cf8.aspx

Children's humor

Mom called Pippi to get up: " Hurry up and get up! The rooster has crowed several times! " Pippi said: " What does the r ...

Exploration of losses in various parts of switching power supply

OverviewEnergy conversion systems inevitably involve energy consumption. Although 100% conversion efficiency cannot be a ...

Arm plans to increase licensing fees for some customers, and chip costs may increase by 4 times! What do you think about this?

Semiconductor technology supplier ARM has proposed raising licensing fees for some customers in recent negotiations, acc ...

"Support Yatli, tell us your story with Yatli" Summary of netizens' sharing

The event is in progress, welcome to join: Support Yatli, tell us your story with Yatli Summary of netizens’ sharing: ...

Briefly describe the application of embedded logic analyzer in FPGA testing.zip

Briefly describe the application of embedded logic analyzer in FPGA testing.zip

Relationship between PN conduction voltage drop and current and temperature

*) , the E junction is affected by temperature, and the change in on-state voltage drop is related to Is and Ic The cond ...

GD32L233C-START uses J-Link SWD to download and reports an error!!! Please solve

Hey guys, for the GD32L233C-START evaluation board, has anyone used J-Link to burn and debug programs (SWD)? I'd like to ...

[HPM-DIY] openmv for hpm6750 Progress 2 (face recognition 29fps+)

Openmv for hpm has been updated by the author in the past few days, mainly fixing the following: 644525 In addition, us ...

Is it reliable to let AI help you draw a power supply PCB?

Will there be a conversation like this one someday in the future: "AI assistant, help me generate the power PCB, organiz ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list