Posts

Flashing Arduino Uno via AVRDUDE and Programmer

Converting C code into machine readable .hex

Method 1 : Arduino CLI (unverified)

** Arduino CLI pulling the Arduino core and libraries into proj path**

  1. Install the Arduino CLI

  2. Create a directory and place authored c files. Ex) ~/MyProj/src/

  3. Ensure that the arduino-cli core libraries are up to date w/ command and installed (use only once)

    arduino-cli core update-index && arduino-cli core install arduino:avr

  4. Compile and export hex

    arduino-cli compile --fqbn arduino:avr:uno --export-binaries MyProj

Method 2 : Manual Method using avr-gcc

  1. Locate the Arduino core includes and compiled core archive ( or compile yourself)

    /.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino

  2. Copmpile your code (Ex file.c)

    avr-gcc -c -mmcu=atmega328p -DF_CPU=16000000UL -I/path/to/cores/arduino -I/path/to/variants/standard file.c -o file.o

  3. Link core libs and objects

    avr-gcc -mmcu=atmega328p file.o /path/to/core.a -o file.elf

  4. Produce hex file

    avr-objcopy -O ihex -R .eeprom file.elf file.hex

Flashing Hardware using AVR Programmer

  1. Upload hex file to the arduino using AVRDUDE. The hex will likely be in MyProj/build/ with the name like MyProj.ino.hex or MyProj.hex.

    avrdude -c usbtiny -p atmega328p -U flash:w:MyProj.hex

    • -c usbtiny : selecting programmer
    • -p atmega328p : selecting device
    • -U flash:w:PyProj.hex : all memory options allowed, do flash write

RoboCar Checkpoint 02 - Version 1

Current Checkpoint:

  1. Upload macro-level hardware plans here with requirements.
    v1
    Figure 1

    V1.0 Requirements :

    1. RoboCar shall be be able to move forward, backward, left, and right. Tank controls are acceptable.
      1. RoboCar shall achieve a forward speed of ??
    2. RoboCar shall be able to accept (movement) commands from a remote PC with (???) allowable loss.
    3. RoboCar shall not be wired such that power or communication cables are tethering the vehicle.
    4. RoboCar shall come to a complete stop in (?? ms) when the ESTOP is pressed.
  2. ROS : turtle tut

    Using the tutorial but trying turtlesim in a terminal using ‘ros2 run turtlesim turtlesimnode‘ results in

    qt.qpa.xcb: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

    solving this required a few more libraries and ensuring xauth is on my laptop! The libraries (X/Qt/xcb…) I had to install on the pi were "sudo apt install"…

    • x11-apps
    • libgl1
    • libgl1-mesa-dri
    • libgl1-mesa-glx
    • libegl1-mesa
    • libegl-mesa0
    • libxcb1
    • libx11-xcb1
    • libxcb-xinerama0
    • libxcb-icccm4
    • libxcb-image0
    • libxcb-keysyms1
    • libxcb-randr0
    • libxcb-render-util0
    • libxcb-shm0
    • libxcb-xkb1
    • libxkbcommon-x11-0

    and running a checky little ssh session ‘xeyes‘ for a simple test. After that, turtlesim worked!!

  3. ROS : controller control turtles through ssh (can kicked)
  4. Ard : Outline how to flash firmware
    • For the firmware flash, I wanted to move away from the Arduino IDE and attempt to flash using a programmer and make/shell pipeline. For this, I opted to use the AVR Programmer which has a healthy amount of documentation around the PCB and programming along with the ability to power the uno.
      avr_prog
      Figure 2
    • Since I had installed the arduino IDE in the past, I had the ard-gcc compiler and libs installed. All I had to do was follow the process of generating a hex file outlined in another page [TODO].
    • With the pipeline made, I created a small blink LED test with the dir structure
      					|- bin
      					|   |- blink.elf
      					|   |- blink.hex
      					|   |- blink.o
      					| 
      					| - Makefile
      					|
      					| - run.sh
      					|
      					| - src
      					|   | - blink.c	
      

      Be sure to look at my github for idea of the Makefile and shell BUT they should be a review from [TODO], the other file I posted today.

Next Checkpoints:

  • (Arduino) Author a bare-bones, tank-style motor control system that accepts movement commands (hard-coded script til pi) using a TDD framework.
  • (Pi) Switch ssh over to bluetooth from WLAN (and static address)

Concentrated and Sweet Hibiscus Tea Recipe

Recipe :

This is a sweet, concentrated, and strong hibiscus tea recipe I use for mixing with green or black tea throughout the week. It should be watered down but you can sip it if you’re bold enough!

Ingredients :

  • 2cu Sugar (Brown)
  • 6cu Water
  • 1cu Hibiscus Flower (Rinsed)

Directions :

  1. Mix water and sugar into pot and bring to a boil.
  2. Turn off heat, place tea leaves into a strainer or cloth bag, and allow to soak for 5 minutes (longer for a stronger flavor).
  3. Remove leaves and allow to cool.
  4. Refrigerate and enjoy!

RoboCar Checkpoint 01 - Introductions

Previous Checkpoint: \( \nexists \)

Current Checkpoint:

  1. Setup the Raspberry pi \( \longrightarrow \) Ubuntu Server 24.04 Noble. \( \blacksquare \)
  2. Install ROS2 on the pi \( \longrightarrow \) ROS2 Jazzy Desktop \( \blacksquare \)
  3. Validated ROS2 install \( \longrightarrow \) Talk/Listener tutorial works \( \blacksquare \)

Notes:

  • I don’t know how a desktop ROS will handle being on ubuntu server. Time will tell

Next Checkpoints:

  • Upload macro-level hardware plans here
  • ROS : turtle tut
  • ROS : manual control turtles through ssh
  • Ard : Outline how to flash firmware

Welcome back!

GREETING, it’s been roughly 4 years since I’ve created this website. I think its time I start posting on here :)

I hop you like it!