Project Overview
Developing embedded projects usually requires all physical hardware (displays, sensors, buttons) to test code. This increases costs, slows down prototyping, and often creates messy test setups with multiple wires and breadboards.
This project proposes a small open-source library of Fake Drivers that allows developers to:
-
Run the same microcontroller code on a PC using simulated hardware interfaces.
-
Seamlessly switch to real hardware if connected, without modifying the code.
-
Test and prototype embedded applications without cluttered testboards or unnecessary wiring.
The main goal is to speed up development, simplify debugging, and reduce hardware dependency during early prototyping.
Core Concept
-
Fake Drivers provide the same API and function calls as the original hardware libraries, so developers do not need to rewrite code.
-
Each Fake Device appears on the PC as a visual interface:
-
Display→ opens a window representing the real screen. -
Button→ appears as a clickable button on the GUI that triggers events like a real button press.
-
-
When real hardware is connected, the Fake Drivers automatically bypass simulation and interact with the actual devices.
-
This allows testing realtime user interactions and UI logic without building a full physical prototype.
Example Usage
#include <FakeDrivers.h> // Fake Drivers library
#include <DisplayLib.h> // Original display library
#include <ButtonLib.h> // Original button library
// Define devices the same way for PC or MCU
Display display;
Button button;
void setup() {
// Initialize the display window and the button on PC
display.begin(); // Opens a window representing the display
button.begin(); // Shows a clickable button on the GUI
}
void loop() {
// Read the button state (real or fake)
bool pressed = button.isPressed(); // On PC: true if user clicks the button
// Draw on the display
display.clear();
if (pressed) {
display.drawText("Button Pressed!");
} else {
display.drawText("Waiting...");
}
delay(500); // Keep the loop simple for demonstration
}
How it works on a PC:
-
display.begin()→ opens a GUI window that simulates the screen. -
button.begin()→ shows a clickable button that can be pressed with the mouse. -
button.isPressed()→ returnstrueif the user clicks the GUI button. -
display.drawText()→ renders text or graphics in the display window. -
On real hardware, the Fake Drivers automatically pass calls to the real devices, no code changes required.
Key Benefits
-
Run and test embedded code on a PC before using real hardware.
-
Interact with fake devices through GUI interfaces, simulating screens, buttons, and sensors.
-
Avoid messy testboards and spaghetti wiring, making prototyping cleaner and safer.
-
Enable faster debugging, UI testing, and prototyping without purchasing every component.
-
Provides a foundation for an open-source library that can eventually support multiple MCUs and devices.
Call for Contributors
We are looking for embedded developers, students, and IoT enthusiasts to help conceptualize, design, and develop this project:
-
Share ideas for designing Fake Drivers interfaces.
-
Contribute support for additional types of devices and libraries.
-
Provide examples, demos, or GUI improvements to accelerate prototyping.
Join the discussion and help build a library that allows seamless testing of embedded code on PC and real hardware, saving time, reducing costs, and avoiding messy test setups.