Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Lunokhod with microcontroller control. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Microcontrollers

Comments on the article Comments on the article

The described device was developed to demonstrate the capabilities of software and hardware systems for controlling moving objects. The object was a children's toy "moon rover" with a wire remote control, driven by two DC electric motors and allowing you to control each of them separately. When the power is turned on, the model starts to move forward. At the same time, the transmitter and receiver of pulsed IR radiation mounted in it are turned on. The movement continues until the intensity of the reflected IR signal exceeds the set threshold, which indicates the presence of an obstacle on the way. Once this happens, the model rolls around until the reflected signal falls below this threshold, after which it continues forward, and so on.

A schematic diagram of the hardware-software complex for controlling the "Lunokhod" model is shown in the figure. It is based on the economical AT90S2313 (DD1) eight-bit CMOS microcontroller (MC) built using the advanced AVR RISC architecture. The clock frequency is set by the ZQ1 quartz resonator at a frequency of 5 MHz (it can be any other, up to 10 MHz). A circuit of resistor R13 and capacitor C12 serves to reset the MK at the moment the power is turned on. The connector X1 is introduced for quick connection and disconnection of the MK and the rest of the device, as well as for connecting the MK to a computer in order to update the program or diagnose work.

Lunokhod with microcontroller control
(click to enlarge)

In addition to the microcontroller, the device contains a pulse transmitter of infrared radiation (VT4, VD2), a receiver of radiation reflected by an obstacle, consisting of a photodiode VD1, a two-stage amplifier (VT1, VT2) and a synchronous detector (VT3), and four electronic switches (1VT1 - 1VT3, .. ., 4VT1 - 4VT3). The device is powered by a battery consisting of four Ni-Cd batteries of size C with a capacity of 1500 mAh, installed in the compartment provided in the model. The supply voltage of the microcontroller and the IR receiver is maintained by an unchanged microcircuit voltage regulator DA1.

During operation, pulses with a repetition rate of about 0 Hz are received from the output of the PD4 port to the base of the transistor VT1220. As a result, it periodically opens, and the VD2 light-diode included in its collector circuit creates IR radiation pulsing with a specified frequency in the direction of movement of the model. Resistor R7 limits the current through the emitter junction of the transistor and protects the output of the MK port from damage during breakdown of this junction. The maximum current through the LED is limited by resistor R9.

The IR radiation reflected by the obstacle is perceived by the VD1 photodiode, connected in parallel with the resistor R2, through which the direct current feedback is carried out, covering the two-stage amplifier on transistors VT1, VT2. Voltage pulses from the collector of transistor VT2 are fed to a synchronous detector made on a field-effect transistor VT3. Its use is due to the fact that during the operation of the locator, resistor R3 creates not only oscillations with a frequency of about 1220 Hz, but also ripples with a frequency of 100 Hz from incandescent lamps, as well as random interference in both the visible and IR ranges of the spectrum. The level of these interferences is often commensurate with the level of infrared radiation reflected by the obstacle, and if special measures are not taken, this can lead to the detection of a false obstacle. To prevent such errors, a synchronous detector was used. Its input (the gate of the transistor VT3) is connected to the same port (DO) as the input of the transmitter, therefore, synchronously with the flashes of the VD2 LED, the transistor VT3 opens, which connects the output of the amplifier on transistors VT1, VT2 to one of the inputs of the MK comparator (PB0 / AIN0 ). The exemplary voltage at its other input is set by a tuned resistor R12, thereby adjusting the sensitivity of the device to the reflected signal.

The operation of the electric motors of the MK model is controlled by electronic keys S1 - S4. Consider the work of one of them, for example, the first one (the rest act similarly). When the input voltage is less than 0,6 V (log. 0), the transistors 1VT1 and 1VT3 are closed, and 1VT2 is open, so the voltage at the output and the output of the motor M1 connected to it is close to the voltage of the GB1 power battery. Submission to the input of the key level log. 1 causes transistor 1VT1 to open, due to which 1VT2 closes, and 1VT3 opens and the output voltage becomes close to 0. Resistor 1R1 limits the current consumed by the key from the MK output to a value of about 3 mA, which is much less than the allowable output current (20 mA at logic level 0 and 10 mA at logic level 1). The resistance of the resistor 1R2 is selected in such a way as to, on the one hand, provide a sufficient output current of the key when 1VT2 is open, and on the other hand, so that the current through the open transistor 1VT1 is not too large.

Since the electric motors used in the model consume a very large current (about 600 mA) and create intense impulse noise, they had to be replaced by more economical and less interference motors DPB-902. It is possible to use other collector electric motors from tape recorders and radio tape recorders.

To manage electronic keys, four high-order digits of port B are used: РВ7, РВ6, РВ5 and РВ4. The operation of the IR transmitter is controlled by the least significant bit of port D - PD0, the two least significant bits of port B (PB0 and PB1) are configured and used respectively as direct and inverse inputs of the analog comparator.

As can be seen from the diagram, to turn on, for example, the electric motor M1, it is necessary to open one of the keys S1, S2 and close the other. If you open or close both keys, the voltages at their outputs will be the same, so the voltage on the electric motor will be 0. If you open the key S1 and close S2, the left (according to the diagram) output of the engine will be connected to the positive of the battery,

and the right one - with its minus, and it will begin to rotate in one direction. If, on the contrary, open S2 and close S1, the motor connection polarity will be reversed and it will start to rotate in the opposite direction. Software inclusion is carried out by writing to port B of the constants indicated in Table. 1.

Lunokhod with microcontroller control

Software control of the IR radiation transmitter is performed by writing a certain number to port D of the MK. If the least significant bit of this number is 0, the VD2 LED is off, and if it is 1, it is on. Sequential change of the values ​​of this bit leads to the occurrence of a pulsating illumination level ahead of the model in the IR part of the spectrum. The level of reflected radiation is fixed by a photo sensor, and as it increases, an assumption is made about the presence of an obstacle ahead.

The peculiarity of the program is that the control algorithm is placed in the MK timer handler. This is due to the fact that it is necessary to switch the emitting LED with a certain constant frequency, and to simplify the program, the control algorithm is placed there. After a reset signal is given at the moment the power is turned on, the MK starts executing the program from the Start mark. In this part of the program, the initial initialization of the stack, registers, I / O ports B and D, analog comparator, eight-bit timer is performed, the pulse repetition rate for the timer is set to CK / 8 (CK - clock frequency equal to 5 MHz), and the interrupt handler timer overflow.

Since the timer overflows every time after 256 (28) pulses, the interrupt handler is called 2441 times per second. As a result, the emitting LED switches at a frequency of approximately 1221 Hz. The analysis of the received reflected signal is performed once in 20 timer cycles, i.e., with a frequency of 122 Hz.

The control algorithm works as follows. Register r24 is used as a counter with a range of values ​​from 0 to 240. At each check, if there is an obstacle and the counter value is less than 240, it is increased by 1, and if there is no obstacle, it is decreased by the same amount until it becomes 0. Further, at counter values ​​from 0 to 16 command to move forward, from 17 to 31 - to stop, and from 32 to 240 - to turn around. Such an algorithm avoids false alarms and increases the probability of a complete bypass of the obstacle (the model turns around for some time even after it disappears).

On register r27, a counter of turns is organized, according to which every second turn is made in the opposite direction to the previous one, and on register r18 - a counter of the motor control algorithm. It sequentially takes values ​​from 0 to 3 with each interrupt call. At O, the right engine is turned off, and at 2, the left engine. Thus, the current consumed from the battery is reduced, thereby increasing the battery life of the model from one battery charge to the next.

Program codes in the form of a hex-file are given in Table. 2.

Full text of the program in assembly language

Lunokhod with microcontroller control
(click to enlarge)

Setting up the device is easy. First, turning off the microcontroller by disconnecting the parts of the X1 connector, install the battery in place and, by closing the contacts of the switch Q1, measure the voltage at the output of the DA1 stabilizer. Then, by connecting the oscilloscope to the drain of the transistor VT3 and illuminating the photodiode with some source of IR radiation (for example, a remote control for a TV or VCR), they make sure that the photodetector is working.

The remaining nodes, when using serviceable parts and the absence of errors in installation, do not need to be adjusted. Finally, the MK is connected (with the power off) and the operability of the device as a whole is checked. The sensitivity of the photodetector, if necessary, adjust the tuning resistor R12.

