Microcontroller circuits for beginners. Frequency converter for asynchronous motor on AVR

Crafts with microcontrollers is a question that is more relevant and interesting than ever. After all, we live in the 21st century, the era of new technologies, robots and machines. Today, every second person, starting from a young age, knows how to use the Internet and various kinds of gadgets, which are sometimes difficult to do without in everyday life.

Therefore, in this article we will touch upon, in particular, the issues of using microcontrollers, as well as their direct use in order to facilitate the missions that confront us all every day. Let's figure out what the value of this device is and how easy it is to use it in practice.

A microcontroller is a chip whose purpose is to control electrical appliances. The classic controller combines in one chip both the operation of the processor and remote devices, and includes a random access memory device. Overall, this is a monocrystal Personal Computer, which can carry out relatively ordinary tasks.

The difference between a microprocessor and a microcontroller is the presence of start-stop devices, timers and other remote structures built into the processor chip. The use in the current controller of a fairly powerful computing apparatus with extensive capabilities, built on a monocircuit, instead of a single set, significantly reduces the scale, consumption and price of devices created on its basis.

It follows that such a device can be used in computing technology, such as a calculator, motherboard, CD controllers. They are also used in electrical household appliances, such as microwave ovens and washing machines, and many others. Microcontrollers are also widely used in industrial mechanics, ranging from microrelays to machine tool control techniques.

AVR microcontrollers

Let's get acquainted with the more common and thoroughly established modern world controller such as AVR. It consists of a high-speed RISC microprocessor, 2 types of energy-consuming memory (Flash project cache and EEPROM information cache), a RAM-type operational cache, I/O ports and a variety of remote interface structures.

  • operating temperature ranges from -55 to +125 degrees Celsius;
  • storage temperature is from -60 to +150 degrees;
  • the highest voltage at the RESET pin, in accordance with GND: maximum 13 V;
  • maximum supply voltage: 6.0 V;
  • maximum electric current of the input/output line: 40 mA;
  • Maximum current on power supply line VCC and GND: 200 mA.

AVR microcontroller capabilities

Absolutely all microcontrollers of the Mega type, without exception, have the property of independent coding, the ability to change the components of their driver memory without outside help. This distinguishing feature makes it possible to form very flexible concepts with their help, and their method of operation is changed personally by the microcontroller in connection with one or another picture, determined by events from the outside or from the inside.

The promised number of cache census revolutions for second-generation AVR microcontrollers is 11 thousand revolutions, when the standard number of revolutions is 100 thousand.

The configuration of the structure of the input and output ports of the AVR is as follows: the purpose of the physiological output is three bits of regulation, and not two, as in well-known bit controllers (Intel, Microchip, Motorola, etc.). This property eliminates the need to have a duplicate port component in memory for protection purposes, and also speeds up the energy efficiency of the microcontroller in conjunction with external devices, namely, in the event of associated electrical problems outside.

All AVR microcontrollers feature multi-tiered suppression technology. It seems to interrupt the standard flow of the Russifier in order to achieve a goal that is a priority and determined certain events. There is a routine to convert a suspension request for specific case, and it is located in the project memory.

When a problem occurs that triggers a shutdown, the microcontroller saves the component adjustment counters, stops the general processor from executing this program, and begins executing the shutdown processing routine. At the end of the execution, under the patronage of the suspension program, the previously stored program counter is resumed, and the processor continues to execute the unfinished project.

Crafts based on the AVR microcontroller

DIY crafts using AVR microcontrollers are becoming more popular due to their simplicity and low energy costs. What they are and how to make them using your own hands and mind, see below.

"Director"

Such a device was designed as a small assistant for those who prefer to walk in the forest, as well as naturalists. Despite the fact that the majority telephone sets There is a navigator, they require an Internet connection to work, and in places isolated from the city this is a problem, and the problem with recharging in the forest has also not been solved. In this case, it would be quite advisable to have such a device with you. The essence of the device is that it determines which direction to go and the distance to the desired location.

The circuit is built on the basis of an AVR microcontroller clocked from an external quartz resonator at 11.0598 MHz. NEO-6M from U-blox is responsible for working with GPS. This, although outdated, is a well-known and budget module with a fairly clear ability to determine location. The information is focused on the screen from the Nokia 5670. The model also contains a HMC5883L magnetic wave meter and an ADXL335 accelerometer.


Wireless alarm system with motion sensor

A useful device that includes a movement device and the ability to give, according to a radio channel, a sign that it has been triggered. The design is movable and is charged using a battery or batteries. To make it, you need to have several HC-12 radio modules, as well as an HC-SR501 motion sensor.

The HC-SR501 motion device operates with a supply voltage from 4.5 to 20 volts. And for optimal performance from LI-Ion battery you should go around the safety LED at the power input and close the access and output of the linear stabilizer 7133 (2nd and 3rd legs). Upon completion of these procedures, the device begins permanent job at a voltage of 3 to 6 volts.


