A robot driving around and avoiding obstacles. Number of wires to connect

Infrared receivers of the TSOP series (17xx, 21xx) have been used quite successfully in amateur robotics for a long time. They are used both for their intended purpose (to receive commands via the IR channel) and as inexpensive contactless obstacle sensors. Their advantage over conventional infrared phototransistors and photodiodes is better noise immunity, since TSOPs respond only to a signal with a certain frequency and duty cycle. The frequency of the received signal is indicated in the marking of IR receivers - the last two digits.

The undoubted advantages are also ease of connection and availability of purchase.

The presented IR sensor module is easy to replicate and essentially combines two units - a TSOP2136 with a harness and an electronic key for controlling infrared LEDs with the ability to adjust the brightness of the radiation.

The module can be used:

  • As a command receiver via IR channel using the RC5 protocol.
  • As a command transmitter via IR channel.
  • As a transceiver for exchanging information via the IR channel (both for communication with a PC and other devices)
  • As a budget contactless obstacle sensor.

The TSOP wiring is standard with the addition of a matching resistor to the signal output. The infrared LEDs are connected via a BS170 field effect transistor. The brightness of the infrared LEDs is adjusted using a building resistor.

Let's consider the operation of the module as an obstacle sensor. As mentioned above, IR receivers of the TSOP series respond only to a certain signal, in our case it is a signal with a frequency of 36kHz and a duty cycle of 50%. The signal is generated programmatically by a microcontroller. The emitted signal, reflected from the surface of the obstacle, is captured by the receiver and processed by the microcontroller. By default, in the absence of a received signal, the TSOP output is present at a high logical level, otherwise - at a low level.

Thus, in MK signal processing:

There is no obstacle - 1 at the input of the MK port.

Obstacle - 0 at the input of the MK port.

The range of reliable detection of obstacles during the experiments was achieved up to 30 cm and depends on the accurate generation of the emitted signal, the emission power of the LEDs and the surface features of the detected obstacle (color, texture, material). A light object with high reflective properties can be detected from a longer distance.

For example, we used the MRC28 controller with a universal module. Test firmware was created using BASCOM-AVR. Hand as an obstacle =).

"Example of operation of an infrared obstacle sensor based on TSOP2136

$regfile = "m8def.dat" "using Mega8
$crystal = 16000000 "quartz resonator frequency 16mHz

"Frequency generation 36kHz
"Configuring Timer1

Config Timer1= Counter, Edge = Rising , Prescale = 8 , Compare A = Toggle

" We calculate Compare1a
" clock frequency (kHz) / TSOPa frequency (kHz) / 2 = Compare
" 16000 / 36 / 2 = 222

Compare1a = 222

"PortB.1 - signal output
"PinC.0 - read the TSOPa status
"Portd.0 - signal LED

Config Pinb. 1 = Output
Config Portd. 0 = Output
Config Pinc. 0 = Input

Start Timer1
Do
If Pinc. 0 = 0 Then
Portd. 0 = 1
Else
Portd. 0 = 0
End If
Loop

End

Tags for the article:

Unlike humans, robots are not limited to only vision, hearing, touch, smell and taste. Robot sensors come in different types. Robots primarily use various electromechanical sensors to explore and understand the world and ourselves.

Reproduce the sense organs of a living being in this moment very difficult. Because of this, researchers and developers are turning to alternatives to biological senses.

What can humans feel that robots cannot feel?

With cameras, robots can “see” but have difficulty understanding what they see. The robot can receive an image from the camera consisting of millions of pixels. But without complex programming, it won't know what any of those dots represent.

Distance sensors indicate the distance to an object, but it is necessary to ensure that the robot does not crash into an obstacle or object. Researchers and companies are experimenting with different approaches to robot sensors. Additionally, sensors are being developed that allow the robot not only to “see” but to “understand” what it sees.

It may take a long time before he can distinguish objects placed in front of him on the table. Especially if they are located differently in the object database.

Robots are very bad at distinguishing between taste and smell.

