🚜 Wall-E on Zephyr


I worked on a robot Wall-E - a self-balancing, line-following bot. The earlier version was built using ESP32 and FreeRTOS, and you can find that on GitHub.

But for this project, I wanted to take it a step further and try out Zephyr RTOS on the Beagleconnect Freedom board. It wasn’t just a port, a deep dive into PWM APIs, ADCs, UARTs, and the (in)famous Devicetree overlays in Zephyr.


# What it does


# Why Zephyr?

I have already played with FreeRTOS, but Zephyr caught my eye for a few reasons:

That said, Devicetree overlays were… a journey 😅


# Devicetree Overlays

Here's an example overlay I wrote to enable pwm0:

&pwm0 {
status = "okay";
};

&pwmleds {
compatible = "pwm-leds";
led1: pwm_led_1 {
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};

And I could get motors running -

And for ADC:

&adc {
status = "okay";
channel@0 {
reg = <0>;
zephyr,channel-id = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
};
};

We also got to enable drivers in prj.conf:

CONFIG_PWM=y
CONFIG_ADC=y
CONFIG_UART_CONSOLE=y

# Challenges I Faced

Devicetree overlays took a while to understand, especially how to structure them and which nodes to patch.


# Resources