Autonomous robot based on Arduino with remote control capabilities. — Thermal imaging camera

Infrared sensor includes a home version of the Lego mindstorms EV3 set. This is the only sensor that can be used either independently or in tandem with an infrared beacon, which is also part of home kit. We will devote the next two lessons to studying these two devices, as well as their interaction with each other.

8.1. We study the infrared sensor and infrared beacon

(Fig. 1) uses light waves in its work, invisible to humans- infrared waves * . The same waves are used, for example, by remote control panels of various modern household appliances(TVs, video and music devices). Infrared sensor in mode "Approximation" independently sends infrared waves and, having caught the reflected signal, determines the presence of an obstacle in front of it. The infrared sensor implements two more modes of operation in tandem with an infrared beacon (Fig. 2). In mode "Remote" The infrared sensor can detect pressing the buttons of the infrared beacon, which allows you to organize remote control of the robot. In mode "Lighthouse" The infrared beacon sends constant signals from which the infrared sensor can determine the approximate direction and distance of the beacon, which allows the robot to be programmed so that it always follows in the direction of the infrared beacon. Before using the infrared beacon, you must install two AAA batteries.

Rice. 1

Rice. 2

8.2. Infrared sensor. Zoom mode

This mode of operation of the infrared sensor is similar to the mode of determining the distance of an ultrasonic sensor. The difference lies in the nature of light waves: if sound waves are reflected from most materials with virtually no attenuation, then the reflection of light waves is affected not only by the materials, but also by the color of the surface. Dark colors, unlike light ones, absorb light more strongly, which affects the operation of the infrared sensor. The operating range of the infrared sensor also differs from the ultrasonic one - the sensor shows values ​​ranging from 0 (the object is very close) to 100 (the object is far away or not detected). We emphasize once again: the infrared sensor cannot be used to determine the exact distance to an object, since its readings in the “Approach” mode are influenced by the color of the surface of the object being examined. In turn, this property can be used to distinguish between light and dark objects located at an equal distance from the robot. The infrared sensor copes quite successfully with the task of identifying an obstacle in front of it.

Let's decide practical problem, similar to Problem No. 14 of Lesson No. 7, but in order not to repeat ourselves, we will complicate the condition with additional requirements.

Task #17: write a program for a rectilinearly moving robot that stops in front of a wall or obstacle, moves back a little, turns 90 degrees and continues moving until the next obstacle.

A robot assembled according to instructions small-robot-31313, an infrared sensor is installed ahead in the direction of travel. Connect it with a cable to the port "3" EV3 module and let's start creating the program.

Let's consider the program block "Expectation" Orange palette by switching it to Mode: - "Comparison" - "Zooming" (Fig. 3). In this mode, the program block "Expectation" has two input parameters: "Comparison type" And "Threshold value". We already know how to configure these parameters.

Rice. 3

Solution:

  1. Start straight forward movement
  2. Wait until the infrared sensor threshold value becomes less than 20
  3. Stop moving forward
  4. Move back 1 engine revolution
  5. Turn right 90 degrees (using the knowledge of Lesson No. 3, calculate the required angle of rotation of the motors)
  6. Continue executing steps 1 - 5 in an endless loop.

Try to solve Problem No. 17 independently, without looking into the decision.

Rice. 4

Now, to consolidate the material, try adapting the solution Problems No. 15 of Lesson No. 7 to use the infrared sensor! Happened? Share your impressions in the comments to the lesson...

8.3. Remote control of a robot using an infrared beacon

The infrared beacon included in the home version of the Lego mindstorms EV3 construction kit, paired with an infrared sensor, allows for remote control of the robot. Let's take a closer look at the lighthouse:

  1. Using an infrared beacon, direct the signal transmitter (Fig. 5 item 1) towards the robot. There must be no obstacles between the beacon and the robot! Thanks to the wide viewing angle, the infrared sensor reliably receives signals, even if the beacon is located behind the robot!
  2. There are 5 gray buttons on the beacon body (Fig. 5 item 2), the clicks of which are recognized by the infrared sensor and transmits the click codes to the program that controls the robot.
  3. Using a special red switch (Fig. 5 item 3) You can select one of four channels for communication between the beacon and sensor. This was done so that several robots could be controlled in close proximity.

Rice. 5

Problem #18: write a program remote control robot using an infrared beacon.

We already know that to implement the ability to select executing blocks, we need to use a program block "Switch" Orange palette. Set the operating mode of the block "Switch" V - "Measurement" - "Remote" (Fig. 6).

Rice. 6

To activate the connection between the infrared sensor and the beacon, it is necessary to establish correct value parameter "Channel" (Fig. 7 item 1) according to the selected channel on the beacon! Each block program container "Switch" it is necessary to compare one of possible options pressing gray keys (Fig. 7 item 2). Note that some options involve pressing two keys at the same time (pressed keys are marked in red). Total in program block "Switch" in this mode you can process up to 12 differing conditions (one of the conditions must be selected as the default condition). Software containers are added to the block "Switch" by clicking on "+" (Fig. 7 item 3).

Rice. 7

We propose to implement the following robot control algorithm:

  • Pressing the top left button turns on the left motor rotation, the robot turns to the right (Fig. 7 item 2 value: 1)
  • Pressing the top right button turns on the right motor rotation, the robot turns left (Fig. 7 item 2 value: 3)
  • Simultaneously pressing the upper left and right buttons turns on the simultaneous forward rotation of the left and right motors, the robot moves forward in a straight line (Fig. 7 item 2 value: 5)
  • Simultaneously pressing the lower left and right buttons turns on the simultaneous backward rotation of the left and right motors, the robot moves backwards in a straight line (Fig. 7 item 2 value: 8)
  • If no beacon button is pressed, the robot stops (Fig. 7 item 2 value: 0).

When developing a remote control algorithm, you should know the following: when one of the combinations of gray buttons is pressed, the infrared beacon continuously sends the corresponding signal; if the buttons are released, the sending of the signal stops. The exception is a separate horizontal gray button (Fig. 7 pos. 2 value: 9). This button has two states: "ON" - "OFF". In the on state, the beacon continues to send a signal, even if you release the button (as indicated by the green LED lighting up), to turn off the signal sending in this mode, press the horizontal gray button again.