A human can tell you “it tastes sweet” or “it smells bad” while a robot needs to do the analysis chemical composition. Substances then need to be searched in the database to determine what a person has labeled as tasting “sweet” or smelling “bad.”

Robotic sensors such as taste and smell sensors have received little development. Primarily because there was not much demand for a robot that can distinguish taste or smell.

Humans have many nerve endings throughout our skin, and we know when we have touched something or something has touched us. Robots are equipped with buttons or simple contacts placed strategically important places. For example, on the front bumper to determine if it comes into contact with an object.

Pet robots may have contacts or a group of sensors located on the head, legs or back, but if you try to touch an area where there is no sensor, the robot will not realize that it has been touched and will not respond. As research into humanoid robots continues, it is possible that robot sensors such as “electromechanical skin” will be developed.

What can robots feel that humans cannot?

A robot cannot tell you whether a substance tastes or smells good. Although the stages of chemical composition analysis can give him much more information than normal person may know about its properties. If the robot is equipped with a carbon monoxide sensor, then it will be able to detect carbon monoxide.

This will increase safety since carbon monoxide is colorless and odorless to humans. The robot will also be able to tell you the pH level of a substance. Therefore, it can determine whether it is acidic or alkaline, and much, much more.

People use a pair of eyes to get visual information, although many people cannot accurately determine the distance to an object. A person can tell you that the tree is about 20 meters away. At the same time, a robot equipped with distance sensors can tell you that the tree is 21.1 meters away.

In addition, robots can provide accurate readings of various environmental factors that humans are unaware of or unable to perceive.

For example, a robot can tell you what its exact angular or linear acceleration is. Although most people most people will likely detect that it is moving or turning.

A person can tell you from experience that an object is hot or cold without touching it. While a thermal imager can provide a 2D thermal image of what is in front of it. Although humans have five basic senses, robot sensors come in an almost infinite variety.

What sensors are needed for your robot?

So what types of sensors are available, and what sensors does your robot need? You must first ask yourself what purpose the robot is needed for and what it should measure. Then below you can see what types of sensors there are for robots.

There is a good chance that none of the categories listed below will suit you, so try to identify the basic elements of the robot and break the task down into its components.

Sensors for robots are:

  1. contact
  2. remote
  3. positioning
  4. responsive to environmental conditions
  5. using rotation
  6. and others

Contact sensors.

— Button/contact switch.


Switches, buttons, and contact sensors are used to detect physical contact between objects and are not limited to just people pressing buttons.

The robot's bumper can be equipped with a touch sensor or a button. Additionally, “whiskers” (like those of an animal) can be used to detect an object at various distances.

  • Advantages: very low price, easy integration, reliability.
  • Flaws: measuring distance is limited.

— Pressure measurement sensors

A button that offers one of two possible readings (ON or OFF). As a result, the robot's sensor produces an output signal that is proportional to the force applied to it.

  • Advantages: allows you to measure how much force is applied.
  • Flaws: may be inaccurate and more difficult to use than simple switches.

Remote sensors

— Ultrasonic sensors


Sensors that use ultrasonic signals to measure the time between sending a signal and returning its echo are called ultrasonic. The robot's sensors in this case are based on studies of bats, dolphins and other animals.

Ultrasonic rangefinders can measure a range of distances, but are used particularly in the air and are dependent on the reflectivity of various materials.

  • Advantages: mid-range measurement (several meters).
  • Flaws: surfaces and environmental factors may affect readings.

— Infrared sensors

Infrared can also be used to measure distance. Some infrared sensors measure one specific distance, while others provide an output signal proportional to the distance to the object.

  • Advantages: low cost, fairly reliable and accurate.
  • Flaws: more wide range than with ultrasonic sensors.

— Laser

Lasers are used when high precision is required, or long distance to the object, or when both factors are present. Scanning laser rangefinders use spin lasers (ultrafast lasers) to scan the distance to objects in two dimensions.

  • Advantages: very accurate with a very large range.
  • Flaws: much more expensive than conventional infrared or ultrasonic sensors.

— Encoders


Optical encoders often use a pair of LED photodiodes. A disk with holes is installed on the shaft, through which the signal from the LED enters the photodiode and the number of pulses is read.

A certain number of holes corresponds to the full angle traversed by the wheel. Knowing the radius of a wheel, you can determine the total distance traveled by that wheel. Two encoders give you relative distance in two dimensions.

  • Advantages: if there is no slip, then the measurement accuracy is high. Often installed on the rear shaft of the engine.
  • Flaws: Additional programming is required; more accurate optical encoders can be expensive.

— Linear potentiometer


A linear potentiometer is capable of measuring the absolute position of an object.

  • Advantages: Accurately measures absolute position.
  • Flaws: small range.

— Tension and bend sensors


A stretch gauge is made of a material whose resistance changes depending on how much it is stretched. A bend sensor is typically a sandwich of materials where the resistance of one of the layers changes depending on how much it has been bent.

They can be used to determine a small angle or rotation, such as how many fingers have been bent.

  • Advantages: useful when the axis of rotation is internal or inaccessible.
  • Flaws: low accuracy and the ability to measure only small angles.

— Stereo camera

Like human eyes, two cameras placed at a distance from each other can provide depth information (stereo vision). Robots equipped with cameras can be some of the most capable and sophisticated robots.

A camera, combined with the right software, can provide good color and object recognition.

Advantages: ability to provide detailed information and good feedback.

Disadvantages: difficulty in programming and using information.

Position sensors

— Indoor localization (room navigation)


An indoor localization system may use several beacons to triangulate (determine the relative positions of points on a surface) the robot's position in a room, while others use a camera and landmarks.

  • Advantages: Great for absolute positioning
  • Flaws: requires complex programming and the use of markers.

- GPS


GPS uses signals from multiple satellites orbiting the planet to determine their geographic coordinates.

GPS devices can provide geographic positioning with an accuracy of up to 5 meters, while more complex systems involving data processing and error correction through the use of other GPS units or IMUs can be accurate to several centimeters.

  • Advantages: does not require markers or other references.
  • Flaws: can only work in open space.

Rotation sensors

— Potentiometer


A rotary potentiometer is essentially a voltage divider and provides an analog voltage corresponding to the angle of rotation of the knob.

  • Advantages: easy to use, inexpensive, fairly accurate, provides absolute readings.
  • Flaws: most are limited to 300 degrees of rotation.

— Gyroscope


The electronic gyroscope measures the rate of angular acceleration and provides the appropriate signal (analog voltage signal, serial communication, I2C, etc.). An electronic gyroscope uses piezoelectric plates.

  • Advantages: lack of “mechanical” components.
  • Flaws: The sensor is always subject to angular acceleration, while the microcontroller cannot always accept a continuous input signal, meaning values ​​are lost, resulting in “drift” of values

— Encoders

Optical encoders use mini-infrared transmitter/receiver pairs. The number of breaks in the infrared beam corresponds to the full angle traversed by the wheel.

The mechanical encoder uses a very finely machined disk with sufficient quantity holes to read certain angles. Mechanical encoders can therefore be used for both absolute and relative rotation.

  • Advantages: accuracy.
  • Flaws: For optical encoders, the rotation angle is relative (not absolute) from the initial position.

Robot sensors that respond to environmental conditions

- Light sensor


A light sensor can be used to measure the intensity of a light source, whether natural or artificial. Typically its resistance is proportional to the light intensity.

  • Advantages: usually very inexpensive and very useful.
  • Flaws: cannot distinguish between the source or type of light.

— Sound sensor


The sound sensor is essentially a microphone that returns a voltage proportional to the level of ambient noise. More complex boards can use data from the microphone for speech recognition.

  • Advantages: cheap and reliable sensor.
  • Flaws: complex software is required to decipher important information.

— Temperature sensors


Temperature sensors can be used to measure ambient temperature or in difficult environments such as heating elements, ovens, etc.

  • Advantages: can be highly accurate.
  • Flaws: more complex and accurate sensors may be more difficult to use.