Author: P. Chechet, Vasilevichi, Gomel region, Belarus

See other articles Section Microcontrollers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

The threat of space debris to the Earth's magnetic field 01.05.2024

More and more often we hear about an increase in the amount of space debris surrounding our planet. However, it is not only active satellites and spacecraft that contribute to this problem, but also debris from old missions. The growing number of satellites launched by companies like SpaceX creates not only opportunities for the development of the Internet, but also serious threats to space security. Experts are now turning their attention to the potential implications for the Earth's magnetic field. Dr. Jonathan McDowell of the Harvard-Smithsonian Center for Astrophysics emphasizes that companies are rapidly deploying satellite constellations, and the number of satellites could grow to 100 in the next decade. The rapid development of these cosmic armadas of satellites can lead to contamination of the Earth's plasma environment with dangerous debris and a threat to the stability of the magnetosphere. Metal debris from used rockets can disrupt the ionosphere and magnetosphere. Both of these systems play a key role in protecting the atmosphere and maintaining ... >>

Solidification of bulk substances 30.04.2024

There are quite a few mysteries in the world of science, and one of them is the strange behavior of bulk materials. They may behave like a solid but suddenly turn into a flowing liquid. This phenomenon has attracted the attention of many researchers, and we may finally be getting closer to solving this mystery. Imagine sand in an hourglass. It usually flows freely, but in some cases its particles begin to get stuck, turning from a liquid to a solid. This transition has important implications for many areas, from drug production to construction. Researchers from the USA have attempted to describe this phenomenon and come closer to understanding it. In the study, the scientists conducted simulations in the laboratory using data from bags of polystyrene beads. They found that the vibrations within these sets had specific frequencies, meaning that only certain types of vibrations could travel through the material. Received ... >>

Random news from the Archive

Extraction of clean water from fog 31.08.2023

A group of engineers from the Institute for Polymer Research at the Max Planck Society and ETH Zurich have successfully developed an innovative method for extracting potable water from fog. This technology can be applied in areas where fresh water sources are scarce, such as regions with limited access to spring or rain water.

Engineers have created a special fine-mesh mesh made from metal wire and coated with a combination of polymers and titanium oxide. This design ensures that moisture is optimally collected on the surface of the mesh, and then the water flows efficiently into the collection tank, preventing it from being blown away by the wind. Titanium oxide acts as a chemical catalyst, decomposing organic contaminants in water droplets and neutralizing them.

This technology requires minimal maintenance and does not depend on the use of electricity, and sunlight is sufficient for its operation. Regeneration of titanium oxide periodically requires ultraviolet irradiation, but this process is economical: just half an hour of sunlight will provide catalyst activity for 24 hours.

The researchers tested the new system both in the laboratory and in a small pilot plant in Zurich. They were able to capture 8% of the moisture from the artificial fog and remove 94% of the organic compounds added to the fog. Among the contaminants removed were tiny droplets of diesel fuel and substances such as the hormone-active chemical bisphenol A.

In arid regions, people are already using metal nets to collect water from fog. The droplets condense on the grid, flow down and can be collected. Collectors with an area of ​​only a few square meters, installed in places with dense fog, are capable of collecting several hundred liters of water.

However, there is a problem of air pollution: dangerous and toxic substances can accumulate in the water droplets of the fog. In the ranks of large cities, air pollution is so significant that water collected from mist without prior purification may be unsuitable for drinking or cooking. A new discovery addresses this challenge by providing a safe and affordable source of clean drinking water.

Other interesting news:

▪ MATSUSHITA Starts DVD-RAM Promotion

▪ Supercomputer successfully imitates communication with a teenager

▪ Drops of quantum mechanics

▪ MusicDNA - successor to MP3

▪ Fingerprint sensors in cameras and lenses

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ website section Television. Article selection

▪ article There are only girls in jazz. Popular expression

▪ article What are nitrobacteria? Detailed answer

▪ article Fragrant parsley. Legends, cultivation, methods of application

▪ article Simple tachometer. Encyclopedia of radio electronics and electrical engineering

▪ article Once again about the introduction of the Russian frequency grid into imported CBS radio stations. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024