Let's start implementing the program:

Our remote control algorithm provides 5 behavior options, accordingly our program block "Switch" will consist of five software containers. Let's start setting them up.

  1. Let's assign the default option to the option when no button is pressed. (Fig. 7 item 2 value: 0). Let's install a software block in the container that turns off the motors "B" And "C".
  2. In the top left button click option container (Fig. 7 item 2 value: 1) install the software block "Big Motor", turning on the motor "B".
  3. In the top right button click option container (Fig. 7 item 2 value: 3) install the software block "Big Motor", turning on the motor "C".
  4. In the container of the option of simultaneously pressing the upper left and right buttons (Fig. 7 item 2 value: 5) install the software block "Independent motor control" "B" And "C" forward.
  5. In the container of the option of simultaneously pressing the lower left and right buttons (Fig. 7 item 2 value: 8) install the software block "Independent motor control", turning on the motors "B" And "C" back.
  6. Let's place our customized program block "Switch" inside the program block "Cycle".

Using the proposed scheme, try to create a program yourself, without looking at the solution!

Rice. 8

Load the resulting program into the robot and run it. Try controlling the robot using an infrared beacon. Did everything work out for you? Do you understand the principle of implementing remote control? Try implementing additional control options. Write your impressions in the comments to this lesson.

*Want to see invisible waves? Turn on the photo mode in your mobile phone and bring the emitting element of the remote control from the TV to the lens mobile phone. Press the buttons on the remote control and watch the glow of infrared waves on the phone screen.

In this article we will look at several robot designs that implement the following behaviors:
1. It goes around an obstacle when it comes into contact with it with its “antennae”.
2. Avoids obstacles without contact (IR bumper).
3. It rests its “antennae” on the obstacle, moves back, makes a turn, then continues moving.
4. Avoids obstacles with a turn (IR bumper).
5. Follows the object while maintaining distance (IR bumper).

Before we start looking at the circuits, let's briefly look at the features of the L293 chip.

Fig.1. Pinout of the L293D chip

Inside it there are two drivers for controlling electric motors.
The motors are connected to the OUTPUT outputs. We have the ability to connect two motors direct current.
The 8th and 16th pins of the microcircuit are connected to the power supply positive. Separate power supply is supported, i.e. The 16th pin (Vss) is intended to power the chip itself (5 volts), and the Vs pin (8th pin) can be connected to the power supply for the motors. The maximum voltage of the power section is 36 volts.
I will not separate them and will connect them in all circuits to a common power source.
The power supply negative or ground (GND) is connected to pins No. 4, 5, 12, 13. These contacts, in addition, provide heat dissipation for the microcircuit, so when soldering to the board, it is advisable to allocate an enlarged metallized area for these pins.
The microcircuit also has inputs ENABLE1 and ENABLE2.
To turn on the drivers, there must be a logical unit on these pins; in other words, we connect the 1st and 9th pins to the power supply positive.
There are also INPUT inputs for controlling motors.

Fig.2. Table of correspondence between logical levels at inputs and outputs.

Above is a table from which you can understand that if a logical one is applied to the INPUT1 input, i.e. connect to the positive of the power supply, and the INPUT2 input to the negative, then motor M1 will begin to rotate in a certain direction. And if you swap the logical levels at these inputs, then motor M1 will rotate in the other direction.
The same thing happens with the second part, to which the M2 motor is connected.

It is this feature that is used in the presented robot schemes.

Scheme No. 1. The robot goes around an obstacle when it contacts it with its “antennae”.

Fig.3. Scheme No. 1. With mechanical obstacle sensors.

After power is applied, the motors will rotate in a certain direction, moving the robot forward. This occurs due to the fact that a signal is supplied to INPUT1 through resistor R2 high level, the same as at the INPUT4 input. Transistor VT1 is securely closed, the base is pulled to the power supply minus, and no current flows into the collector.
I will explain on the left side, because... both parts are symmetrical.
At the INPUT2 input, a logical 0 is set through resistor R3. Judging by the table (Fig. 2), the motor rotates in a certain direction. On the right side of the diagram, the same thing happens and the robot moves forward.
The circuit contains keys (SB1, SB2), which use SPDT switches. Paper clips are attached to them using hot glue and obstacle sensors are obtained.

Fig.4. Antennae sensors are made from paper clips.

When such a sensor hits an obstacle, the key closes and the INPUT2 input is connected to the power supply positive, i.e. logical "1" is supplied. At the same moment in time, the transistor also opens, as a result of which the logical one at the INPUT1 input is replaced by a logical zero. When the button is pressed, the motor rotates in the other direction. Microswitches occur jerkily and the motor turns the robot away from the obstacle until the sensor stops contacting the obstacle.

As you may have guessed, the switches or the motors themselves need to be arranged crosswise.

Scheme No. 2. Robot avoids obstacles without contact (IR bumper)

Even more interesting behavior can be realized if TSOP receivers are used as sensors to receive infrared signals. This will be some kind of IR bumper.
So now the circuit looks like this.

Fig.5. Scheme No. 2. With infrared obstacle sensors.

The “IR receiving module” works like this: when an infrared signal arrives at the TSOP receiver, a negative voltage appears at its output, which unlocks the PNP transistor, and the current from the power supply is supplied to the input circuit of the microcircuit. If last time mechanical switches were used, with so-called antennae made of paper clips, then the new scheme will allow the robot not to crash into an obstacle, but to react to it from a certain distance. It looks like this:

The receiving part is designed in this way: two absolutely identical modules (left and right) fastened together (Fig. 8).

TSOP1136 with an operating frequency of 36 kHz were used as receivers. The pin locations are shown in the figure below.

Fig.6. TSOP1136.

We figured out the receivers, but to detect obstacles you need to send infrared radiation with a certain frequency. The operating frequency of receivers varies, in my case it is 36 kHz. Therefore, a pulse generator for this frequency was assembled on the NE555 chip, and infrared emitting diodes were connected to the output.


Fig.7. NE555 emitter circuit.