— Thermal imaging camera


An infrared or thermal imaging sensor (camera) provides a complete 2D thermal image of whatever is in front of the thermal imaging camera. In this way, the temperature of the object can be determined.

  • Advantages: It is possible to selectively measure the thermal activity of objects from a distance.
  • Flaws: high price

— Humidity measurement sensors


Humidity sensors detect the percentage of water in the air and are often paired with temperature sensors.

— Barometric pressure sensor


A pressure sensor (which can also be a barometric sensor) can be used to measure atmospheric pressure. Hence can give an idea of ​​the altitude of the UAV (unmanned aerial vehicle).

— Gas sensors

Gas sensors are used to detect the presence and concentration of various gases. However, they are needed only for specialized robotic systems.

  • Advantages: These are the only robotic sensors that can be used for accurate gas detection
  • Flaws: Inexpensive sensors may produce false alarms or are somewhat inaccurate and therefore should not be used for mission-critical applications.

— Magnetometers


Magnetometers can be used to detect magnets and magnetic fields. Can also detect polarity.

  • Advantages: Helps detect ferromagnetic metals.
  • Flaws: In some cases, the sensors may be damaged by strong magnets.

Sensors using rotation

— Compass


A digital compass is capable of using the Earth's magnetic field to determine its orientation relative to the magnetic poles. The compass tilt is compensated and takes into account the fact that the robot cannot move strictly horizontally.

  • Advantages: provides absolute navigation.
  • Flaws: higher accuracy increases the price.

— Gyroscope


Electronic gyroscopes are capable of determining the angle of inclination along one or more axes. Mechanical tilt sensors typically detect the robot's tilt using mercury in glass capsules or balls.

  • Advantages: electronic gyroscopes have more high accuracy than mechanical ones.
  • Flaws: higher cost.

— Accelerometers


Accelerometers measure linear acceleration. This allows you to measure gravitational acceleration or any other acceleration that the robot experiences.

It could be good option for approximate distance estimates if your robot cannot use the environment to refine its coordinates.

Accelerometers can measure acceleration along one, two, or three axes. A three-axis accelerometer allows you to measure all sensor angles in space.

  • Advantages: they do not require any external references or markers to function, and can provide absolute orientation with respect to the Earth's gravitational field or define relative orientation.
  • Flaws: they only estimate the distance traveled and cannot accurately determine it.

— IIB


An inertial measurement unit combines a multi-axis accelerometer with a multi-axis gyroscope and sometimes a multi-axis magnetometer to more accurately measure roll. Such robot sensors are quite complex.

  • Advantages: this is very reliable way measurements without using external references (except magnetic field Earth)
  • Flaws: can be very expensive and difficult to use.

And others


Current and voltage sensors measure the current and/or voltage of a specific electrical circuit. This can be very useful for determining how long your robot can run (measuring battery voltage) or if your motors are running too hard (measuring current).

  • Advantages: they do exactly what they are intended to do.
  • Flaws: can make changes to the measured voltage or current. Sometimes it is necessary to change the electrical circuit being measured.

— Magnetic sensors


Magnetic sensors and magnetometers are capable of detecting magnetic objects and may require contact with the object, or must be located relatively close to the object.

These robotic sensors can be used on an autonomous lawn mower to detect wires running through the lawn or to locate hidden wiring in the apartment.

  • Advantages: usually inexpensive
  • Flaws: generally must be located relatively close to the object, and unfortunately cannot detect non-magnetic metals.

— Vibration sensors


Vibration sensors are designed to detect vibration of an object using piezoelectric or other technologies.

— RFID technologies


RFID technology is a technology for wireless data exchange via a radio signal between an electronic tag that is placed on an object and a special radio-electronic device that reads the tag signal.

RFID devices can use both active (powered) and passive (unpowered) RFID tags, typically having a size and shape credit card, a small flat disk or addition to a keychain (other shapes are also possible).

