Most embedded projects live in one toolchain, but real systems rarely do. They often combine multiple microcontrollers, each developed where engineers feel most comfortable.
This demo shows how those environments can come together to form one connected system: a smart greenhouse roof that opens automatically when rain is detected or can be opened/closed manually by interacting with a touch panel.
The project brings together several development environments, each handling a specific role in sensing, decision-making, and control, all communicating seamlessly through UART. In the sections ahead, we’ll walk through how each piece was built: configuring liquid detection in MPLAB® Data Visualizer, touch control in MPLAB for VS Code, and system coordination with Zephyr RTOS.
At the center of the system is the SAM E54, running Zephyr RTOS as the main controller.
It receives inputs from two sources:
- MTCH9010: rain detected →open roof
- PIC32CM GC00: touch slider or buttons → manual open/close
The SAM E54 processes each event, decides what action to take, and sends a UART command to the AVR® EB Smart Stepper Motor Board, which drives the motor to move the roof.
Each part of the greenhouse demo was developed using a different toolchain. This section walks through how each piece was built and how the development environment shaped its role in the system.
MTCH9010 – Liquid Detection Setup in MPLAB® Data Visualizer
The MTCH9010 is a hardware-based liquid detection IC that senses both conductive and capacitive liquids. It’s a self-contained device that requires no firmware and outputs a digital signal when liquid is detected. Configurable parameters such as detection thresholds and sleep periods let it adapt to different sensing conditions or power requirements. Because detection happens entirely in hardware, it reacts instantly and consumes very little power, ideal for always-on systems like this smart greenhouse roof.
You can configure the MTCH9010 in several ways:
- Onboard slide switches – the simplest method for adjusting sensitivity and detection behavior directly on the board.
- UART terminal – allows configuration from a PC using serial commands over USB, useful for precise tuning and testing.
- MPLAB® Data Visualizer MTCH9010 Extension – a graphical tool that provides real-time visibility into sensor data and lets you adjust settings through an easy-to-use interface.
If you’d like to explore these configuration methods in more detail, the MTCH9010 Getting Started Guide and MPLAB® MTCH9010 Plugin User Guide walks through each option step by step.
For this demo, the Data Visualizer Extension was used to fine-tune detection and verify stable performance. Once configured, the MTCH9010 outputs a digital signal to the SAM E54, which interprets it as a “rain detected” event and closes the roof.
Below is a GIF showing the MTCH9010 Data Visualizer Extension in action, along with a labeled diagram of the MTCH9010 Evaluation Kit for reference.
PIC32CM GC00 – Touch Interface Configuration in MPLAB® Tools for VS Code
The PIC32CM GC00 (Arm® Cortex®-M23) handles manual user control through a QT7 XPLAINED PRO extension kit. Using MPLAB Code Configurator for VS Code and the MPLAB® Touch Library, the device’s Peripheral Touch Controller (PTC) can be configured entirely through a visual interface, no low-level register coding required.
The MPLAB® Tools extension for VS Code lets you do everything from one workspace: open MCC, tune touch channels, view signal graphs, and generate code directly into your project. Shown below is the Touch Library configuration panel, where touch channels and thresholds are defined before code generation.
The MPLAB® Tools extension for VS Code lets you do everything from one workspace: open MCC, tune touch channels, view signal graphs, program and debug the device, and generate code directly into your project. Shown below is the Touch Library configuration panel, where touch channels and thresholds are defined before code generation.
Once generated, the firmware uses the library’s functions to detect button and slider inputs and send UART frames to the SAM E54. The SAM E54 interprets those frames and forwards a command over UART to the AVR® EB stepper controller, which spins the motor to move the roof according to the UART message.
Each button and slider “zone” corresponds to a specific UART value, allowing smooth manual roof control.
Below is a snippet from the firmware showing how button and slider inputs are mapped to UART frames:
// Button zones → UART mapping
uint8_t Mess1[] = {0xA0, 0x01, 0x5A}; // CLOSE
uint8_t Mess2[] = {0xA0, 0x01, 0x00}; // OPEN
if (curr_button0_pressed && !prev_button0_pressed) {
SERCOM2_USART_Write(Mess1, sizeof(Mess1));
}
if (curr_button4_pressed && !prev_button4_pressed) {
SERCOM2_USART_Write(Mess2, sizeof(Mess2));
}
// Slider zones → UART mapping
uint8_t Slider6[] = {0xA0,0x01,0x5A};
uint8_t Slider5[] = {0xA0,0x01,0x45};
uint8_t Slider4[] = {0xA0,0x01,0x36};
uint8_t Slider3[] = {0xA0,0x01,0x2D};
uint8_t Slider2[] = {0xA0,0x01,0x15};
uint8_t Slider1[] = {0xA0,0x01,0x00};
switch (curr_slider_zone) {
case 6: SERCOM2_USART_Write(Slider6, sizeof(Slider6)); break;
case 5: SERCOM2_USART_Write(Slider5, sizeof(Slider5)); break;
case 4: SERCOM2_USART_Write(Slider4, sizeof(Slider4)); break;
case 3: SERCOM2_USART_Write(Slider3, sizeof(Slider3)); break;
case 2: SERCOM2_USART_Write(Slider2, sizeof(Slider2)); break;
case 1: SERCOM2_USART_Write(Slider1, sizeof(Slider1)); break;
default: break; // Not touched
}The PIC32CM GC00 handles touch locally, sends frames to the SAM E54, and the SAM E54 relays motor commands to the AVR EB, a clean, MCC + VS Code workflow for fast, reliable prototyping
SAM E54 – System Coordination in Zephyr RTOS
The SAM E54 acts as the main controller, running Zephyr RTOS to coordinate communication between the MTCH9010, PIC32CM GC00, and AVR® EB Stepper Board. It listens for a detect signal from the MTCH9010 and UART frames from the PIC32CM GC00, decides the appropriate system action (open or close), and sends a corresponding UART command to the AVR EB Stepper Board to move the roof.
Zephyr simplifies this by separating hardware mapping The PIC32CM GC00 handles touch locally, sends frames to the SAM E54, and the SAM E54 processes the data and relays motor commands to the AVR EB.from application logic. The app_board.overlay defines how peripherals connect to the SAM E54, mapping GPIO inputs, UART interfaces, and LED outputs, while main.c handles all control logic.
Shown below are some example definitions from our app_board.overlay for this project:
/* Detect input from MTCH9010 */
mtch9010_signals {
compatible = "gpio-keys";
mtch9010_detect: gpio {
gpios = <&portb 0 GPIO_ACTIVE_HIGH>;
label = "MTCH9010 Detect";
};
};
/* UART channel for GC00 data */
&sercom1 {
status = "okay";
compatible = "microchip,sercom-g1-uart";
current-speed = <115200>;
};Microchip’s Zephyr board files already define the common peripherals (SERCOM UARTs, GPIOs, etc.), so the project overlay simply extends that configuration by specifying where application-specific peripherals are located, what drivers they use, and any parameters that need to be set. Zephyr’s Devicetree system then takes care of applying those pin assignments and connections automatically behind the scenes.
Inside main.c, these overlay-defined nodes are accessed directly using the labels assigned in Devicetree:
#define WATER_NODE DT_NODELABEL(mtch9010_detect)
static const struct gpio_dt_spec water_in = GPIO_DT_SPEC_GET(WATER_NODE, gpios);
static const struct device *const uart_in = DEVICE_DT_GET(DT_NODELABEL(sercom1));
static const struct device *const uart_out = DEVICE_DT_GET(DT_NODELABEL(sercom5));The main loop continuously monitors inputs and sends commands to the AVR EB stepper board:
if (water_is_active()) {
uart_out_frame(VAL_CLOSED); // Close roof on rain detect
} else {
commit_slider_if_idle(); // Manual slider input from GC00
}Together, the overlay defines the connections, while my code in main.c defines the behavior, creating a clean, maintainable structure that cleanly separates configuration from logic.
️AVR® EB Stepper Motor Controller – Motor Movement in MPLAB® X IDE
The AVR® EB serves as the actuator for this system, translating UART commands from the SAM E54 into precise motion. It’s based on Microchip’s Smart Stepper Motor Controller reference design, which uses the AVR® EB family of MCUs to generate the required waveforms for stepping, half-stepping, or microstepping.
Because waveform generation is handled by the AVR EB MCU itself, the motor can run independently, without needing real-time control from the SAM E54. This allows smooth, reliable motion even when other parts of the system are busy.
Firmware development was done in MPLAB® X IDE, based on a Motor Control code example that uses the AVR® EB Stepper Motor reference design. The example source code, available on MPLAB® Discover, was reused and adapted for this demo. When the SAM E54 sends a UART frame that corresponds to an open or close command, the AVR EB interprets the message and drives the motor to the target position.
While the PCB attached to the motor is a custom reference design, this function block can be replicated using:
- Multi-Phase Power Board (MPPB) – EV35Z86A
- AVR EB Curiosity Nano Adapter – EV88N31A
- AVR EB Curiosity Nano – EV73J36A
Together, these boards recreate the same control stage used in the demo and provide a flexible platform for stepper motor development. The firmware image for this setup is available here.
Bringing It All TogetherThis project demonstrates how multiple development environments can work in harmony to create a single, intelligent application. Each device was developed using the tools best suited for its role:
- MTCH9010 – Configured with the MPLAB® Data Visualizer Extension for real-time tuning and visualization.
- PIC32CM GC00 – Developed in MPLAB® Tools for VS Code using MCC and the Microchip Touch Libraries for a responsive, moisture-tolerant touch interface.
- SAM E54 – Runs Zephyr RTOS, handling coordination, logic, and communication between all system components.
- AVR® EB – Driven by Microchip Motor Control Libraries to control the stepper motor that moves the greenhouse roof.
This project is more than just a demo, it’s a reflection of Microchip’s ongoing commitment to enabling developers to work within their toolchain of choice. Whether you prefer MPLAB X, VS Code, or Zephyr, our goal is to make it easy to bring these ecosystems together into one seamless, connected design.








_SPmZ63wPgQ.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments