Anti-Aliasing Filter.

Anti-Aliasing Filter.

I think everyone has seen at least once on TV how the wheels of a fast-moving car rotate slowly or even turn the other way. As a child I was very curious about this, but I found the answer much later, when I started figuring out how an ADC works. First, let's look at what an ADC has in common with a spinning wheel on a TV screen. When...

How to Connect an AVR Microcontroller to an Android Tablet Using the HC-05 Bluetooth Module.

How to Connect an AVR Microcontroller to an Android Tablet Using the HC-05 Bluetooth Module.

At the end of the previous article I wrote that I had managed to create an interface for Android, and in this article I'll try to describe the process. Why "try"? Because I have almost no experience creating Android apps, and in truth there's little I can explain clearly. Okay, enough excuses, time to get down to business. First, download and install Android Studio; how to do this...

Connecting the HC-05 Bluetooth Module to a Microcontroller.

Connecting the HC-05 Bluetooth Module to a Microcontroller.

About a year ago I ordered an HC-05 Bluetooth module on AliExpress. At the time I didn't yet know what I might need it for, but wireless technologies lured me with their mystery. When I ordered it, there was a whole range of Bluetooth modules on the market, from HC-03 to HC-09, but some of them can work either in master mode (HC-04-M) or in slave mode (HC-06-S), while the HC-05 can work in...

Modular Programming.

Modular Programming.

Once a beginner embedded developer has had enough of blinking LEDs, he will certainly decide to write something more serious, and like any beginner he will have only one wish: "to get it all working as fast as possible!!!". In this attempt to prove himself, he will write everything in one file without thinking about the program's structure, but after a while, when part of the plan has been implemented, it will become clear that...

Recording Sound to an SD Card with a Microcontroller.

Recording Sound to an SD Card with a Microcontroller.

In one of my previous articles we learned to work with an SD card, and of course it would be good to put that knowledge into practice. That's how the idea of recording sound to an SD card and then listening to it on a computer was born. We won't be able to make anything worthwhile, because we can't create new files or increase their size; these limitations are imposed by the library. But the principles of working with sound laid out in this article...

A Few Words About Pointers in C.

A Few Words About Pointers in C.

When learning C, beginners often have questions about pointers. I think everyone has roughly the same questions, so I'll describe the ones I had. What is a pointer for? Why do people always write "pointer to type", and how does a pointer to uint16_t differ from a pointer to uint8_t? And who invented pointers anyway? Before answering these questions, let's recall what...

Connecting an SD Card to a Microcontroller.

Connecting an SD Card to a Microcontroller.

In one of my previous articles we displayed an image from an SD card on a display, but a few points were left out: first, connecting the card itself; second, only some of the Petit FatFs library functions were covered. Let's look at these points in more detail. Communication with the card is possible over one of two interfaces, SPI or SD. I should say that the SD interface can work in one-bit...

Handling Tactile Button Presses.

Handling Tactile Button Presses.

Usually a programmer's first program prints the string "Hello world" on the screen, while an embedded developer blinks an LED, maybe also adding a button to change the LED's state. It's the button I wanted to talk about: a button that toggles something is usually called a tactile button. It's usually connected according to one of the circuits shown below. But a much more interesting question...

The Programmer Can't See the Microcontroller.

The Programmer Can't See the Microcontroller.

I think many people have read online that if you set the fuses incorrectly, you won't be able to flash the MCU with standard tools anymore. Which fuses can be set incorrectly? The Atmega16 microcontroller has several such fuses: SPIEN and JTAGEN, which enable programming the microcontroller via SPI and JTAG; RSTDISBL, which allows the reset pin to be used as an additional I/O line; also...

Connecting the FL86STH65-2808A Stepper Motor to a Microcontroller.

Connecting the FL86STH65-2808A Stepper Motor to a Microcontroller.

The other day I got my hands on an FL86STH65-2808A stepper motor with an SMD-4.2 driver, and the task was to learn to control it with a microcontroller. First, the motor needs to be connected to the driver: 8 wires come out of the motor, and they can be connected in two ways, as shown in the picture below. With the windings connected in series, maximum torque can only be achieved at low...

Controlling a Stepper Motor with a Microcontroller.

Controlling a Stepper Motor with a Microcontroller.
Схемотехника

It all started when one of my devices needed to rotate a motor shaft a certain number of turns; high precision wasn't required, plus or minus a quarter turn, so I decided to do it with a DC motor. An Atmega16 microcontroller was chosen as the control element, but since the output voltage of the Atmega16 pins...

Flashing AVR via a Bootloader.

Flashing AVR via a Bootloader.

Since I didn't get a USB programmer right away, and flashing via the COM port was slow and inconvenient, I had to find a way out of the situation, and it was to use a bootloader. One of my previous articles described how to flash an STM32 using its bootloader, but on STM32 the bootloader is programmed into the chip at the factory during manufacturing, whereas here we'll have to flash it ourselves. Here's how it looks in...

A Microcontroller-Based Scale: Connecting the HX711 to an Atmega16.

A Microcontroller-Based Scale: Connecting the HX711 to an Atmega16.
Схемотехника

This scale has been sitting unused for a long time. One day it simply stopped turning on, and my attempt to repair it failed, so I decided to restore it and at the same time figure out how it works. For this I ordered an HX711 board from AliExpress. This chip contains a programmable gain amplifier and a sigma-delta ADC; it was specifically designed for...

How to Program and Debug AVR Microcontrollers.

How to Program and Debug AVR Microcontrollers.

The first question a beginner embedded developer faces is how to program a microcontroller. To program a microcontroller, you need three components: the chip you want to program; a programmer; and a special program on the computer that controls the programmer. Every microcontroller has a programming mode; in this mode some microcontroller pins change their...

Connecting an Incremental Encoder to a Microcontroller.

Connecting an Incremental Encoder to a Microcontroller.

An incremental encoder looks like a potentiometer, but unlike a potentiometer it has no end positions: it can rotate in both directions an unlimited number of turns. It should also be noted that an incremental encoder doesn't rotate smoothly like a potentiometer, but in steps. You can see one on car radios, oscilloscopes, stereo systems, washing machines and other...

SPI Protocol Basics.

SPI Protocol Basics.

SPI (Serial Peripheral Interface) is a serial peripheral communication protocol. It was developed by Motorola but is now used by many manufacturers. It is designed for communication between microcontrollers, as well as with all kinds of peripherals: sensors, ADCs, memory chips, clocks. But still, the most common use of SPI is writing a program into the memory...