A fragment of a breadboard is attached to the robot chassis, on which you can install the desired number of IR diodes.
It is advisable to put heat-shrinkable tubes or something similar on the diodes so that they shine forward and not in different directions.

Fig.8. IR bumper.

After power is applied, the robot may move back, this is due to the too high sensitivity of the TSOP receivers. They perceive the reflected signal even from the floor, walls and other surfaces. Therefore, a trimming resistor is used in the IR signal emitter circuit (Fig. 7), with the help of which we reduce the brightness of the infrared diodes and achieve the desired sensitivity.

Scheme No. 3. Such a robot moves back from the obstacle, making a turn.

Let's look at another interesting scheme.

Fig.9. Scheme No. 3.

When such a robot hits an obstacle with one of its antennae, it moves back, making a slight turn, then after a short pause the robot continues moving. The behavior is shown in the animation below:

This circuit is also fully compatible with the infrared bumper from the previous circuit.

Electrolytic capacitors appeared in the circuit between the emitter and the base resistors of transistors VT1 and VT2. Diodes VD1, VD2 and LEDs HL1, HL2 appeared.
Let's take a look at why these additional components are needed.
So, when switch SB1 closes, i.e. the first sensor, the current from the power supply positive through the diode VD1 and the current-limiting resistor R1 is supplied to the base of the transistor. It opens by changing the logical level at the INPUT1 input, and the level at the INPUT2 input also changes.
At this moment, current also flows to capacitor C1 and it charges. Motor M1 suddenly changes direction of rotation and the robot moves back away from the obstacle. In the video you can see that the second motor also changes direction of movement, but for a shorter period of time. This is due to the fact that when sensor SB1 is closed, the current from the power supply plus also flows to the right side of the circuit, through the HL2 LED. LEDs not only provide a short-term signal about a collision with an obstacle, but also act as a voltage absorber for the opposite half of the circuit. Simply put, when switch SB1 is closed, capacitor C2 charges less than C1. And when the key (sensor) SB2 is closed, the same thing happens, but on the contrary - C2 charges more (i.e., the voltage on its plates is greater). This allows you not only to move away from the obstacle, but also to turn slightly away from it. The angle of this turning depends on the capacitance of capacitors C1 and C2. Capacitors with a capacity of 22 uF, in my opinion, are optimal. With a capacitance of 47 µF the rotation angle will be greater.
You can also notice in the video that after the robot moves back from an obstacle, there is a short pause before it moves forward. This occurs due to the discharge of capacitors, i.e. at some point in time, the logical signals at the INPUT inputs are balanced and the driver for a second ceases to understand which direction to rotate the motor. But when C1 and C2 are discharged, the INPUT inputs will return to their original logic levels.
Diodes VD1 and VD2 prevent the discharge of capacitors through the LEDs HL1, HL2. Without LEDs the circuit does not work.

Scheme No. 4. Previous diagram with IR bumper.

This scheme differs from the previous one in that instead of mechanical sensors, infrared (IR bumper) sensors are used here.

Fig. 10. Scheme No. 4.

The collectors of PNP transistors VT1 and VT2, when an obstacle is detected, will send a signal to the input circuit of the microcircuit. Then everything happens the same way as described earlier, only such a robot, when it detects an obstacle in front of itself, moves back, makes a turn, and then continues moving.
The behavior is shown in the animation below:

The robot will behave more abruptly if the capacitance of capacitors C1 and C2 is reduced to, for example, 1 µF (minimum capacitance 0.22 µF).

How to make a robot follow an object?

In all the schemes presented above, the sensors or the motors themselves must be arranged crosswise. And with a direct connection (when the left sensor “commands” the left motor, the right one - the right one), the robot will not avoid the obstacle, but rather follow it. Thanks to direct connection, you can achieve very interesting behavior of the robot - it will actively pursue an object while maintaining a certain distance. The distance to the object depends on the brightness of the IR diodes on the bumper (adjust).

Some more photos:

The chassis uses metal parts from the designer. The breadboard flips out for easy battery replacement.

The robot is powered by 4 AA batteries.

The options for making a body and chassis for a robot are limited only by your imagination, especially since there are many on sale ready-made solutions. In my case, the circuit will be transferred to the board, because a bunch of wires is not aesthetically pleasing. Batteries with a recharging circuit will also be installed. And what other improvements can be made or new functions added - you can suggest all this in the comments.

There is a video for this article that describes in detail the operation of the circuits and demonstrates different options for the robot’s behavior.

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
Circuit elements No. 1 and No. 2 (except for the IR bumper)
VT1, VT2 Bipolar transistor

2N3904

2 To notepad
R1, R2, R4, R6 Resistor

10 kOhm

4 To notepad
R3, R5 Resistor

4.7 kOhm

2 To notepad
C1 100 µF1 To notepad
Elements of the “IR receiving module” in diagram No. 2, No. 4
VT1, VT2 Bipolar transistor

2N3906

2 KT361, KT816 To notepad
R1, R2 Resistor

100 Ohm

2 To notepad
C1, C2 Electrolytic capacitor10-47 uF2 To notepad
Elements of the “IR signal emission module” Fig. 7
R1 Resistor

1 kOhm

1 To notepad
R2 Resistor

1.5 kOhm

1 To notepad
R3 Variable resistor20 kOhm1 to adjust the brightness of FD1, FD2 To notepad
C1 Ceramic capacitor0.01 µF1 To notepad
C2 Ceramic capacitor0.1 µF1 To notepad
FD1, FD2 IR diode 2 Any

This article shows the making simple robot avoiding obstacles on the Xboard v2.0 board. This board is well suited for small smart robots because it is compact, has four DC motor controllers, can be flashed via USB, and has many other features. It is also very easy to learn and use. xAPI is a set of C functions designed to solve complex software problems, such as working with PWM, LCD display, remote control, etc. Very good and easy for beginners. Its design is open, so if you don't want to buy Xboard v2.0, you can make it yourself.

The goal of our robot is simple: you need to move anywhere, avoiding obstacles. The task is simple, and the robot performs it completely independently. It has a brain that reads information from sensors, makes decisions and controls motors.

While creating a robot, you will learn various basic techniques that will be useful to you in the future.

Mechanical part of the robot

The robot is assembled in a high-quality metal case, which can be purchased at a robotics store. The robot is driven by two 200 RPM DC gear motors. It uses a differential transmission system and has a single castor wheel at the front. The wheels are connected directly to the motor shaft.

The engines are attached to the chassis using a nut screwed onto the thread near the shaft.

Xboard v2.0 is mounted using the included mounting kit, which includes bolts, nuts and stands. Xboard v2.0 is made so that its mounting holes coincide with the holes in the case.


Differential gear

Differential transmission allows movement and control using two wheels. There is no need for steering wheels like on a bicycle or car. To turn a vehicle (or robot), the left and right wheels rotate at different speeds. That's why it's called differential transmission. For example, if the right wheel rotates faster than the left, then the robot turns left.

The picture shows this more clearly.

Thus, moving and controlling the robot is done by controlling two motors, which is easily done using xAPI. Read more about this at the following links:
http://xboard.extremeelectronics.co.in/Motor1.htm
http://xboard.extremeelectronics.co.in/Motor2.htm

The articles tell you how to start the engine clockwise or counterclockwise. MotorA is the right motor, MotorB is the left motor. Code snippets showing how to work with engines.

Robot forward movement:

Robot movement backwards:

Left turn:
MotorA(MOTOR_CW,255); // right motor rotates clockwise (CW) with max. speed (255)
MotorB(MOTOR_CW,255); // left motor rotates clockwise (CW) with max. speed (255)

Right turn:
MotorA(MOTOR_CCW,255); // right motor rotates counterclockwise (CCW) with max. speed
MotorB(MOTOR_CCW,255); // left motor rotates counterclockwise (CCW) with max. speed (255)

You can learn more about MotorA and MotorB by clicking on the link

Sensors

Non-contact sensors help the robot detect obstacles in its path. Sensors include IR transmitters and IR receivers. An IR LED is used as an IR transmitter, which emits light in the IR spectrum, invisible to the human eye. The IR receiver receives these rays.

IR sensor

An IR sensor consists of an IR receiver, an IR transmitter and several resistors. The diagram is shown below. We need three of these sensors installed on the front of the robot.

As you can see, the sensor has two pins: power and output. The sensor output can have a voltage from 0 to 5V depending on the distance to the obstacle and its type. The voltage approaches 5V when an obstacle is nearby.

Rating R1 150Ohm, R2 22kOhm. The color code is shown in the diagram above. Resistor values ​​are very important, so only use resistors of the specified value. The short pin of the IR receiver, which is black (translucent) in color, is the positive pin. This is not an error, so connect it that way.

The IR receiver and IR transmitter must be installed so that the IR rays from the IR transmitter hit obstacles and are reflected back to the IR receiver. Their correct location shown in the picture.

The sensor output is connected to the AVR microcontroller ADC. The ADC converts the voltage into a 10-bit digital value from 0 to 1024. That is, based on the value from the ADC, you can find out if there are obstacles in front of the sensor. Working with the Xboard v2.0 ADC is simple and is described in the link.

If we connected the sensor to ADC0, then we can obtain information from it using the following function:
int sensor_value;
sensor_value=ReadADC(0); //Read Channel number 0

When using the resistors indicated in the diagram above, the sensor_value is about 660 when there is no obstacle in front of the sensor, and 745 when the obstacle is about 15 cm. If the obstacle is closer than 6 cm, then the value is 1023. This is the maximum value, and even if the obstacle even closer, the value does not increase.

Please note that these values ​​may vary depending on the type of obstacle. Some objects reflect IR rays better or worse than others. Some objects reflect IR rays very poorly and cannot be detected. These results were obtained using the palm as an obstacle. For example, IR rays are poorly reflected by wood painted in dark colors, such as doors.

Combining and connecting IR sensors

Three IR sensors are mounted on a breadboard, which is mounted on the front of the robot. One sensor is installed in the center of the board, and the other two are on the right and left, respectively.

To begin, the breadboard is cut to required sizes. This can be done using a small hacksaw.

Now you need to drill two holes for mounting. Then we can use screws, nuts and standoffs to install the board on the chassis. I used a power drill to make the holes in a few seconds, but if you don't have one, you can use a hand drill.

On the other side of the board we put spacers on the screws to give some space between the breadboard and the chassis.

Now the development board can be installed on the chassis

Please note that I am using trim resistors instead of 22k Ohm constant resistors. But you must use 22k Ohm fixed resistors. The development board connects to Xboard v2.0 using a standard 8-pin connector. Xboard v2.0 has an 8-pin connector for sensors. This connector also has +5V and GND pins for sensors. Its pinout is shown below.

Connect the right sensor to ADC0, the center sensor to ADC 1 and the left sensor to ADC 2. The sensors are ready, and now you can proceed to testing them.

IR Sensor Testing

Below is a small test program that reads the value from three sensors and displays it on the LCD. To understand how the program works, read the article Interacting with an LCD display using xAPI.

#include "avr/io.h" #include "util/delay.h" #include "lcd.h" void InitADC() ( ADMUX=(1

Compile and flash the program in Xboard v2.0. After that, connect the LCD display and the sensor board. The screen should show values ​​from three sensors as shown below.

When you bring an obstacle close to one of the sensors, the value from it should increase, and when the obstacle is very close, it will increase to 1023. Write down the values ​​​​of the sensors when there is no obstacle in front of them and when the obstacle is about 15 cm away from it. You will need these values ​​to configure the robot program.

I have also provided a HEX file ready to flash the ATmega32 (or ATmega16) microcontroller firmware and get it up and running in no time.

If there is no text on the display, adjust the contrast using the potentiometer.

If the sensors are not working as expected, check the connections. To check the operation of the IR LEDs, use any digital camera, such as a Handicam or a mobile phone camera. Invisible to the human eye, IR rays are clearly visible to the camera. If the LEDs do not emit IR rays, check the connections.

Software part

The program's task is to read sensor values, make decisions, and control two motors. Thus, the robot will drive around the room, going around everything in its path.

