Monday, August 7, 2023

Plotting data from a logic analyzer - CSV and LibreOffice Calc

Sometimes it is useful to visualize data from a logic analyzer in a graphical way but unfortunately not many applications can do that so I came up with a solution involving CSV data and LibreOffice Calc. Here I am using Logic from Saleae but any software that can export the data to a CSV file can work.

Plotting data from a logic analyzer


First thing to do is to export the data from the logic analyzer software to a CSV file format. In Logic 2 this can be easily achieved by going to File -> Export Data or by pressing CTRL + SHIFT + S.

Exporting CSV in Logic 2 from Saleae

Saturday, June 10, 2023

Breadboard Development Board for AVR microcontrollers | Breaduino

A development board is an essential tool when working with projects that involve a microcontroller and most of the time you will also need a breadboard and a power supply. So why not combining all these in a single product?

Meet Breaduino - a custom development board build around ATmega328PB microcontroller. If you are a beginner in electronics or microcontrollers, building a development board is not only rewarding but also educational.

Breadboard Development Board for AVR microcontrollers | Breaduino

The Breaduino dev board is designed to be used with two breadboards where it outputs three voltages: 12V, 5V and 3.3V. It includes a TFT display, micro SD card socket, input current measurement and a rotary encoder for user interaction. On the right side of the case is space for a small logic analyzer and/or a 9V battery. All these are optional modules. Even the breadboard is optional so the board can be used standalone. Since this is a customizable board it can be modified to fit your needs.

Breadboard Development Board for AVR microcontrollers | Breaduino

Sunday, August 28, 2022

IR remote control library for AVR microcontrollers

This library can be used for sending or receiving remote controller codes using a microcontroller. The supported protocols at the moment are NEC and RC-5 since these are the most commonly used.

The IR library is very easy to use and it needs a 16-bit timer for both sending and receiving. Timer 1 is used for this purpose. Before diving into the code, let's see how a remote controller works and take a closer look at their protocols.




How a remote controller works

A remote control is using optical communication to send wireless data to a receiver device. For this purpose, the infrared light was chosen. The data is transmitted on top of a carrier frequency that is usually 38kHz. There are many schemes of encoding the data because there are many manufacturers of consumer products. The most commonly used protocols are NEC, RC-5, RC-6, Sony. 

Sunday, August 7, 2022

UART library for AVR microcontrollers

This is a UART library that is made for AVR microcontrollers that can be used for serial communications.

UART is a type of serial interface, as opposed to a parallel interface. A parallel interface can work at higher speeds but the disadvantage is that it needs multiple input/output lines. Other examples of serial interfaces are SPI and I2C.

UART library for AVR microcontrollers using interrupts


  • Custom Baud rate
  • Asynchronous or synchronous modes
  • Supports serial frames with 5, 6, 7, 8, or 9 data bits
  • Odd, even or no parity
  • Error detection
  • Multi-processor communication mode used to address multiple devices on the same serial bus
  • Double speed asynchronous communication mode

Thursday, August 4, 2022

Tutorial on how to program an AVR ATmega328PB microcontroller using Atmel Studio and a bootloader

In this tutorial you will be learning how to use Microchip Studio (previously known as Atmel Studio) to program an AVR microcontroller over UART using the Optiboot bootloader. The hardware necessary is very inexpensive. All you need is an ISP (In System Programming) module such as USBTinyISP (around 3$) and an USB to Serial adapter that is around the same price and you can even build it yourself if you wish.

Monday, July 25, 2022

Library for MCP4725 DAC for AVR microcontrollers

The MCP4725 is a low-power, high accuracy, single channel, 12-bit buffered voltage output Digital-to-Analog Convertor (DAC) with non-volatile memory (EEPROM). Its on-board precision output amplifier allows it to achieve rail-to-rail analog output swing. The advantage of this DAC is the A0 pin that can be used to control multiple DACs by changing their address (more on that later).

This DAC library also includes an I2C driver that is needed by the AVR to communicate with the MCP4725.

Library for MCP4725 DAC for AVR microcontrollers


  1. Pin Descriptions
  2. Wiring up one or multiple DACs
  3. MCP4725 Characteristics
  4. Code Example
  5. Using the MCP4725 library
  6. Download


1. Pin Descriptions


MCP4725 DAC pin description

MCP4725 pins

Wednesday, July 13, 2022

SD card tutorial - Interfacing an SD card with a microcontroller over SPI (part 2 of 2)

This is part 2 of the tutorial on SD card specifications. In part 1 of the tutorial we made functions necessary for SPI communication and card initialization in SPI mode. At the end of this second part you should be able to read and write an SD card.


5. Reading/Writing Data Blocks

5.1 Block Length

5.2 CMD17 – Reading a Single Block

5.2.1 Read Errors

5.3 CMD24 – Writing a Single Block

6. Conclusion or Confusion

7. Links 

SD card tutorial - Interfacing an SD card with a microcontroller over SPI (part 2 of 2)

5. Reading/Writing Data Blocks

5.1 Block Length

Block length can be set in Standard Capacity SD cards using CMD16 (SET_BLOCKLEN) however for SDHC and SDXC cards, the block length is always set to 512 bytes. Since nowadays most if not all cards are of high capacity type, we will only consider the latter in this tutorial.