Skip to content

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

Individual Assignment

  • Browse through the datasheet for a microcontroller

  • Write and test a program for an embedded system using a microcontroller to interact (with local input &/or output devices) and communicate (with remote wired or wireless connections)

Unexpected Bonus

  • wokwi was a great find to be able to work on my project even though I was away from my lab. See my work below

Used the nRF Board:

I got a board from the MakerSpace Charlotte years ago, and have always wanted to try it out. I made a blinking code. The board is older and seems to be pretty unsupported. More below in my electronics documentation.

css style sheet

I wanted my links to stand out more. So I asked claude for some guidance. PROMPT: "Can i change the color for links or make them bold without changing the header color"

Then claude taught me how to make style sheets. After making one, I played with the bold and the colors and revised my website to be easier to see the links without changing the brown header that I like.

The Work

Wanting to get some background on embedded programming so I would be able to follow along in the class, I started by reviewing some of Barbara Morrow's week 4 documentation. I also looked up a youtube videos on the SEED by Drone Bot Workshop.

Also from the recitation I learned more about some of the definitions and the chips and then clarified with Claude on this page. They also gave us some ways to work remotely without the chip hardware which I will try since I am remote this week.

recitation notes page

Group Work

Link to our group page here

Wanting to be ready for the group work, I asked Claude:

PROMPT: what does this mean "demonstrate and compare the toolchains and development workflows for available embedded architectures"

RESPONSE

This is asking you to try programming different types of microcontrollers and explain how the process differs for each.

What it means broken down:

"Toolchains" = The software tools you use to write, compile, and upload code - Examples: Arduino IDE, PlatformIO, manufacturer's specific software "Development workflows" = The steps you take from writing code to running it on hardware - Write code → Compile → Upload → Test → Debug "Embedded architectures" = Different types of microcontroller chips - Examples: AVR (Arduino Uno), ARM Cortex (nRF52, ESP32), etc. "Demonstrate and compare" = Actually use at least 2 different boards and show the differences

Real example - what you're already doing:

You could compare: .Arduino Uno (AVR architecture): - Toolchain: Arduino IDE or PlatformIO - Workflow: Simple - select board, write code, click upload - Libraries: Tons available, easy to find - Debugging: Mostly Serial.print() vs nRF52 DK (ARM Cortex-M4 architecture): - Toolchain: PlatformIO + J-Link drivers - Workflow: More complex - need specific board definitions, driver installation - Libraries: Fewer, compatibility issues (like you experienced with Servo and Bluefruit) - Debugging: RTT or external tools needed

Individual Work

My code assets for this weeks individual work are here.

Continuing getting ready for this week, which I am really nervous about since I really don't know much about electronics, I decided to talk to Claude about our assignment to better understand the lingo before our class.

PROMPT:

write and test a program for an embedded system using a microcontroller to interact (with local input &/or output devices) and communicate (with remote wired or wireless connections)