Attention: when working in conjunction with the HC-12 radio module, the sensor sometimes triggered falsely. To avoid this, it is necessary to reduce the transmitter power by 2 times (command AT+P4). The sensor runs on oil, and one charged battery with a capacity of 700 mAh will last for over a year.

Miniterminal

The device proved to be a wonderful assistant. A board with an AVR microcontroller is needed as a foundation for the manufacture of the device. Due to the fact that the screen is directly connected to the controller, the power supply should be no more than 3.3 volts, since higher numbers may cause problems with the device.


You should take an LM2577 converter module, and the basis can be Li-Ion battery capacity 2500mAh. There will be a useful package that delivers a constant 3.3 volts throughout the entire operating voltage range. For charging purposes, use a module based on the TP4056 chip, which is considered budget-friendly and of fairly high quality. In order to be able to connect the miniterminal to 5-volt mechanisms without the risk of burning the screen, you must use UART ports.

Basic aspects of programming the AVR microcontroller

Microcontroller coding is often done in assembly or SI style, however, you can also use other Forth or BASIC languages. Thus, to actually begin research on controller programming, you should be equipped with the following: material set, which includes: a microcontroller, in the amount of three pieces - the highly popular and effective include - ATmega8A-PU, ATtiny2313A-PU and ATtiny13A-PU.

To implement a program into a microcontroller, you need a programmer: the USBASP programmer is considered the best, which provides a voltage of 5 Volts, which will be used in the future. For the purpose of visual assessment and conclusions of the results of the project, data reflection resources are needed - these are LEDs, an LED inductor and a screen.


To explore the procedures for communicating the microcontroller with other devices, you need a numerical temperature device DS18B20 and showing right time, watch DS1307. It is also important to have transistors, resistors, quartz resonators, capacitors, and buttons.

In order to install the systems, you will need a sample mounting board. To build a structure on a microcontroller, you should use development board for assembly without soldering and a set of jumpers for it: sample board MB102 and connecting jumpers to the breadboard of several types - elastic and rigid, as well as U-shaped. Microcontrollers are coded using the USBASP programmer.

The simplest device based on the AVR microcontroller. Example

So, having become familiar with what AVR microcontrollers are and with their programming system, let’s consider the simplest device, the basis for which is this controller. Let us give an example of a driver for low-voltage electric motors. This device makes it possible to control two weak points at the same time. electric motors continuous current.

The maximum possible electric current with which it is possible to load a program is 2 A per channel, and highest power motors is 20 W. On the board there is a pair of two-terminal blocks for connecting electric motors and a three-terminal block for supplying amplified voltage.

The device looks like printed circuit board measuring 43 x 43 mm, and a radiator minicircuit is built on it, the height of which is 24 millimeters and the weight is 25 grams. For the purpose of load manipulation, the driver board contains about six inputs.

Conclusion

In conclusion, the AVR microcontroller is a useful and valuable tool, especially for tinkerers. And, using them correctly, adhering to the rules and recommendations for programming, you can easily acquire useful thing not only in everyday life, but also in professional activity and just in everyday life.

This article proposes a scheme digital thermometer on an AVR ATtiny2313 microcontroller, a DS1820 (or DS18b20) temperature sensor connected to the microcontroller via a 1-wire protocol, and a 16x2 LCD display on an HD44780 controller. The described device can find wide application among radio amateurs.

The program for the microcontroller is written in assembly language in AVR environment Studio. Installation is carried out on a breadboard, quartz resonator at 4 MHz, the ATtiny2313 microcontroller can be replaced with AT90S2313 by first recompiling source programs. The error of the DS1820 sensor is about 0.5 C. The archive also contains firmware for the case when a DS18B20 sensor is used. The sensor is polled every second.

The WAV player is built on an AVR ATtiny85 microcontroller (ATtiny25/45/85 series can be used). Microcontrollers in this series have only eight legs and two PWM (Fast PWM) with a 250kHz carrier. To control a memory card, only 6 wires are enough: two for power and four signal. Eight pins of the microcontroller are enough to work with a memory card, sound output and control buttons. In any case, this player is very simple.

With this capacitance meter you can easily measure any capacitance from units of pF to hundreds of microfarads. There are several methods for measuring capacitance. IN this project The integration method is used.

The main advantage of using this method is that the measurement is based on time measurement, which can be done quite accurately on an MC. This method is very suitable for homemade meter capacity, besides, it can be easily implemented on a microcontroller.

This project was made at the request of a friend to be installed on a door to a storage room. Subsequently, several more were made at the request of friends and acquaintances. The design turned out to be simple and reliable. Works this device like this: it allows only those RFID cards that were previously stored in the device’s memory.

Microcontroller circuits, articles and descriptions with firmware and photographs for the car.

A simple tachometer on the ATmega8 microcontroller

A tachometer is used in cars to measure the rotation speed of any parts that are capable of rotating. There are many options for such devices, I will offer an option on AVR microcontroller ATmega8. For my option, you also...

Read completely

Color music on the Attiny45 microcontroller in the car

This color music, having a small size and 12V power supply, can alternatively be used in a car for any events. The primary source of this diagram is Radio No. 5, 2013 A. LAPTEV, Zyryanovsk, Kazakhstan. Scheme…

Read completely

Heated mirror and rear window controller

Allows you to control the heated rear window and mirrors separately with one button, plus a customizable shutdown timer of up to one and a half hours for each channel. The circuit is built on an ATtiny13A microcontroller. Description of work:

Read completely

Dimmer for car lamp

Almost all cars have interior light control, which is carried out using on-board computer or separate on-board system. The light turns on smoothly and also goes out with a certain delay (for...

Read completely

GSM alarm with mobile phone notification

I present a very popular car alarm circuit based on the ATmega8 microcontroller. Such an alarm gives an alert to the administrator’s mobile phone in the form of calls or SMS. The device integrates with a mobile phone using...

Read completely

Blinking stopak on the microcontroller

Did new version blinking stopak. The operating algorithm and control circuit are different, the size and connection are the same. It is possible to adjust the frequency of blinking, the duration before switching to a constant glow and the duty cycle...

Read completely

DRL plus strobes

This craft allows you to strobe LED DRLs. The craft is small in size, controlled by just one button, ample opportunities settings. The board size is 30 by 19 millimeters. WITH reverse side The terminal block is located...

Read completely

We make and connect the door closer to the alarm system

The number of cars with automatic windows is constantly growing, and even if the car does not have one, many people make it themselves. My goal was to assemble such a device and connect it to...

Read completely

LEDs turn on based on speed

It turned out to be a “by-product”: it was necessary to test the operating mode of the speed sensor for the project of displaying gears on a 5x7 matrix, for this I assembled a small circuit. The circuit can turn on LEDs depending...

Read completely

Digital tachometer on AVR microcontroller (ATtiny2313)

The tachometer measures the rotation speed of parts, mechanisms and other components of the car. The tachometer consists of 2 main parts - a sensor that measures rotation speed and a display where...

Read completely

Simple digital speedometer on ATmega8 microcontroller

Speedometer is measuring device, to determine the speed of the car. According to the measurement method, there are several types of speedometers: centrifugal, chronometric, vibration, induction, electromagnetic, electronic, and finally speedometers by GPS system.

Read completely

Smooth ignition of the tidy on the microcontroller

This version has a slightly different layout: a second setting button has been added and the ignition speed potentiometer has been removed. Features: Two separate independent channels. For each channel there are three groups of adjustable parameters: delay time before the start...

The principle of closing the cage door is very simple. The cage door is supported by a special stop made of copper wire. A nylon thread of the required length is attached to the stop. If you pull the thread, the stop slides and the cage door closes under its own weight. But this is in manual mode, and I wanted to implement an automatic process without the participation of anyone.

A servo drive was used to control the cage door closing mechanism. But in the process of work it created noise. The noise could scare the bird away. Therefore, I replaced the servo drive with a commutator motor taken from radio controlled car. It worked quietly and was ideal, especially since it was controlled commutator motor there were no difficulties.

To determine if the bird was already in the cage, I used an inexpensive motion sensor. The motion sensor itself is already a complete device, and there is no need to solder anything. But this sensor has a very large response angle, and I need it to respond only in the inner area of ​​the cell. To limit the angle of operation, I placed the sensor in the base of what once served as an economy lamp. I cut out a kind of plug from cardboard with a hole in the middle for the sensor. After fiddling with the distance of this plug relative to the sensor, I adjusted the optimal angle for the sensor to operate.

As a barker for birds, I decided to use the WTV020M01 sound module with the singing of siskin and goldfinch recorded on a microSD memory card. These are exactly what I was going to catch. Since I used one sound file, then I decided to control the sound module in a simple way, without using an exchange protocol between the sound module and the microcontroller.

When fed to the ninth leg of the sound module low signal, the module began to play. Once the sound has been played on the fifteenth leg of the sound module, the low level. Thanks to this, the microcontroller monitored the sound playback.

Since I implemented a pause between sound playback cycles, to stop sound playback the program applies a low level to the first leg of the sound module (reset). The sound module is a complete device with its own sound amplifier, and, by and large, it does not need an additional sound amplifier. But this sound amplification seemed not enough to me, and I used the TDA2822M chip as a sound amplifier. In audio playback mode it consumes 120 milliamps. Considering that catching a bird will take some time, as a autonomous battery I didn’t use enough nutrition new battery from the uninterruptible power supply (it was still lying around idle).
The principle of the electronic bird catcher is simple, and the circuit consists mainly of ready-made modules.

Program and scheme -