When an RFID tag is within a certain distance from the RFID reader, a signal is generated with the tag's ID.

  • Advantages: RFID tags are usually very low cost and can be customized.
  • Flaws: not useful for measuring distance unless the mark is within range.

Practical part

A typical example demonstrating autonomous robot operation is a robot based on a Lego EV3 kit that moves along a line using one or two color sensors. In this case, the robot's sensors determine the brightness of the reflected light.

This article shows how to make a simple obstacle avoiding robot using Xboard v2.0. 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 geared motors direct current 200 RPM. 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 the 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. ADC converts voltage to 10 bit digital value from 0 to 1024. That is, based on the value from the ADC, you can find out about the presence of 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 electric drill, to make 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 camera mobile phone. 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 detailed 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. Given functional diagram, on which: a generator with an oscillating 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 the metal plate at which reliable operation of the sensor is guaranteed. 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 robots made on the DIY electronics market have appeared. Arduino based. 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 desired 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 external characteristics and technical parameters. The chassis is made on 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 battery life 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. Functionality The robot is not limited to three standard modes. You can modify an existing design yourself 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 step by step guide to action at the robotics club.


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 use. 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 reflection from an obstacle laser ray. 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 water vehicles to find their route and move easily 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. 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


Temperature sensor - another one useful device, which 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.

To gain experience in working with the Arduino board, so to speak, as a learning experience and just for fun, this project was created. The goal of the project was to create a car that can move autonomously, avoiding various obstacles without colliding with them.

Step 1: List of components and project cost

1. Toy car with radio control (radio controlled).

This thing costs about 20 bucks, if you have the opportunity to spend more, you can use it better.

2. Arduino Uno microcontroller - $25

3. Motor shield for controlling electric motors - $20

4. GPS for navigation. Adafruit Ultimate GPS Shield - $50

5. Magnetometer as a compass for navigation. Adafruit HMC5883 Magnetometer - $10

6. Ultrasonic distance sensor to avoid obstacles. HC-SR04 - $6

7. LCD display to display vehicle status and information. LCD Display Blue 1602 IIC, I2C TWI - $6 (you can use another one)

8. Infrared sensor and remote control.

9. Arduino sketch (C++ program).

10. Thin wood board as a mounting platform.

11. Development boards. One is long and narrow, and the other is small, in order to separately install the magnetometer on it away from other elements.

12. Jumpers.

13. Ultrasonic sensor mounting kit - $12

14. Soldering iron and solder.

So, in total, everything cost about $150, this is assuming you buy all these components, since you may already have some of these.

Step 2: Chassis and platform installation

The radio control was removed from an unwanted toy that cost 15 bucks.

The car here has two engines. Using one engine, the remote control controls the speed of the robot, and using the other, the steering is controlled.

A thin board was used as a mounting surface on which breadboards, Arduino, LCD, etc. were attached. The batteries are placed under the board and the wires are passed through the drilled holes.

Step 3: Program

Arduino is controlled via C++ program.

Source

RC_Car_Test_2014_07_20_001.ino

Step 4: LCD Display

During operation, the screen displays the following information:

Row 1:

1. TH - Task, heading to the current waypoint

2. CH - Current direction of the robot

Row 2:

3. Err - Compass direction, shows in which direction the robot is moving (left or right)

4. Dist - Focal distance (in meters) to the current waypoint

Row 3:

5. SNR - Sonar distance, that is, the distance to any objects in front of the robot

6. Spd - Robot speed

Row 4:

7. Mem - Memory (in bytes). Arduino memory has 2 KB

8. WPT n OF x - Shows where the robot is in the list of waypoints

Step 5: Avoid Colliding with Objects

To help the robot avoid obstacles, an ultrasonic “Ping” sensor was used here. It was decided to combine it with the Arduino NewPing library, since it is better than the simple PIng library.

The library was taken from here: https://github.com/fmbfla/Arduino/tree/master/NewPing

The sensor was installed on the robot's bumper.

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 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 water vehicles to find their route and move easily 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.