Wellys Dev

  • Home
  • Search/Topics
  • Writings
  • About
  • 2023-03-19
    Embedded Ada on an AVR Microcontroller: Introduction

    Where I begin to explore using Ada on an Arduino Uno.

    Introduction

    On the Adafruit site, I ran across a mention of an award as to an “Ada Crate on an AVR” microcontroller. Which I found fascinating. Ada is a language developed for larger computers and wasn’t something I would expect to fit on to the AVR-series of microcontrollers.

    This led me down a path of attempting to understand:

    1. What is Ada as it relates to microcontrollers?
    2. Is there value to using Ada on a microcontroller as compared to C?
    3. How do I do so?

    This post describes my journey and how to begin to develop in Ada on an Arduino Uno or AVR ATmega328P

  • 2023-01-08
    Working with GitHub and Sensors: dataLogger

    Where I demonstrate how to use a GitHub repository to develop a data logger with the Arduino Uno to measure and record analog values. In this example, I will be measuring voltage, however the same approach could be used to measure capacitance, temperature, or light etc.

    NOTE: The SparkFun Qwiic Alphanumeric Display uses 3.3V and not the 5V from the UNO! Please use a level-shifter or a Pi Pico (or equivalent) when using this specific display.

    SparkFun Qwiic Alphanumeric Display

  • 2022

  • 2022-11-01
    Developing in C for the ATmega328P: I/O Ports

    Where I describe how to improve the performance of your programs by accessing the input/output (I/O) ports on the Arduino Uno, natively.

    Introduction

    The Arduino framework and Uno hardware has performed an admirable job in abstracting much of the complexity of the ATmega328P into something which is easier to understand. This approach works well for a beginner in microcontrollers and embedded C programming. Once you begin to understand how the ATmega328P works, its not unusual to find the Arduino simplification is holding you back.

  • 2022-10-29
    Analyzing Circuits Using the Espotek Labrador: Measuring Servo Control

    Where I demonstrate different methods of measuring a servo pulse to ensure it meets requirements.

    Introduction

    In the entry on servos I discussed the specific pulse requirements to make a servo move. In a nutshell, a servo needs a positive pulse .5ms to 2.3ms in a 60Hz signal. Or to put it another way, it requires a 60Hz signal with a duty cycle ranging from 3% to ~14%.

  • 2022-10-17
    Hardware Debug: Command and Configuration Reference for Bloom and gdb

    Reference page for Bloom configuration and commonly used avr-gdb commands.

    Sources

    • gdb Resources
    • Online User Manual: Debugging with GDB
    • Bloom (replaces avarice)
    • Microchip SNAP (replaces the Atmel Dragon)
    • Atmel-ICE Debugger more expensive version for both ARM and AVR

    Bloom Configuration

    Atmel ICE Debugger Configuration

    environments:
      default:
        debugTool:
          name: "atmel-ice"
    
        target:
          name: "atmega328p"
          physicalInterface: "debug-wire"
          disableDebugWirePreDisconnect: false
          manageDwenFuseBit: true
          variantName: "atmega328p-pu"
    
        debugServer:
          name: "avr-gdb-rsp"
          ipAddress: "127.0.0.1"
          port: 1442
    
    insight:
      enabled: true
    

    avr-gdb Configuration

    .gdbinit

    set history save on
    set history size 10000
    set history filename ~/.gdb_history
    
    file main.elf
    target remote :1442
    set listsize 0
    
    define cll
    make 
    load main.elf
    mon reset
    refresh
    list
    end
    
  • 2022-10-10
    Developing in C for the ATmega328P: Servos

    Where I describe how to use the servos() interface in AVR C.

    Sources

    • Analog Feedback Micro Servo - Product ID: 1449 Servo to be used in entry.
    • Analog Feedback Servos
    • Arduino Lesson 14. Servo Motors
    • Adafruit Servo Motors

    Introduction

    Servos are a powerful addition to the embedded programming toolkit as they enable motion. Not high-speed motion as in a electric motor, however, motion which can be easily controlled and typically in an arc or as angles. Servos are much more precise as to how they can move in comparison to electric motors. See Sources above for a few example tutorials as to how to use them.

  • 2022-10-02
    Developing in C for the ATmega328P: Pointers

    Where I describe how to develop use pointers in AVR_C.

    Introduction

    Pointers are introduced by “K&R” with the following comment “Pointers have been lumped with the goto statement as a marvelous way to create impossible- to-understand programs.” While pointers are simple in nature, they can become quite complex, quickly. I recommend going through the examples on this page, slowly and methodically as well as making changes and determine if the change had the effects you believed it would. I also recommend having a C Language reference manual open as well, as I won’t got through the usage.

  • 2022-09-27
    Developing in C for the ATmega328P: Code vs. Cost

    Where I demonstrate the value of coding efficiency to reduce the cost of hardware.

    Video

    Introduction

    In the another entry, I discussed code size, program space and RAM requirements and why they matter. Here are my thoughts from that page:

    Why Size Matters

    (From Developing in C for the ATmega328P: structures)

  • 2022-09-26
    Developing in C for the ATmega328P: struct

    Where I demonstrate how to use the C Language data type struct and how to use it to simplify a program.

    Introduction

    As programs become more complicated, its desirable to group common elements into a “block”, then debug that block and have the block serve as a single debugged element. For example, a function can serve as a block of code which performs a set of commands commonly used together. Once debugged, the function can be called instead of the individual commands, simplifying debugging and code management.

  • 2022-09-24
    Developing in C for the ATmega328P: Example Code

    Where I list all of the examples found in the examples folder for easy reference.

    Introduction

    When using a specific function or while attempting to understand a C programming concept, it is helpful to see a working example. The examples below, (except where noted), have all been tested and work on an Arduino Uno.

    Examples

    AVR C Code on Github

    analogRead

    Demonstrates analogRead() which reads the 10bit Analog-Digital Converter (ADC).

Page 3 of 8
Copyright © 2025 Lief Koepsel
  • Home
  • Search/Topics
  • Writings
  • About