Phone

    00852-6915 1330

LM393 Voltage Comparator: DIY Your Line Following Car

  • Contents

Ⅰ Introduction

A line following car designed with LM393 Voltage Comparator capable of tracking on a specific runway. The line following car mainly includes a solar power supply part and a tracking control part. The control circuit part mainly includes a battery, a switch, first and second light sensitive circuits, a DC motor, a comparison circuit, and a motor drive circuit.

This blog test shows that the line following car controlled by the LM393 voltage comparator has the characteristics of high control accuracy, fast start and stop, etc., and solves the problems of the complicated control circuit structure of theline following car and the large deviation of the driving trajectory.

Catalog

Ⅰ Introduction

Ⅱ What is LM393?

Ⅲ What is A Line Following Car?

3.1 Solar Power Design

3.2 Line Following Design

Ⅳ Circuit Design of Line Following Car

Ⅴ Test

Ⅵ Conclusion

FAQ

Ordering & Quantity

Ⅱ What is LM393?

The LM393 offers exceptional value for cost-sensitive applications with a lower offset voltage, higher supply voltage capability, lower supply current, lower input bias current, shorter propagation delay, as well as improved 2 kV ESD performance and input robustness with dedicated ESD clamps.

The LM393 devices consist of two independent voltage comparators that are designed to operate from a single power supply over a wide range of voltages. The quiescent current is independent of the supply voltage, and the outputs can be connected to other open-collector outputs to achieve a wired AND relationship.

Figure 1. LM393

Figure 1. LM393

Ⅲ What is A Line Following Car?

A line following car is a car that can travel along a preset trajectory. In the process of driving the line following, how to make the car can accurately follow the trajectory without large deviations is the fundamental application of the line following car. However, the existing line following car generally uses the infrared reflection method to feed back the driving trajectory of the car, the control circuit structure is more complicated, and the infrared reflection is easily affected, so not only the cost is higher, but also the driving trajectory of the car is prone to deviation, so it often does not match the design trajectory.

Using LM393 voltage comparator as the main control chip of the tracking car will be a better way. Use the resistance change of the photoresistor under the light intensity and the LM393 voltage comparator to control the left and right driving wheels of the car to realize the tracking drive of the car, and cooperate with the display circuit to understand the status of the car. The principle block diagram of line following car based on LM393 voltage comparator is shown in Figure 3.

line following carFigure 2. Line Following Car

Ⅳ Circuit Design of Line Following Car

The circuit design of line following car based on LM393 voltage comparator mainly includes solar power supply and car tracking design.

The main components of the line following car include a battery box, a control circuit board attached to the bottom of the battery box by double-sided adhesive, and several wheel assemblies installed on both sides of the control circuit board and a solar battery panel installed above the battery box .block diagram of line following car

Figure 3. Block Diagram of Line Following Car

3.1 Solar Power Design

The line following car adopts battery power supply and storage. The solar battery board provides power for the battery, that is, the battery in the car is charged first, and only when the battery has enough power output voltage, the required voltage can be output at the output end of the battery to drive the tracing car.

The design of the power supply part mentioned in this blog uses a single lithium battery charging management chip TP4057 with an input voltage of 4V 9V (typical value 5V), which can be used to change the resistance to control the charging current, and its adjustment range is 100mm 500mA and the cut-off voltage is 4.2V.

The charging circuit has simple peripherals, no external switch tube is required, and has functions such as charging indication and full indication, anti-reverse battery positive and negative pole reverse connection protection, and power supply undervoltage protection. In addition to using solar panels to power the circuit, it can also work with USB power and adapter power.

TP4075 circuit

Figure 4. Schematic Diagram of Charging Circuit

3.2 Line Following Design

The car tracking adopts the LM393 voltage comparator as the control center of the entire tracking circuit. LM393 is a dual voltage comparator integrated circuit, which is composed of two independent precision voltage comparators. Its function is to compare two input voltages and change the level of the output voltage according to the level of the two input voltages. The schematic diagram using the LM393 voltage comparator as the tracking control circuit is shown in Figure 5.

This car chooses red LED light as its light source. When the light source shines on white objects and black objects (the predetermined trajectory of the car is black), the reflectivity is different.

The light is reflected onto the photoresistor through the ground. When the red LED light is projected on the white area and the black track line, the resistance of the photoresistor will be significantly different because of the different reflectance;

By detecting the resistance change of the photoresistor, it can be judged whether the car is driving on the black track line.

