Project Overview
"ARTe-Core" represents a significant departure from the standard "Super-Loop" architecture of traditional Arduino sketches. By integrating the ERIKA Enterprise real-time kernel, this project transforms the Arduino Uno into a multitasking powerhouse capable of Preemptive Scheduling. Instead of a single sequential code path, the system runs multiple concurrent loops with deterministic timing, ensuring that high-priority safety tasks (like collision detection) are never blocked by lower-priority logging or display routines.
Technical Deep-Dive
- ERIKA Enterprise Kernel Forensics:
- The Preemptive Scheduler: Unlike the cooperative multitasking found in some Arduino libraries, ERIKA uses a preemptive scheduler. If a high-priority task enters the "Ready" state, the kernel immediately pauses the current task, saves its context, and switches execution to the priority task, ensuring microsecond-level responsiveness.
- RTOS Objects: The system utilizes Tasks, Resources, and Alarms. Alarms trigger task execution at fixed intervals (3ms, 7ms), creating a "Heartbeat" for the entire embedded system.
- Task Isolation & Concurrency:
- Task A (Safety Critical - 3ms): Dedicated to the HC-SR04 ultrasonic sensor. This task executes at a 333Hz frequency, providing ultra-responsive distance monitoring. If an obstacle is detected within 10cm, the "Alarm" LED is triggered with near-zero latency.
- Task B (I/O Pulse - 7ms): A background heartbeat task that toggles a diagnostic LED. This demonstrates the kernel's ability to maintain timing accuracy even while other tasks are performing heavy I/O.
- Task C (Environmental Monitoring): Polls the LM35 temperature sensor. Because temperature changes slowly (low-frequency data), this task is assigned a lower priority, ensuring it doesn't starve the high-speed ultrasonic task of CPU cycles.
- ARTe Framework Enhancements:
- Mutual Exclusion (Mutex): Standard Arduino libraries are often non-reentrant. ARTe enhances these libraries with "Critical Sections," ensuring that if two tasks attempt to access the
DigitalWritefunction simultaneously, the kernel manages the bus access to prevent data corruption.
- Mutual Exclusion (Mutex): Standard Arduino libraries are often non-reentrant. ARTe enhances these libraries with "Critical Sections," ensuring that if two tasks attempt to access the
Engineering & Implementation
- Deterministic Timing Analysis:
- By shifting to a Real-Time OS, the engineer can guarantee Worst-Case Execution Time (WCET). In this project, the the HC-SR04 trigger-to-echo logic is isolated within its own memory stack, preventing the "Jitter" common in vanilla Arduino code where
dalay()or long loops can break timing.
- By shifting to a Real-Time OS, the engineer can guarantee Worst-Case Execution Time (WCET). In this project, the the HC-SR04 trigger-to-echo logic is isolated within its own memory stack, preventing the "Jitter" common in vanilla Arduino code where
- Memory Stack Forensics:
- Running an RTOS on the ATmega328P is a challenge due to its 2KB SRAM limit. ARTe manages this by allocating discrete stacks for each concurrent loop. This requires precise memory profiling to ensure that task recursion doesn't lead to a "Stack Overflow."
- Windows-Optimized Toolchain:
- The project utilizes a specialized ARTe toolchain that integrates directly with the Arduino IDE. This provides an abstraction layer where users can define multiple
loop()functions (e.g.,loop1(),loop2()) and assign their respective periods and priorities via a GUI or specialized header.
- The project utilizes a specialized ARTe toolchain that integrates directly with the Arduino IDE. This provides an abstraction layer where users can define multiple
Conclusion
ARTe-Core is a professional-grade gateway into the world of industrial embedded systems. By mastering Fixed-Priority Preemptive Scheduling, developers can move beyond simple hobbyist sketches toward complex, safety-critical applications in robotics, automotive, and industrial automation.