Share this

Design of a Bus Passenger Counting System Based on Infrared Technology

2026-04-06 02:55:40 · · #1

introduction

With societal development, urban public transportation plays an increasingly important role. How to rationally and effectively schedule bus trips and formulate bus operation plans is a top priority for every bus company. Passenger volume is the foundation for all operational plans formulated by bus companies. However, previous passenger volume statistics were limited to manual recording and automatic card reader data, resulting in significant discrepancies between recorded and actual data, which greatly impacted the formulation of vehicle operation plans. A bus passenger volume counting system based on infrared technology can operate 24/7, reliably recording passenger volume and thus avoiding the aforementioned human and card reader errors.

Functions of vehicle passenger counting system

To effectively record the actual passenger flow at each stop on bus routes and provide bus companies with a basis for reasonable vehicle scheduling planning, the bus passenger volume statistics system has the following functions:

1) People collection and statistics function

The system can accurately record the number of people getting on and off the bus at each stop.

2) Data storage function

Each bus stop and its passenger flow are recorded and stored one-to-one, so that bus company staff can analyze the passenger flow at each stop and formulate appropriate operation plans.

3) Data transmission function

The onboard passenger counting system can transmit passenger flow data from each bus stop to a computer via wired or wireless means.

System hardware design

The system uses the MSP430F149 microcontroller as its core controller and integrates an infrared transmitting module, an infrared receiving module, a serial memory module, an RS232 interface module, and a power management module. The system block diagram is shown in Figure 1.

Figure 1 System Block Diagram

Fig.1 System diagram

2.1 Microcontroller Unit

The system uses the TI MSP430F149 microcontroller as its core controller. This microcontroller features a 16-bit integrated CPU register and a constant generator, maximizing code efficiency; integrated JTAG for in-system programming; two general-purpose full-duplex serial synchronous/asynchronous communication interfaces; PWM control output; and an external interrupt input interface. The microcontroller is responsible for sampling bus door opening and closing signals, turning the infrared counting module on or off, recording the number of passengers boarding and alighting at each bus stop, storing the passenger data, and transmitting the stored data to the computer.

2.2 Infrared Emitting Module

The infrared emitting diode LF5038 is used as the infrared signal emitting device in the emitting module. Its electrical parameters are as follows: peak wavelength is 940nm; forward operating voltage VF is 1.2V; and forward drive current IF is 100mA at its maximum value. Generally speaking, the larger the IF, the farther the transmission distance.

Since the infrared receiving module can receive a carrier frequency of 38kHz, the infrared transmitting module needs to transmit a signal with a carrier frequency of 38kHz [1]. The microcontroller MSP430F149 contains PWM output control, which makes it easy to set the carrier signal. The output driving capability of the microcontroller pins is limited. In order to increase the transmission distance of the transmitting module, an external transistor driving circuit is used to increase the forward current IF of the transmitting module, thereby increasing the transmission distance of the transmitting module [2]. The infrared transmitting driving circuit is shown in Figure 2a.

2.3 Infrared Receiver Module

The infrared receiver module uses LF0038F, whose performance parameters are as follows: the typical value of the receivable carrier frequency is 38kHz; when the forward current of the infrared transmitter module is 300mA, the minimum receiving distance of LF0038F is 15m; the typical value of the receiving angle is ±45°.

The infrared receiver module has strict requirements for the power supply. To prevent the occurrence of erroneous output signals, its input power supply is subjected to multi-level anti-interference and filtering processing. The circuit diagram of the infrared receiver module is shown in Figure 2b.

Figure 2 Schematic diagram of infrared transmitter and receiver module

Fig.2Infraredtransmitandreceivemoduleprinciplediagram

The microcontroller's PWM output drives the infrared transmitting module to emit a 38kHz pulse signal. When the LF0038F receives a valid signal, its OUT terminal outputs a low-level signal; when the LF0038F does not receive a valid signal, its OUT terminal outputs a high-level signal. During this transition from low to high level, a rising edge signal is generated. The waveform of the LF0038F output signal is shown in Figure 3a.

Figure 3 Signal waveform diagram

Fig. 3 Signal waveform figure

System software design

3.1 Data Transmission Program Design

The system can store the number of passengers boarding and alighting at each station and transmit this data to a host computer via wired or wireless means. Wired transmission uses an RS232 interface circuit, while wireless transmission uses infrared communication. Since RS232 communication technology is mature and easy to implement, it will not be discussed further here; the focus will be on detailing the infrared communication method for data transmission.

The difficulty and key point of infrared communication lies in defining the encoding format of the infrared signal. The encoding format defined in the system is as follows: the system uses two periodic formats, 1.125ms and 2.25ms. A binary "0" is represented by a pulse width of 560µs, an interval of 565µs, and a period of 1.125ms; a binary "1" is represented by a pulse width of 560µs, an interval of 1685µs, and a period of 2.25ms. The signal periodic waveform is shown in Figure 3b.

The infrared data encoding consists of nine parts: a preamble, a vehicle identification original code, a vehicle identification inverse code, a station original code, a station inverse code, a passenger boarding original code, a passenger boarding inverse code, a passenger alighting original code, and a passenger alighting inverse code, totaling 74 bits of data. The preamble consists of a 9ms low-level pulse and a 4.5ms high-level pulse. The vehicle identification code consists of 13 bits of original code data and 13 bits of inverse code data. The station code consists of 8 bits of original code and 8 bits of inverse code. The passenger boarding code consists of 8 bits of original code and 8 bits of inverse code. The passenger alighting code consists of 8 bits of original code and 8 bits of inverse code. To prevent errors during communication, each inverse code is used to verify the correctness of the previously received original code data. The infrared data encoding structure is shown in Table 1. The data transmission encoding diagram is shown in Figure 3c.

Table 1 Infrared Data Encoding Structure

Tab.1Infrareddatacodingstructuresheet

Guide code

Vehicle identification source code

Vehicle identification reverse code

9ms low level, 4.5ms high level

1111110000001

0000001111110

Site source code

Site Inverse Code

Passenger count source code

Upload number reverse code

Original number of dropped off passengers

The number of drop-off passengers is reversed

00000001

11111110

00001111

11110000

00000111

11111000

When data recorded by the vehicle-mounted system needs to be transmitted to the host computer, the operator presses the data transmission control button. The system then enters the data transmission program, which controls the infrared transmitting module to output the corresponding data signal according to the data encoding format. After receiving the data, the host computer determines whether the data is valid and then sends a valid or invalid response back to the vehicle-mounted system via the infrared transmitting module. After the data transmission is complete, the vehicle-mounted system automatically enters standby mode, waiting for the start of new data recording. The data transmission flowchart is shown in Figure 4a.

3.2 Main Program Functions

The main program is responsible for initialization, enabling interrupts, detecting door opening and closing, and guiding the system to enter various corresponding working states. The flowchart of the main program is shown in Figure 4b.

3.3 Procedure for counting passengers getting on and off the bus

When the bus arrives at the station, the system detects the door opening signal and the program starts PWM output to drive the infrared module to emit a pulse signal with a frequency of 38kHz. The LF0038F receives the signal and outputs a low-level signal at the OUT terminal. When passengers get on or off the bus, the pulse signal emitted by the infrared module is blocked by the human body [3]. The receiving module has no signal input, and the output signal of the LF0038F changes from low level to high level. The rising edge triggers the microcontroller interrupt, and the program enters the passenger getting on and off detection and judgment. When the microcontroller confirms that there are passengers getting on or off the bus after processing by the program, the system records the corresponding number of passengers getting on and off the bus. When the system detects that the door is closed and the bus is leaving the station, it saves the corresponding station number and the number of passengers getting on and off at that station, and clears the corresponding register. The passenger flow statistics program is shown in Figure 4c.

Figure 4 Program Flowchart

Fig. 4 Program Flow Diagram

in conclusion

Infrared technology is a new and rapidly developing discipline, giving rise to a wide variety of infrared devices with applications spanning civilian and military sectors. The system's hardware and software both employ a modular design, facilitating upgrades and maintenance. After online testing, the collected data has proven accurate and reliable, providing firsthand information for bus company vehicle dispatching and scheduling. This system avoids the significant errors inherent in traditional manual recording, demonstrating its promising potential for widespread adoption.

Read next

CATDOLL 146CM Miho TPE (Customer Photos)

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22