We have defined three constants, namely RTHRES, CTHRES and LTHRES: //Threshold Values ​​For Sensor Triggering #define RTHRES 195 #define CTHRES 275 #define LTHRES 195

Their constant values ​​are the entered values. They should already be written down. How to get them is described above. When the sensor value approaches this threshold, the program perceives this as an obstacle. Please note that the values ​​shown above may not correspond to yours. This is fine.

The program begins with the initialization of the motor subsystem and the ADC subsystem: MotorInit(); InitADC();

Then we start moving the robot forward. This is done by calling functions MotorA and MotorB. The first argument is the required direction: MOTOR_STOP MOTOR_CW MOTOR_CCW

The second argument is the required speed. Its value can range from 0 to 255. We use 25.5 to move at full speed.

More information about working with the engine using xAPI can be found in the Xboard v2.0 documentation.

After our robot starts moving forward, we go into an infinite loop, checking if there is any obstacle in front of the robot. If yes, then the robot turns.

You can download the firmware and source code for the project below

Mechanism operation sensors are digital or analog devices for transmitting information about the operation of additional vehicle components. Used in the GPS/GLONASS vehicle monitoring system. Allows you to know how long the mechanism worked, where it worked, what mileage was with the mechanism turned on, how many liters of fuel were spent for each hour of operation.

  • Rotation or motion sensor. Used in GPS/GLONASS monitoring systems to control rotating or moving mechanisms. Basically, the rotation sensor is used to control concrete trucks. The rotation sensor allows you to track all unloadings of the concrete truck and control what the mileage was with the “mixer” turned on. The rotation sensor is also used on construction cranes. When installed on the winch shaft, it is easy to control the intensity of the crane's work. The rotation sensor can also be used on municipal vehicles to control the speed and count the revolutions of the conveyor belt on sand spreading vehicles.
  • Mechanism actual operation sensor. It is used in satellite monitoring systems to monitor the operation of special equipment. It is installed on the moving part and allows you to monitor how effectively the equipment was used. The sensor allows you to determine the moment and duration of lifting, for example, an arrow and find out how much time your equipment was used.
  • Tilt sensor. The tilt angle sensor is easy to install and easy to configure. The tilt angle sensor is used to monitor vehicles that have a lifting mechanism. With its help, you can monitor the efficiency of a truck crane, excavator, and count the number of loaded containers on garbage collection equipment.

The best sensors from StavTREK

Wialon software currently supports a huge number of various sensors. Having tested a large number of models of various production (Russia, Europe, China) we are ready to offer you the best!

Inductive proximity sensor. Appearance

Sensor types

So, what exactly is a sensor? A sensor is a device that produces a specific signal when a specific event occurs. In other words, the sensor is activated under a certain condition, and an analog (proportional to the input effect) or discrete (binary, digital, i.e. two possible levels) signal appears at its output.

More precisely, we can look at Wikipedia: Sensor (sensor, from the English sensor) is a concept in control systems, a primary transducer, an element of a measuring, signaling, regulating or control device of a system that converts a controlled quantity into a signal convenient for use.

There is also a lot of other information, but I have my own, engineering-electronics-applied, vision of the issue.

There are a great variety of sensors. I will list only those types of sensors that electricians and electronics engineers have to deal with.

Inductive. Activated by the presence of metal in the trigger zone. Other names are proximity sensor, position sensor, inductive, presence sensor, inductive switch, proximity sensor or switch. The meaning is the same, and there is no need to confuse it. In English they write “proximity sensor”. In fact, this is a metal sensor.

Optical. Other names are photosensor, photoelectric sensor, optical switch. These are also used in everyday life, they are called “light sensors”

Capacitive. Triggers the presence of almost any object or substance in the field of activity.

Pressure. There is no air or oil pressure - the signal to the controller or it vomits. This is if discrete. There may be a sensor with a current output, the current of which is proportional to absolute or differential pressure.

Limit switches(electrical sensor). This is a simple passive switch that trips when an object runs over or presses against it.

Sensors may also be called sensors or initiators.

That's enough for now, let's move on to the topic of the article.

The inductive sensor is discrete. The signal at its output appears when metal is present in a given zone.

The proximity sensor is based on a generator with an inductor. Hence the name. When metal appears in the electromagnetic field of the coil, this field changes dramatically, which affects the operation of the circuit.


Inductive sensor field. The metal plate changes the resonant frequency of the oscillatory circuit


Inductive npn sensor circuit. A functional diagram is shown, which shows: a generator with an oscillatory circuit, a threshold device (comparator), an NPN output transistor, protective zener diodes and diodes

Most of the pictures in the article are not mine; at the end you can download the sources.

Application of inductive sensor

Inductive proximity sensors are widely used in industrial automation to determine the position of a particular part of the mechanism. The signal from the sensor output can be input to a controller, frequency converter, relay, starter, and so on. The only condition is consistency in current and voltage.


Operation of an inductive sensor. The flag moves to the right, and when it reaches the sensor's sensitivity zone, the sensor is triggered.

By the way, sensor manufacturers warn that it is not recommended to connect an incandescent light bulb directly to the sensor output. I have already written about the reasons - .

Types of inductive sensors

How are the sensors different?

Almost everything that is said below applies not only to inductive, but also to optical and capacitive sensors.

1. Design, type of housing

There are two main options - cylindrical and rectangular. Other housings are used extremely rarely. Case material - metal (various alloys) or plastic.

2. Diameter of cylindrical sensor

Main dimensions - 12 and 18 mm. Other diameters (4, 8, 22, 30 mm) are rarely used.

To secure an 18 mm sensor, you need 2 keys of 22 or 24 mm.

3. Switching distance (working gap)

This is the distance to metal plate, which guarantees reliable operation of the sensor. For miniature sensors this distance is from 0 to 2 mm, for sensors with a diameter of 12 and 18 mm - up to 4 and 8 mm, for large sensors - up to 20...30 mm.

4. Number of wires to connect

Let's get to the circuitry.

2-wire. The sensor is connected directly to the load circuit (for example, a starter coil). Just like we turn on the lights at home. Convenient for installation, but capricious in terms of load. They work poorly with both high and low load resistance.