This car chooses red LED light as its light source. When the light source shines on white objects and black objects (the predetermined trajectory of the car is black), the reflectivity is different. The light is reflected onto the photoresistor through the ground. When the red LED light is projected on the white area and the black track line, the resistance of the photoresistor will be significantly different because of the different reflectance;By detecting the resistance change of the photoresistor, it can be judged whether the car is driving on the black track line.

lm393 circuit

Figure 5. Schematic Diagram of Tracing

If the resistance of the photoresistor changes, it means that the white area has been detected, and the car has deviated; at this time, the motor of the left or right wheel of the car is decelerated or even stopped to make the car return to the black track. The track car runs on a similar S-shaped route to achieve the line following function.

When there is an imbalance (for example, one wheel is pressed on the black track line), the motor on one side is stopped immediately, and the motor on the other side is accelerated to rotate, so that the car can correct the direction and return to the correct direction. The whole process is a closed loop control, so you can quickly and sensitively control the movement of the line following car.

At the same time, the photoresistor can detect the intensity of the external light. The stronger the external light is, the smaller the resistance value of the photoresistor is. The left and right wheel drive of this tracking car uses a DC motor with a reduction gear. The DC motor drives the car to slow down, otherwise the car will run too fast if the speed is too high.

Moreover, the torque is too small to run even without deceleration. The motor used in this line following car has integrated a reduction gear to greatly reduce the difficulty of production and debugging. Compared with the use of a single-chip microcomputer as the control circuit, the control circuit composed of the LM393 voltage comparator has a simpler structure, is convenient for assembly and debugging, and has a lower cost.

Ⅴ Test

First of all, place the car on the white background test field of the black track line (the black runway is the car's preset track), and turn on the switches S1, S2, solar panels (or batteries) to provide electricity, so that the voltage comparator controls the start of two DC motors to drive the wheel assemblies on both sides of the car. Our DIY line following car began to drive along the designed track (black runway)!

During the driving of the car, the light-emitting diodes D2 and D3 on the left and right sides of the car both emit red light sources. Because the light source irradiates the black runway and the white runway with different reflectivity, and the photoresistor can detect the external light intensity, the stronger the external light, the smaller the photoresistor resistance, the weaker the external light, the greater the resistance.

Therefore, when the red LED light is projected onto the black and white runway, because of the different reflectance, the resistance of the photoresistor will be significantly different.

Red LEDFigure 6. Red LED

When the light source is reflected by the runway to the photoresistors R14 and R15, the comparator can determine whether the car is driving on the black track line or the white area according to the changes in the resistance of the photoresistors on both sides. And through the diodes and photoresistors on the left and right sides, we can also determine which side the car is deflecting at this time.

When an imbalance occurs (for example, the side of the car is pressed against the white area), the DC motor on one side is immediately stopped, and the DC motor on the other side is accelerated to rotate, so that the car can correct the driving direction and return to the correct driving direction (black track on-line.

Actually, we can see that the left and right driving wheels of the car rotate in turn and stop driving the car forward; there is a process of deviation, correction, deviation, and correction; but it always advances along the established black trajectory.

Ⅵ Conclusion

The solar tracking car discussed in this blog:

  1. Passed the test and successfully realized the car's line following;
  2. Can be powered by solar energy or battery;
  3. Strong stability and anti-interference ability, high control accuracy, fast start and stop;
  4. Solved the problems of complicated control circuit of line following car and large deviation of driving trajectory.

Using only the LM393 voltage comparator as the controller circuit allows us to assemble and debug conveniently and at a lower cost. The use of non-single chip control is a feature of this line following car.

lm393

Figure 7. LM393

In summary, the line following car based on LM393 control is suitable for technological innovation and technology promotion.


FAQ

What is LM393 used for?

The LM393 series are dual independent precision voltage comparators capable of single or split supply operation. These devices are designed to permit a common mode range−to−ground level with single supply operation.

 

How does LM393 comparator work?

The LM393 is a dual differential comparator; this means that it accepts 2 inputs for comparison. It compares these voltage inputs and determines which is the larger value. Based on this, electronic decisions can be made based on which input is greater and which is smaller.

 

What is the control circuit part of the line following car?

A DC motor

 

What is the purpose of the LM393 devices?

Wired AND relationship

 

What is a line following car?

A car that can travel along a preset trajectory

 

 

After reading the blog, have you better understand LM393? 

Finally, if you have any questions about LM393, please do not hesitate to leave a message in the comment section below!

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.