can i do this with arduino and what does it mean?```

RESPONSE:

Yes, you can absolutely do this with Arduino! This is actually a perfect fit for Arduino's capabilities. Let me break down what this assignment is asking for: What it means:

"Embedded system using a microcontroller"

Arduino boards (like Arduino Uno, Nano, etc.) are microcontroller-based embedded systems, so you're covered here "Interact with local input &/or output devices"

Input devices: buttons, sensors (temperature, light, motion), potentiometers, etc.

Output devices: LEDs, motors, displays, buzzers, etc.

You need at least one of these - the Arduino reads from inputs or controls outputs

"Communicate with remote wired or wireless connections" - Wired: Serial communication (USB to computer), I2C, SPI - Wireless: Bluetooth, WiFi (with ESP32/ESP8266), RF modules, etc.

The Arduino needs to send/receive data to something else - another Arduino, a computer, a phone app, etc.

Simple project example: Temperature monitor with remote alert: Local input: Temperature sensor Local output: LED (green=normal, red=too hot)

Communication: Send temperature data to your computer via USB serial, display it in Serial Monitor

What you need to do:

Write the program - Arduino code (.ino file) in PlatformIO or Arduino IDE Test it - Upload to your Arduino and verify everything works

Document it - Show your code, circuit diagram, photos/video of it working

Great - I would like to learn to talk to the the arduino via wifi for my final project.

Bad news - my arduino doesnt have wifi, so I went searching in our craft/engr room and found an nRF52-DK that I had gotten a few years back at the makerspace in Charlotte for my daughter. We never used it but I thought I would see if this could work. It is a 2017 board but has blue tooth capability.

nRF52

I turned to Claude for some ideas on how to use this board.

PROMPT:

what about a nRF52 development kit

RESPONSE:

Yes, the nRF52 has Bluetooth! This is perfect for controlling a servo wirelessly.

nRF52 capabilities:

Communication options: - Bluetooth Low Energy (BLE) - this is the main wireless feature - No WiFi - nRF52 doesn't have WiFi, but Bluetooth works great for this assignment

Controlling a servo via Bluetooth with nRF52:

You can absolutely do this! Here's the approach: - Setup: nRF52 board connected to a servo - Program creates a Bluetooth service Connect from your phone (using a BLE app) or computer - Send commands to move the servo

Programming the nRF52:

The nRF52 can be programmed through: Arduino IDE (with nRF52 board support) PlatformIO (you're already familiar with this!)

I wrote this code to blink the built in light.

#include <Arduino.h>

int ledPin = 17; int dT = 500;

void setup() { // put your setup code here, to run once: pinMode (ledPin, OUTPUT); Serial.begin(9600); }

void loop() { // put your main code here, to run repeatedly: analogWrite(ledPin, HIGH);
delay(dT); analogWrite(ledPin, LOW);
delay(dT); Serial.println("Hello"); }

I got an error when i went to upload:

Open On-Chip Debugger 0.10.0-00004-g0e78f263 (2017-02-20-13:07) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : auto-selecting first available session transport "swd". To override use 'transport select '. cortex_m reset_config sysresetreq adapter speed: 5000 kHz Error: unable to find CMSIS-DAP device Error: No Valid JTAG Interface Configured. Failed uploading: uploading error: exit status 0xffffffff

I installed the segger software here to try seomthing new.Since I have only ever done arduino and I like working in VS code, I downloaded PlatformIO IDE and decided to try that. It's on the list of approved software so I am feeling good about that.

I had to install JLink software and follow some prompts from Claude to get the necessary processor for the NRF board. It's a little unnerving since I am installing things I don't really understand...yet...

I got the light to blink and felt like a bit of a rock star.

nRF blink

I couldn't get the serial monitor to work with this set up or get the blue tooth to work. None of the libraries were able to install with this board - too old.

Tomorrow I go back to the arduino … but I need some other connection to be able to do wifi or blue tooth… my arduino doesnt have it. Online, it suggests an ESP32

Mr. Dubick gave me a raspberry Pi Pico. I will try using this too. Alas, its a Pico H - no wifi.. but he says a pico W2 is on the way..

Arduino

I followed the Paul Whorter Tutorials and was able to develop a good comfort level with the arduino code and the Adruino interface (IDE).

I made a google doc of my learnings with those youtube videos and turned it into my Arduino Page

Arduino Page

I found some DroneBot tutorials on how to do write arduino code to use the wifi on the pico W.

Pico

To get started with my Pico, I followed a guide from our teachers Dr. Taylor and Mr. Dubick

Here are the steps that I followed:

  1. Down load the MicroPython Firmware. I used the latest version v1.27.0 (2025-12-09) .uf2

WILL HAVE TO HOLD ON THE REST UNTIL I GET BACK HOME or do I - they just gave us this tool at the recitation.. wokwi They have a stepper motor example that could be helpful to me in my final project.

Getting to know the Pico

GPIO Pins on the Pico

main types of gpio pin Raspberry pico: - digital input pins receive either a high one or low zero signal while digital output pins can send either a high or low signal - analog input pins can measure voltages between 0 and 3.3 volts - pulse width modulation pins can send a pulse signal to control the power supply to the external device

Pico H

The Pico H has an RP2040 microcontroller chip. I held down the button and plugged in the Pico. Nothing.. and then I tried another computer and then I tried another cord. Then I emailed Mr. Dubick and told him I needed a different Pico please. He asked about my cable, so after sleeping on it, I tested cables with a really old android phone until I found one that brought up the phone like a drive. When I used that cable, I was able to bring up the Pico as a drive and load the bootlegger.

Jumping around a bit, but I got the PICO to Blink. Here's the tool chain I eventually used. Thonny with Claudes Help.

I was using VS code and kept getting both "reset terminated with Exit Code: 1 and no module named machine.

For the first one, the PROMPT: reset terminated with exit code: 1 when using python to blink a light on a pico H.

We went through a series of checks - at first saying that the firmware was incorrect, but that was incorrect...LOL.. then had me install a micropython plug in to vs code.. still not working, and then suggesting I use Thonny.

I downloaded Thonny, picked the interpreter to be Micropython (Tools>options>interpreter), then selected the com port 11 which I had found using the device manager in other trouble shooting steps. I opened my previous file for blinking in Thonny, hit play and voila! Blinking! pico blinking

Takeaway - Thonny knows micropython. If you are going to use micropython, this is your easeiest route.

I wanted to know how to run the code in VS CODE, so I went back to claude PROMPTgot thonny working. still no vs code :-(

Claude suggested a few things that I had to skip around becuase they didn't exist, but here is what worked out of what Claude said.

  1. install the "MicroPico" by paulober
  2. Open Command Palette (Ctrl+Shift+P) → "MicroPico: Connect" (down on the left side it shows the pico - Claude kept saying on the right side!!!) pico connected
  3. Open Command Palette (Ctrl+Shift+P) → "MicroPico: Run current file" (if I didn't use this and just tried to use the arrow for run, it would fail again. This is becuase VS code runs python, not micropython by default.)

I changed the code to a longer blink so I would know that it was different code, and it worked.

wokwi work

Online I searched for the number on the back of my motor. I couldn't find the exact motor, but I did find some things online that hopefully describe the motor I have.

  • "42" = NEMA 17 size (42mm)
  • "22A" likely = 2.2A current rating
  • Standard NEMA 17 specs (1.8° step angle, 200 steps/rev)

I used Claude to understand the example code for the stepper motor and then commented my code to make it easier for me to understand what each step does.

First Chunk I have the stepper motor moving forward and backward in 1/8 rotation

Next Chunk I want that to be a function. So I googled how to write a function in arduino and found this website which taught me how to turn that into a function.

Next Chunk Add a conditional that calls the function. If button is pushed go forward. if other button is pushed go back the other way. Done.. added the push buttons.

wokwi example

IMPORTANT NOTE THAT MR. DUBICK POINTED OUT ABOUT MY WOKWI AND THAT NEIL MENTIONED IN CLASS wokwi is not taking into account that I would need external power to run that stepper motor or it would burn up my chip pulling the power from it. Mr. Dubick gave me a site to go do some learning before I proceed building that circuit.

Next Chunk talk to it from wifi?

MicroPython

Youtube by Kevin McAleer explains about how MicroPython was made for small micro controllers and can not be used on arduinos. Sounds like MicroPython is more compact.

Helpful Notes:

  • 4 spaces is the indentation needed instead of curly braces
  • for i in range(start, end, increment)
    • start is default 0, increment default is 1
    • range is the function, start/end/increment is the argument
  • def function_name(argument, argument1);
    • if argument is optional then use argument=None
    • or you can have a default value from argument=50
  • while True:
    • example while count < 4 :
  • control statements: break, continue, pass
  • assignment operators: =, =+ (put link here)
  • Logical (AND, OR, NOT)
  • Bitwise Operators - more used for graphics stuff
  • Membership operators (in, not in)
  • Identity Operators (is, is not)

I worked through a tutorial or two with him, learning a few things about the layout of micropython.

SEEED XIAO ESP32‑C3

Following a tutorial from our lab Dr. Taylor and Mr. Dubick, I held down the little b and plugged in the SEEED, but no boot log arrived, so I turned to CO-Pilot (Claude was out of service for the moment).

PROMPT: seeed - the drive is not appearing although i heard the beep and held down teh b button while attaching the seed

Co-pilot lead me down a series of steps where i was able to find the SEEED in USB JTAG/Serial Debug Unit (under USB Devices, not Ports (COM & LPT) and not as a mass‑storage drive). At this point, Co-pilot asked for my exact model and felt that maybe this model doesnt display a UF2 bootloader but could be accessed by the Arduino IDE if I add the board in the board manager.

I went to the device manager to find the port. ![device mgr]

So now we started down a path of using the arduino IDE to talk to the board.

TABLED FOR NOW - FLASHING DRIVE WILL BE A LATER LEARNING

SEEED XIAO ESP32‑C6

Got another chip and was able to program blink on it. Unfortunately, at first I had another seeed plugged in that had an RP2040 on it. I didn't realize that we had seeeds at the lab with both ESP32's and RP4020's on them. oops. Mr. Dubick asked me to label them with a pen so I wouldn't waste that time again. So I did.

Once I had the ESP32 plugged in, I was able to follow the directions in the slides that they provided and bring down an example code to blink the light, and communicate back to the serial port "Hello World". I did have to use the device manager to find the port which was now 13.

find COM

Playing a bit more with the ESP32C6 and making sure I did the extra credit that I found in the slide deck since I had to miss lab on wednesday night while my group worked late :-( and my teachers were a bit bummed that I missed the lesson. I set up a photo sensor with the example code for the esp32 for reading inputs. I used the pinout to make sure I was going to the correct pins.

sensor code

Maybe I can take it a bit further and add the serial plotter information to this code. Didn't have to add anything, just clicked for serial plotter. plotter

SEEED XIAO RP2040

Back to micropython with a different chip. I held down the boot button and connected. Then moved the uf2 code into the file folder. The chip rebooted automatically.

In VS code, re-opened my main.py code from before and was going to try to connect to the board ctrl+shift+P then selected MicroPico:Connect. Then ctrl+shft+P again , but micropico: run current file wasnt there. Turned out i was in the json file. I clicked into the main.py and then it appeared. Hello World printed out.. but the light wasn't flashing, so I went looking for a [pinout diagram for the rp2040 (https://docs.zephyrproject.org/latest/_images/xiao_rp2040_pinout.web)]in this format.

I went and found the datasheet and browsed through that 646 pages of bedtime reading looking for the answer to my built in LED pin quest. In the end, I just googled it PROMPT xiao seeed rp2040 pin number for built in LED, AI OVERVIEW The Seeed Studio XIAO RP2040 features a built-in blue LED connected to GPIO 25

I changed to pin 25 and the blue blinker came on. The yellow thats always on next to it, and the red power light behind that really hide the little blue bult in LED.

However, I did learn from the datasheet how the pin arrived at its name and what it means: - RP because its similar to a Raspberry Pi

The post-fix numeral on RP2040 comes from the following, - 2 Number of processor cores (2) - 0 Loosely which type of processor (M0+) - 4 floor(log2(ram / 16k)) - 0 floor(log2(nonvolatile / 16k)) or 0 if no onboard nonvolatile storage

Atmel ATmega328P

This chip is on my Elegoo Uno R3. The ATmega328P is an 8-bit microcontroller, running at 16 MHz. It is designed to be fully compatible with the official Arduino Uno R3, featuring 32 KB of flash memory for code storage, 2 KB of SRAM, and 1 KB of EEPROM. I have been able to use the Arduino IDE and do lots of learning with this kit and Paul Whorter Tutorials.

Stepper Motor

I want to learn to use the Stepper Motor for my project. Its More complicated and Pulls more electricity, but it can take steps and be more exact. Other notes: - Must have matching driver - Must have external power (can not run off arduino alone)

Stepper motors - can use “easy driver”… like for the 3D printers. Mr. Dubick gave me one of these to work with the other motor he gave me from the lab that I will try later in the course.

Starting the tutorial, I went to learn stepper motors. The cable and the driver were missing… kids… LOL. So I went into our “engr” room and found a bag with 5 stepper motors and drivers… and I am going to try to use them. They seem to have a similar set up but I need to go find their steps per revolution and other specs. I took a picute of the motor and googled it and was able to find more information. stepper Motor

Info on this motor including steps per revolution …2048 like the [example motor.(https://lastminuteengineers.com/28byj48-stepper-motor-arduino-tutorial/)

ISSUE:::: When i ran the code, it vibrated so I asked Claude- PROMPT The motor vibrates, but doesn't move smoothly,

ANSWER claude said to try reordering: Stepper myStepper(stepsPerRevolution, 8,10,9,11); Missing Items

Claudes Explanation - The wires from your ULN2003 board to the Arduino might be in a different order than the library expects. The coils need to be energized in the correct sequence, or the motor just vibrates in place.

This worked.

Another Issue - my motor wasn't switching directions with my toggle press.. Again - i turned to claude for some help… and i tried a few things including some code to make sure that the button was working… My final diagnosis with the Claude assist was that I had my stpeer going a full revolution before checking again to see if the button had been pressed. I switched my number of steps to a much smaller value and then it worked. However, the movements were a bit chunky as it seemed to be stopping with the delay - probably for the println as it made its revolutions. Removing print calls left this motor moving smoothly 🙂

DC Motor

In the kit there is a L293D - motor controller that I used with the tutorial to make the DC motor work.

Can’t just put the motors to arduino, they need more current - could burn out ardiuno pins. - could send a voltage spike to arduino and burn it out.

Power mgt and heat management is very important. Make sure your motor controller can handle that amount of current and also that you have the right amount of power needed for the motor.

All grounds need to share a common ground. Make sure that the ground of the arduino and the ground of the chip are all connected.

L293D - motor controller 16 pins - found this pinout picture

  • EN 1 - control speed - PWM analogwrite - need digital pins with squiggle
  • Pin 2 & 7 - controls direction -need to be opposite to go opposite directions
  • Pin 3 & 6 go to the motor - red to 3 and ground to 6
  • Pin 4&5 are the ground.
Pin
CHIP to ARDUINO PINS
1 went to pin 6 to control speed
2 went to 4 - direction
3 went to red motor
4 went to ground
5 empty
6 motor black
7 went to 3 direction
8 - power - but must have external power board and source

ISSUE - went to use the motor and the motor wire had come disconnected from the motor. Went to my soldering station and repaired it so I could continue. dc repaired

My motor starts and then stops and then starts again and keeps going. Claude suggested this was a power draw issue and that I add a ramp up speed. McWhorter also talked about this.

Controlling the motorspeed with Push Buttons dc

Used this lay out of the procedure to be able to program the arduino layout

final project code recommendation

After learning a bit of micropython and working through some arduino, I asked Claude what might be a better programming language for my project.

PROMPT for the pico w would using micro python or arduino be better for project where i am using an app interface that will say at what time to move a stepper motor, and will ask the board to read another input that says if the a sensor was triggered and report back.

ANSWER For your Pico W project (app interface → schedule motor movements + read sensor), I'd recommend Arduino over MicroPython. Here's why: Arduino is better for your use case: ✅ Stepper motor control - Better libraries (AccelStepper, Stepper.h) with precise timing ✅ Real-time responsiveness - C++ is faster, less likely to miss sensor triggers ✅ WiFi stability - Arduino WiFi libraries for Pico W are mature and reliable ✅ You already know it! - You've been writing Arduino code, no learning curve ✅ Community support - More examples for "app + Arduino + stepper" projects MicroPython downsides for this: ❌ Stepper control is clunkier (manual pin toggling, timing issues) ❌ Slower execution (interpreted vs compiled) ❌ Less mature libraries for Pico W WiFi ❌ New syntax to learn

Your project architecture would look like: Mobile App (phone) ↕ WiFi Pico W (Arduino code) ↓ control pins → Stepper Motor Driver → Motor ↑ input pin ← Sensor

Arduino libraries you'd use: - WiFi.h - for Pico W network connection - WebServer.h - to receive commands from app - AccelStepper.h - for smooth stepper control - Standard digitalRead() - for sensor

When MicroPython WOULD be better: - Rapid prototyping/testing Data logging with complex file operations Projects where ease of debugging > performance

My recommendation: Stick with Arduino. You'll get your project working faster and it'll be more reliable.