2-wire sensor. Connection diagram

The load can be connected to any wire; for constant voltage it is important to maintain polarity. For sensors designed to operate with alternating voltage, neither the load connection nor the polarity matters. You don't have to think about how to connect them at all. The main thing is to provide current.

3-wire. The most common. There are two wires for power and one for load. I'll tell you more separately.

4- and 5-wire. This is possible if two load outputs are used (for example, PNP and NPN (transistor), or switching (relay). The fifth wire is the choice of operating mode or output state.

5. Types of sensor outputs by polarity

All discrete sensors can have only 3 types of outputs depending on the key (output) element:

Relay. Everything is clear here. The relay switches the required voltage or one of the power wires. This ensures complete galvanic isolation from the sensor power circuit, which is the main advantage of such a circuit. That is, regardless of the sensor supply voltage, you can turn on/off the load with any voltage. Mainly used in large-sized sensors.

Transistor PNP. This is a PNP sensor. The output is a PNP transistor, that is, the “positive” wire is switched. The load is constantly connected to the “minus” side.

Transistor NPN.The output is an NPN transistor, that is, the “negative” or neutral wire is switched. The load is constantly connected to the “plus”.

You can clearly understand the difference by understanding the principle of operation and switching circuits of transistors. The following rule will help: Where the emitter is connected, that wire is switched. The other wire is connected to the load permanently.

Below will be given sensor connection diagrams, which will clearly show these differences.

6. Types of sensors according to output status (NC and NO)

Whatever the sensor, one of its main parameters is the electrical state of the output at the moment when the sensor is not activated (no influence is made on it).

The output at this moment can be turned on (power is supplied to the load) or turned off. Accordingly, they say - a normally closed (normally closed, NC) contact or a normally open (NO) contact. In foreign equipment - NO and NC.

That is, the main thing you need to know about transistor outputs of sensors is that there can be 4 types of them, depending on the polarity of the output transistor and the initial state of the output:

  • PNP NO
  • PNP NC
  • NPN NO
  • NPN NC

7. Positive and negative logic of work

This concept refers rather to actuators that are connected to sensors (controllers, relays).

NEGATIVE or POSITIVE logic refers to the voltage level that activates the input.

NEGATIVE logic: The controller input is activated (logic "1") when connected to GROUND. The S/S terminal of the controller (common wire for discrete inputs) must be connected to +24 VDC. Negative logic is used for NPN type sensors.

POSITIVE logic: the input is activated when connected to +24 VDC. The S/S controller terminal must be connected to GROUND. Use positive logic for PNP type sensors. Positive logic is used most often.

There are options for various devices and connecting sensors to them, ask in the comments and we’ll think about it together.

Continuation of the article -. In the second part, real diagrams are given and discussed practical use various types of sensors with transistor output.

Download instructions and manuals for some types of inductive sensors:

/ Inductive proximity sensors. Detailed description of the parameters, pdf, 135.28 kB, downloaded: 1079 times./

/ Autonics Proximity Sensor Catalog, pdf, 1.73 MB, downloaded: 540 times./

/ Catalog of Omron proximity sensors, pdf, 1.14 MB, downloaded: 667 times./

/ How can you replace TEKO sensors, pdf, 179.92 kB, downloaded: 537 times./

/ Sensors from Turck, pdf, 4.13 MB, downloaded: 462 times./

/ Scheme for connecting sensors using PNP and NPN schemes in the Splan program/ Source file., rar, 2.18 kB, downloaded: 1219 times./

Real sensors

It is problematic to buy sensors, the product is specific, and electricians almost never sell them in stores. Therefore, I give examples of real sensors that can be bought in China.

  • Induct. PNP sensor- DC power supply, 6-36V, normally open, cylindrical, diameter 12 mm, distance to object - 4 mm, output current - up to 300 mA. Great example and price.
  • Induct. PNP sensor- the sensor is approximately the same, but the price is lower, since the wholesale quantity is 10 pcs.
  • Induct. NPN sensor rectangular- this sensor is much better in mounting. In some places it is indispensable.
  • Optical sensors infrared diffuse reflection (from the object) - big choice sensors

IN Lately A large number of Arduino-based robots have appeared on the DIY electronics market. Each of them has its own advantages and disadvantages. I would like to present to your attention another new product - the “Smart ROBO” set from the company “SmartElements”.

The kit is designed in the form of a construction set designed for assembling a finished robot controlled by Arduino. The standard capabilities of the product include not only step-by-step assembly, but also perform programming to operate in various modes. The set includes step-by-step instructions in Russian, which detail the process of assembling the platform, connecting elements and installing electronic parts.

This manual also introduces the user to the types of sensors used in the robot (infrared obstacle sensors, digital line sensors, infrared receiver). It shows in detail how to test sensors for faults. In addition, by using the instructions, you will be able to understand the principle of operation of the device, learn how to connect and launch the controller, and also load the necessary sketch into it. For the convenience of users, all parts of the set are individually packaged and each of them is signed.

The robot operates in three standard modes:

  1. Movement along the line. In this mode, the robot moves along a predetermined path using two digital line sensors. Thanks to the use of such sensors, the robot easily overcomes both smooth turns and more complex sections of the route, which are, for example, shaped like a figure eight. A small test track is included in the kit.


  1. Avoiding obstacles. The platform is equipped with four infrared sensors that help detect obstacles in the robot's path. Thanks to a special movement algorithm, the robot moves unhindered and does not get stuck in corners.


  1. Remote control. The finished robot receives a command from a remote control using an infrared receiver. The device obeys commands in a similar way to a toy radio-controlled car.


The robot's device is based on high-quality sensors and a microcontroller board from Keyestudio, which is an absolute analogue of the original Arduino Uno board, not inferior to it in terms of external characteristics and technical parameters. The chassis is made on an acrylic base with four N20 electric motors equipped with gearboxes.

The important advantages of Smart ROBO, which make the set attractive compared to competitors, include:

  • The kit contains everything needed for assembly. The kit is a complete, ready-to-use device. In addition to the main basic elements, the kit includes additional elements: screwdrivers for assembling the platform and fastening elements, as well as a battery for autonomous operation of the robot;
  • Step-by-step instructions for assembly and configuration are provided. This manual allows you to go through the entire path step by step: from assembling the mechanical part of the robot to loading the finished program into the controller;
  • Three different operating modes. Each mode can be modified at its own discretion;
  • Possibility of assembly without a soldering iron. All wires are connected using quick connectors and screw terminals. That is, the user only has to connect the elements with each other;
  • Safety. The robot is powered using a regular 9-volt battery.
  • Versatility. The functionality of the robot is not limited to three standard modes. You can modify it yourself existing structure or develop something new. The mounting platforms are equipped with universal fasteners, which allows you to significantly expand or completely replace the composition of modules and sensors. The robot's capabilities depend only on your imagination.

The set will be useful not only for beginners, but also for those who have knowledge in the field of controller programming and want to expand it. The product can also play the role of a teaching guide in physics, computer science and electrical engineering lessons. If necessary, it can be used as a step-by-step guide to action in a robotics class.


You can find out more detailed information about the Smart ROBO set on the official

Sensors play one of the most important roles in robotics. Using various sensors, the robot senses the environment and can navigate in it. By analogy with a living organism, these are sensory organs. Even an ordinary homemade robot cannot fully function without the simplest sensors. In this article we will take a detailed look at all types of sensors that can be installed on a robot and the usefulness of their use.

Tactile sensors


Tactile sensors give the robot the ability to respond to contacts (forces) that arise between it and other objects in the work area. Typically, these sensors are equipped with industrial manipulators, as well as robots with medical applications. Machines equipped with tactile sensors effectively handle assembly and inspection operations, functions that require attention to detail.

When developing modern humanoid robots, manufacturers equip them with these sensors to make the machines even more “animate,” capable of perceiving information about the world around them literally by touch.

Optical sensors


When building a robot, you simply cannot do without optical sensors. With their help, the device will “see” everything around. These sensors work using a photoresistor. The reflection sensor (emitter and receiver) allows you to detect white or black areas on the surface, which allows, for example, a wheeled robot to move along a drawn line or determine the proximity of an obstacle. The light source is often an infrared LED with a lens, and the detector is a photodiode or phototransistor.

Video cameras deserve special attention. Essentially, these are robot eyes. This type of sensor is now widely used due to the growth of technology in the field of image processing. As you understand, besides robots, there are plenty of applications for video cameras: authorization systems, image recognition, motion detection in case of security activities, etc.

Sound sensors


These sensors are used for safe movement of robots in space by measuring the distance to an obstacle from several centimeters to several meters. These include a microphone (allows you to record sound, voice and noise), rangefinders, which are sensors that measure the distance to nearby objects, and other ultrasonic sensors. KM is especially widely used in almost all branches of robotics.

The operation of the ultrasonic sensor is based on the principle of echolocation. Here's how it works: the device's speaker emits an ultrasonic pulse at a certain frequency and measures the time until it returns to the microphone. Sound locators emit directional sound waves that bounce off objects, and some of that sound is returned to the sensor. In this case, the arrival time and intensity of such a return signal carry information about the distance to the nearest objects.

For autonomous underwater vehicles, underwater sonar technologies are predominantly used, while on land, sonar technologies are mainly used for collision avoidance only in the immediate vicinity, since these sensors have a limited range.


Other alternative devices to sonic locators include radars, lasers and lidars. Instead of sound, this type of rangefinder uses a laser beam reflected from an obstacle. These sensors have become more widely used in the development of autonomous cars, as they allow the vehicle to cope with traffic more efficiently.

Position sensors


This type of sensor is used mainly in self-driving vehicles, industrial robots, and devices that require self-balancing. Position sensors include GPS (global positioning system), landmarks (act as a beacon), gyroscopes (determine the angle of rotation) and accelerometers. GPS is a satellite navigation system that measures distance, time and determines the robot's location in space. GPS allows unmanned land, air and sea vehicles find your route and easily move from one point to another.

Gyroscopes are also a common thing in robotics. They are responsible for balancing and stabilizing any device. And due to the fact that this part is relatively inexpensive, it can be installed in any homemade robot.

An accelerometer is a sensor that allows a robot to measure the acceleration of a body under the influence of external forces. This device looks like a massive body, capable of moving along a certain axis and connected to the device body by springs. If such a device is pushed to the right, the load will move along the guide to the left of the center of the axis.

Tilt sensors

These sensors are used in robots where it is necessary to control the tilt, to maintain balance and to prevent the device from turning over on an uneven surface. Available with both analog and digital interfaces.

Infrared sensors


The most accessible and simplest type of sensors that are used in robots to detect proximity. The infrared sensor independently sends infrared waves and, having caught the reflected signal, determines the presence of an obstacle in front of it.

In the "beacon" mode, this sensor sends constant signals by which the robot can determine the approximate direction and distance of the beacon. This allows you to program the robot so that it always follows in the direction of this beacon. The low cost of this sensor allows it to be installed on almost all homemade robots, and thus equip them with the ability to avoid obstacles.

Temperature sensors


A temperature sensor is another useful device that is often used in modern devices. It serves for automatic temperature measurement in various environments. As in computers, in robots the device is used to control the temperature of the processor and cool it in a timely manner.

We looked at all the most basic sensors that are used in robotics and allow the robot to be more dexterous, maneuverable and productive.

Part of the robot is a circuit board, so you don’t have to worry about the robot’s wires getting caught in its wheels. Even a beginner can create such a robot if he has the right level of enthusiasm. Let's take a closer look at how you can create such a robot.

Materials and tools for manufacturing:
- Arduino platform itself;
- two motors with gearboxes;
- layout;
- transistor for controlling motors;
- medium-sized development board;
- bar small sizes for the main platform;
- IR sensor (to determine distance);
- one durable ball;
- wire;
- glue;
- wheels;
- rubber bands;
- collectors;
- ribbon;
- batteries and housing for them.


Tools you will need are a soldering iron, a hacksaw and a screwdriver.

Robot manufacturing process:

Step one. Chassis manufacturing
The chassis is installed in the place where the engines will be mounted. And the motors will be attached using glue. To attach the wheels use two corner brackets. Superglue is used to attach them, but it would be safer to fix them with bolts and nuts.
A small marble ball needs to be wrapped with wires, but it top part should be free. Two wires are soldered to the breadboard.







Step two. How to make wheels for a robot

Any children's toys of a suitable size will be suitable as wheels. If you don’t have any, you can make the wheels yourself from bottle caps by drilling holes in their center. It is important that the wheels are well centered, otherwise the robot will drive crookedly.




Step three. How the engine works
In order to control motors, the H-Bridge Motor Driver 1A chip - SN754410 is well suited. Thanks to this device, you can control two motors at once, which rotate in different directions. More details on how the motors are connected can be found in the diagram. It happens that the chips begin to heat up under heavy load; this problem is solved by installing a radiator.






Step four. Why do you need an IR sensor?
An IR sensor is needed so that the robot can detect obstacles in front of it. As soon as it occurs, the sensor immediately sends a signal. In order for the IR sensor to work at any time of the day and under any conditions, a red LED is installed on the robot. The sensor is connected to the ninth pin of the Arduino. With the help of other contacts the robot will be powered.


Step five. Robot brain design
The freeduino platform is used to control the robot; it is nothing more than a clone of the Ardunio platform. In addition, you can use a picaxe training platform or any other microcontroller. First you need to make a basic layout for the Arduino, to do this you need to draw a line across the entire breadboard. It should cover pins 8 to 13, as well as the first four pins on the bottom row.
The robot is powered by four AA batteries; they are soldered to the main board according to polarity.
The H-bridge chip has four outputs for controlling motors. It can be used to regulate the rotation speed of the motors.




Step six. Creating a layout for the robot
The layout is not mandatory when creating such a robot; it is needed only if some experiments and improvements will be constantly carried out with the robot. To create a prototype, a plastic tube is taken and glued to the robot board. On the other side there is a cardboard pad on which the Arduino is installed.


Step seven. Robot power supply
The robot works thanks to four AA batteries, thanks to which Ardunio is powered with a voltage of just over 5V. To make it easier to change batteries, they can be installed in a special holder. Such a holder can be removed from children's toys, radios and other equipment. The weight of the batteries is of strategic importance here, as it acts as a counterweight to the motors. If you use a lithium polymer battery, they may not be heavy enough. In this case, weight on the battery side will need to be added.

IR Obstacle Sensor for Robot Cars YL-63 (FC-51)
Smart Car Obstacle Avoidance Sensor Module Infrared Tube Module Reflective Photoelectric Sensor

The YL-63 non-contact sensor detects objects in a range of distances from almost zero to a set limit without coming into direct contact with them. Various manufacturers assign different names to the same device. Some call the presented sensor the name YL-63, others FC-51. The sensor is intended for use when information about the distance to an object is not required, but only about its presence or absence. The maximum detection distance depends on the setting. The YL-63 sensor has a discrete output. This optical sensor registering an increase in the intensity of reflected infrared (IR) radiation in a controlled space. Changes in reflected radiation occur due to moving parts of mechanisms or movement of surrounding objects. YL-63 can be placed on a moving object to determine its position in the surrounding space. It is used to detect obstacles when moving wheeled and tracked automatic vehicles. The sensor can become part of a visual aid for students in the field of control and automation systems.
The device contains an IR radiation source and a photodetector. The radiation is reflected from an obstacle and recorded by a photodetector. It transmits a signal to the comparator LM393, which is configured to operate at a certain level of illumination of the photodetector. The comparator generates a signal at the output of the YL-63 sensor at a low or high logic level.

The YL-63 optical sensor belongs to the diffusion class. The name of the group of sensors arose due to the underlying operation of the sensor for the reflection of radiation in many directions - the diffusion of radiation by a reflecting surface.
The operation of the device is to determine the illumination of the photodetector. Since the YL-63 detects reflected radiation, there is an error in distance measurement caused by the different reflectivity of the surfaces of objects made of various materials.

Distance coefficients for reflection from various materials.

White matte paper 1
Cotton fabric 0,6
Gray polyvinyl chloride 0,57
Tree
faintly colored 0,73
raw 0,4
Plastic
white 0,7
black 0.22
Black rubber 0,2-0,15
Brushed aluminum 1,2
Stainless steel polished 2,3

The different reflection and absorption of radiation from different materials are used to operate the tachometer sensing unit. Let's assume we have . You need to know the number of revolutions per minute of the motor shaft. YL-63 will help us out. It is enough to glue a piece of white paper to the flywheel, direct the sensor beam to the flywheel and we will get a tachometer sensing unit.
To reduce the effects of various interferences, the processing microcontroller accumulates data received from the sensor over a short period of time and performs averaging. The YL-63 sensor can operate in devices that do not have a microcontroller.

Options

Supply voltage 3.3-5 V
Detection distance to reflective white matte plane 0.02-0.3 m
Detection angle 35°
Dimensions 43 x 16 x 7 mm

Contacts

The YL-63 obstacle sensor, also known as FC-51, has a three-pin connector plug:
VCC - power supply,
GND - common wire,
OUT - output.

Indicators

There are two indicators on the module board. A green glow indicates power is on. The red LED lights up if there is an object in the detection zone.

Setting the sensing distance

Setting up the device is facilitated by the detection indicator. This allows you to configure the YL-63 aka FC-51 to operate in real conditions. Setting the sensitivity of the sensor is done using a variable resistor installed on the board. The obstacle is installed at the required distance from the sensor's photographic devices. By turning the moving contact of the variable resistor on the YL-63 module board, you set the response distance and turn on the red LED. Then the sensing distance is checked by moving a reflective object. The setting is repeated at least three times.

Program for Arduino signal processingYL-63

The sensor signal is supplied to pin 12 of the Arduino.

Void setup() (
Serial.begin(9600);
pinMode(12,INPUT);
}
void loop() (
Serial.print("Signaal: ");
Serial.println(digitalRead(12));
delay(500);
}