ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING The microcontroller controls the all-terrain vehicle. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Microcontrollers Wide functionality, relative ease of programming and low cost have made single-chip microcontrollers attractive for amateur radio creativity. The proposed device was developed as a visual aid for a radio engineering circle in order to make it easier for young radio amateurs to study microcontrollers and make this study visual, lively and entertaining. The product is based on a large electromechanical toy - a caterpillar space all-terrain vehicle driven by two electric motors. It is controlled by the available domestic microcontroller KR1878BE1. The program provides for a series of sequential actions that provide automatic guidance of the machine to the light source and approach to it. All actions are accompanied by corresponding voice messages recorded in the memory of the specialized chips Chipcorder by Winbond Electronics, already familiar to readers. The device described below works as follows. After the power is turned on, the control LED blinks twice, signaling the normal operation of the microcontroller. Then, within 20 seconds, the machine tells why and by whom it was created, as well as that it is controlled by a single-chip microcontroller KR1878BE1. Further, she reports on her task - to find a light source and get close to it, after which she determines the level of illumination in the direction in front of her, performs a turn to the right by about 10 °, measures the illumination again. If after turning to the right it has become smaller, it should turn left by the same 10 °, if it has increased, then another turn to the right is made, the illumination is measured again, etc. In other words, the car turns in the direction of increasing illumination until it does not stop (while slightly jumping the direction to the maximum illumination), then makes one turn in the opposite direction. As a result, the direction to the first found maximum illumination is determined. After that, the car starts approaching the target - it moves towards it for a certain time. Further, this sequence of actions is performed a specified number of times. All actions are commented by voice messages. After the last step of the program has been completed, the machine reports that the program has been completed. (The 10° turn of the machine is determined by the operating time of the corresponding electric motor and the speed of the caterpillar of the electromechanical toy that the author used). Schematic diagram of the control part of the device is shown in fig. 1. Its basis is the DD1 KR1878BE1 microcontroller [1-3]. The switching scheme is typical. The clock frequency is set by the ZG1 quartz resonator. The HL1 LED serves to indicate that the microcontroller has started up normally and the program is running. The signal source is the photodiode VD2. With the help of the op amp DA2.1, its photocurrent is converted into voltage. Resistor R13 and capacitor C9 form a low pass filter. The follower on the op-amp DA2.2 ensures its coordination with the input of the ADC DA4. The exemplary voltage is created using an integral zener diode DA6 and a current-limiting resistor R34. Resistor R12 is selected for a specific copy of the VD2 photodiode so that when the illumination is close to maximum, the voltage at the ADC input does not exceed the exemplary one, equal to 2,5 V. The device uses a 10-bit ADC TLC1549CP with a serial interface. This allows the microcontroller to control and receive data from the ADC using only three signal lines. The timing diagram of the ADC operation is shown in fig. 2. After the CS signal is applied, the most significant bit of the result of the previous conversion appears at the DATA output. To get the next bit, you need to apply a pulse to the I/O CLOCK input of the ADC. By its decline, the next bit appears at the DATA output, and so on. Simultaneously, by the decline of the third pulse at the I / O CLOCK input, the sampling of the input analog signal from the IN input of the ADC begins. On the decline of the tenth pulse at the input I / O CLOCK, the output of the result of the previous conversion ends and a new conversion begins. A high level must be applied to the CS input. After 21 µs or more, the CS signal can be applied and the conversion result can be read out. The general algorithm is as follows: first, "push" unnecessary 10 bits of the previous conversion from the ADC, then wait at least 21 μs, and then read the result of the current conversion. The supply voltage of the electric motors M1 and M2 is supplied through keys made on transistors VT1 and VT2. When a high level voltage appears at the outputs of the microcontroller PA2 and TIME, the transistors VT1 and VT2 open and the electric motors begin to rotate the tracks. In this embodiment, the product can move forward and turn by braking one of the tracks. If it is necessary to ensure reversing or turning by counter-rotating the tracks, then there should be eight transistors and an additional transcoder chip from three lines (in this case, the PA4 port is also used) to eight keys. Such a switch was assembled and tested by the author, but in practice it turned out that one can do without reverse gear, and the motor control device is greatly simplified. The remaining units of the device are designed to sound the product, and their exclusion will not affect the operation of the control part. Microcircuits DA3 and DA5 of the ISD1400 series [4-6] differ from the ISD7 series described in [4004] by a shorter recording time (20 s) and a simpler interface that does not require microprocessor control. The inclusion of DA3 and DA5 chips corresponds to that described in the documentation for their use. When establishing, all short voice messages are recorded in the first of them, and one long voice message is recorded in the second. Shift register DD2 serves to accumulate in it an eight-bit address from which the recording of the desired phrase begins. Before starting the search for a light source through the output PB2, the microcontroller sends a signal to the DA5 to start playing, and it plays a single long message. During the process of pointing and approaching the target, the microcontroller outputs through DD2 to the address inputs of DA3 the address of the beginning of the desired phrase, after which the signal to start playing the phrase is sent through the RVR output. Messages are amplified by a power amplifier based on the DA1 chip. The volume is adjusted by the trimming resistor R1. After completing the specified number of steps for pointing and approaching the light source, the model stops. The PAO and PB4 pins (points A and B) are reserved for connecting two buttons with make contacts (the second pins of the buttons are connected to the common wire of the device). Inside the microcontroller, resistors connected to the +5 V power bus are programmatically connected to these pins. When the button contacts are closed, the voltage at the corresponding pin drops to 0. If you program the interrupt mode for the voltage drop at these inputs and add interrupt handling routines, you can "teach" car to respond to obstacles. The codes of the program that must be entered into the memory of the microcontroller are given in Table. 1. The device is powered by a 5 V source through wires, consuming a current of about 0,5 A when moving forward (both motors are running) (depending on the motors used). It should be noted that at the moment of starting, the current consumed is much greater. The author got it at least more than 1,2 A per motor, and there was interference in the power circuit that caused the microcontroller to restart. It was eliminated by connecting resistors R2 and R3 in series with the motors. Most parts of the device are mounted on a 125x65 mm breadboard (Fig. 3). For microcircuits DA3 and DA5, 28-socket sockets are installed on it, and for DD1 - 18-socket. All resistors - MSC oxide capacitors - K50-35 or similar foreign production, the rest - KM. You can take almost any photodiode VD2. Three photodiodes of different types were tested, and a good result was obtained with all of them. The resistance of the resistor R12 in this case changed from 47 to 820 kOhm. If an incandescent lamp is used as a light source, it is desirable to use an IR photodiode, in which case sunlight will be less affected. Instead of the integrated zener diode LM385Z-2,5 (DA6), it is permissible to use the KS133A by reducing the resistance of the resistor R34 to 330 ohms. Replacing the KT863A transistors (VT1, VT2) is undesirable (they were chosen according to two parameters: a high base current transfer coefficient and a low emitter-collector saturation voltage). At the time of recording voice messages, the DD1 microcontroller is removed from the panel, the DA3 chip is installed in place of the DA5, the necessary phrases are written into it, then it is returned to its place, and DA5 to its own and a long message is recorded. Upon completion of all operations, the microcontroller is also installed in place. Messages to the chip installed in place of DA5 are recorded as follows. Before the first recording, using the switch SA1, the address 7h is set at the inputs AO-A00 (all SA1 contacts are in the closed position). This will be the address of the beginning of the first sound fragment in the chip's memory. Then press and hold the SB2 ("REC") button for the entire time of recording the desired phrase. After releasing the button, the recording stops, and the code of the end of the fragment is automatically recorded in the memory of the microcircuit at the end of the sound fragment. Unfortunately, it is impossible to determine the exact address of the end. Therefore, with the help of SA1, an address is set that approximately corresponds to the end of the fragment with a "shortage". This can be done based on the time required to record a fragment, and the table of correspondence of addresses and recording time (in an abbreviated form - see Table 2). For the ISD1420, changing the address to 01h corresponds to a time period of 0,125 s. Short messages like "Target found" last about 1,5 seconds. After setting the address, briefly press the play button SB1 ("PLAT"). If the entered address is less than the address of the end of the fragment, then a piece from the end of the fragment will be heard, and the HL2 LED will flash briefly at the end. If the address was greater, then there will be silence for a relatively long time, and then the flash of the HL2 LED, which means that playback has reached the end of the memory of the chip.In this way, the address of the end of the message is determined.The address following the end of the previous message will become the address of the beginning of the next.All addresses from which messages begin should be carefully recorded, since they will need to be included in the program instead of those that the author got and correspond to the duration of the phrases he uttered. If the volume of voice messages is insufficient, you can increase the resistance of the resistor R1 or use another amplifier with a differential input. The capacitance of the capacitor C6 can be reduced to 0,1 uF, this will speed up the start of the microcontroller. In the motor control module, it may be necessary to reduce the resistance of resistors R4 and R5 to 270 ohms. Literature
Author: N.Ostroukhov, Surgut, Tyumen region See other articles Section Microcontrollers. Read and write useful comments on this article. Latest news of science and technology, new electronics: Machine for thinning flowers in gardens
02.05.2024 Advanced Infrared Microscope
02.05.2024 Air trap for insects
01.05.2024
Other interesting news: ▪ Lightyear 0 - solar-powered production car ▪ Heatwaves became more frequent and lengthened ▪ Smart bracelet shock therapy ▪ Glasses with face recognition News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the Electrician website. PTE. Article selection ▪ garden cart professions article. Drawing, description ▪ article Why does a spider need a web? Detailed answer ▪ article Timber road train driver. Standard instruction on labor protection ▪ article MicroTV Cornflower. Encyclopedia of radio electronics and electrical engineering
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |