Vehicle Tracking System using GPS – Circuit Diagram

Electronic Circuits and Components

Fig. 2 shows the circuit of a GSM and GPS-based vehicle tracking system. It consists of a microcontroller, GPS module, GSM modem, and 9V DC power supply. GPS module gets the location information from satellites in the form of latitude and longitude.
The microcontroller processes this information and sends it to the GSM modem. The GSM modem then sends the information to the owner’s mobile phone.

Source Code/Program & Testing

The best part about the L86 GPS/GNSS Module is, it supports Tiny GPS++ Library. Download the library and add it to the library folder. You also need SSD1306 OLED Library for this project. Now copy the following code and upload it to the ESP32 Board.

Analog signals

Analogue inputs are used in control systems with input sensors that produce a voltage, current or resistance change in response to an environmental variation or system measurement and instead of only reading the values of 1 and 0 (on and off),
it can read values in between.The signals from sensors that measure surrounding natural factors such as temperature, pressure, and flow rate are often analog signals, and most control actuators move according to analog signals.
On the other hand, only digital signals can be handled by computers. For this reason, in order to input a signal from a sensor using a computer, or to output a signal to an actuator, it's necessary to have a device that can bridge the analog signal
and the digital signal handled by the computer. That bridge is called an analog I/O interface.
A potentiometer is the perfect analogue device for this activity.Once the potentiometeris turned on the maximum and minimum values are approximately between 0 and 65025.These values are used to control the duty cycle for PWM on the LED.

PIR

A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. They are most often used in PIR-based motion detectors. PIR sensors are commonly used in security
alarms and automatic lighting applications. It can detect changes in the amount of infrared radiation impinging upon it, which varies depending on the temperature and surface characteristics of the objects in front of the sensor.
When an object, such as a person, passes in front of the background, such as a wall, the temperature at that point in the sensor's field of view will rise from room temperature to body temperature, and then back again. The sensor converts the resulting
change in the incoming infrared radiation into a change in the output voltage, and this triggers the detection. Objects of similar temperature but different surface characteristics may also have a different infrared emission pattern, and thus moving them
with respect to the background may trigger the detector as well.
You can detect motion with the PIR using the code below:

Ultrasonic Sensor

An ultrasonic distance sensor sends out pulses of ultrasound which are inaudible to humans, and detects the echo that is sent back when the sound bounces off a nearby object. It then uses the speed of sound to calculate the distance from the object.
Ultrasonic transducer is energized by high voltage pulses and starts to emit an ultrasonic signal. The ultrasonic signal is reflected by the target towards the sensor.Trigger circuit measures the time between the emission and the detection of the signal.
Since the speed of the ultrasonic beam in air is known, it is easy to have not only an indication of the presence of the target, but also a measure of the distance between sensor and target.

Ultrasonic Sensor Working Principle

Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at the velocity of sound. If they strike an object, then they reflected back as an echo signals to the sensor, which itself computes the distance
to the target based on the time-span between emitting the signal and receiving the echo. An ultrasonic sensors are excellent at suppressing background interference. Virtually all materials which reflect sound can be detected, regardless of their colour.
Even transparent materials or thin foils represent no problem for an ultrasonic sensor. microsonic ultrasonic sensors are suitable for target distances from 20 mm to 10 m and as they measure the time of flight they can ascertain a measurement with pinpoint accuracy.
If you need to measure the specific distance from your sensor, this can be calculated based on this formula: We know that, Distance= Speed* Time.
The speed of sound waves is 343 m/s. So, Total Distance= (343 * Time of hight(Echo) pulse)/2 Total distance is divided by 2 because signal travels from HC-SR04 to object and returns to the module HC-SR-04. Use the following code to read the Distance