Skip to content

5. Embedded Programming

  • Group assignment:
  • Demonstrate and compare the toolchains and development workflows for available embedded architectures
  • Document your work to the group work page and reflect on your individual page what you learned

Tool Chaines

Micro Python

Following this page made by Yosuke Tsuchiay, we proceeded the work for Micro Python

Micro Python

Execute the LED blinking code written in MicroPython on the xiao ESP32-C3. Reference Install Thonny as your development environment. * Thonny IDE for Python Beginners

Conecting the xiao to your computer

First, install the interpreter code on the xiao, since Python is executed by an interpreter. To install it, first connect the board to your computer. Rsw. When connecting, hold down the button in the bottom right of the photo. This will prevent the Xiao from executing code written in main and recognize it as a USB device. If the Xiao is not recognized when writing a program, follow the same steps to connect it to your computer.

The following is the first step only.


Launch “Thonny” and select “Options” from the “Tools” menu. Menu

Configure the settings in “Interpreter” under “Options.” Interpreter First, select the board you want to install the interpreter on. Board1 Next, select the USB port number (you can use the automatic setting, but if it doesn’t read it, look up the port the Xiao is connected to on your computer and select that port). USBport1 Once you’re done, click “Install or Update MicroPython” instead of “OK.” Update-micropython Clicking this will bring up the settings screen again. Set the connected port, Python conversion format to write (ESP32-C3), Variant (Espressif • ESP32-C3), Version (1.27.0), and click “Install.” Install You’ll Close and return to the previous screen, where you’ll click “OK” to complete the setup.

InstalltoOK


programing

Once the interpreter for Python execution has been written, we can finally start writing programs in Python. programing

Code

from machine import Pin
import sys,select,time

led_pin = 5

led = Pin(led_pin,Pin.OUT)

while True:
    led.value(1)
    time.sleep(0.5)
    led.value(0)
    time.sleep(0.5)

This program blinks the LED connected to pin 5 every 0.5 seconds.

The original program was written in RP2040. Original program code

from machine import Pin
import sys,select,time

led_pin = 29

led = Pin(led_pin,Pin.OUT)

while True:
    led.value(1)
    time.sleep(0.5)
    led.value(0)
    time.sleep(0.5)

When I first copied it the same way, I got an error. The error occurred because the GPIO terminal numbers on the RP2040 and ESP32-C3 are different. Error screen

Errorcode

In the Arduino IDE, this part is set to D4 so that you don’t have to rewrite it, making it easy to reuse programs. (You can do the same thing by creating a variable D4 and rewriting its contents, but it doesn’t change when you select the board, which can be a bit frustrating.)

RP2040 GPIO RP2040pin

XIAO_RP2040_Getting_Started

ESP32-C3 GPIO ESP32C3pin

XIAO_ESP32C3_Getting_Started

The ESP32C3 successfully executed the program. The board below was borrowed from Shoko Kudomi, a 2025 Fab lab Kamakura graduate. bord2 The upper left LED flashes every 0.5 seconds.

Save to xiao

At this point, I pressed play in the development environment to send the program, but in this state, if I disconnected the board from the computer, it wouldn’t run even when I reconnected it to power. start To avoid this, I decided to write the program to the ESP32C3’s memory as main.py. Be careful, you must stop the currently running program beforehand, otherwise an error will occur. stop First, click the icon outlined in red and select ESP32C3 as the save destination. saveto Save the file as “main.py.” filename This will allow the board to load main.py even when disconnected from the computer and connected to a separate power source, so the program will always run.






Arduino -----written by Kohshi Katoh

Installation of Arduino IDE

Visit following address to Download Arduino IDE.
Installation of Arduino IDE
Install
Install

choose option

Installation

Set up

Soldering pins with the Board

Prepare a soldering set.
soldering set
setting board onto a bread board

Pins to solder with the board (included in purchased package)
purchased package

To solder pins with a board, it is easy to use bread board as a guiding jig that pins set perpendicular to the board.
pins putting on to bread board

Pins and board set onto the bread board for soldering.
set onto the bread board

Tip of soldering; This time, we used left side thick tip for normal type of soldering with enough heat mass.
soldering tip

To solder well, it is better to heat the pin with soldering tip for a while so that solder easily slip into the hole.

Soldering done.
soldered01
soldered02

Connecting XIAO ESP32 to PC

Installation of “XIAO ESP32C3 tool” into Arduino IDE in your PC by following selection.

Adding Boards Manager URLs into “Preferences-Setting” in Arduino-IDE.
Adding Boards Manager URLs

The installation couldn’t be succeeded due to waiting time error.
tool selection for ESP32C3

I tried by selecting the older version such as ver.3.2.0 set but ended same error.
tried with older version


Then, my instructor found the following page written in Japanese;
Arduino IDEのDEADLINE_EXCEEDEDエラー対策

  • Here under is the English summary by Copilot;

To solve Arduino IDE “DEACLINE_EXCEEDED Error” Problem

When using Arduino IDE 2.3.7, installing or updating certain board packages (for example, ESP32 Arduino Core) may fail with the error:

Error: 4 DEADLINE_EXCEEDED

Other boards may install correctly, which makes the issue confusing.

Cause

The error is caused by a network timeout during the download process. Arduino IDE relies on arduino-cli, which has a default connection timeout that can be too short on slow or unstable networks. When the download takes longer than this limit, the IDE aborts it and shows the DEADLINE_EXCEEDED error.

Solution

You can fix this by increasing the network timeout used by Arduino CLI. High-level steps (paraphrased):

Close Arduino IDE completely. Locate the Arduino CLI configuration file:

On Windows: C:\Users\.arduinoIDE\arduino-cli.yaml

Open this file in a text editor. Add a network timeout setting at the end of the file, for example:

Increase the timeout to several minutes (e.g., a few hundred seconds such as 300s).

Save the file.
Restart Arduino IDE and try installing the board package again.

After increasing the timeout, the board installation should complete successfully. Notes / Observations

The issue commonly appears when installing ESP32-related packages, but it can affect other large board packages as well. The root problem is not the board itself, but download speed and timeout configuration. This is a workaround until the default timeout behavior is improved in future Arduino IDE releases.

Following above instruction, I added following line in “arduino-cli.yaml” file.

network:  
  connection_timeout:300s  

added extended time

Then the ESP32 board package was well installed! well installed








Choose installed tool “XIAO ESP32C3”.
tool selection for ESP32C3

Connecting USB-C to the XIAO ESP32C3 board Connecting USB-C to C3

To connect XIAO ESP32C3 to PC. For RP2040 type of board, you need to plug the USB-C into the PC inlet by pushing the reset button on of board at the left bottom part.
pressing the reset button

Board connected to PC via USB-C
connected to PC
PC recognized the board.
PC recognized the board

For testing the function of coding, We used the PCB Board made by Shoko Kudomi last year.

Dev-Board Circuit by Shoko Kudomi
board circuit

Dev-Board Schema by Shoko Kudomi
devboard schema

connected Shoko's deveboard

Did Cording to blink the LED in the Dev-Board at left top part.

void setup() {
  // put your setup code here, to run once:  
  pinMode(D3,OUTPUT);  

}

void loop() {
  // put your main code here, to run repeatedly:  
  digitalWrite(D3,HIGH);
  delay(500);
  digitalWrite(D3,LOW);
  delay(500);

}

coding in Arduino IDE

Video: The blinking was confirmed as coding.