Introduction: Crowded Bus Counter

About: Technomentis is a venture to foster innovation and hands on learning for youngsters at formative ages. We explore, create, design, tinker and innovate at Explorato - our makers space.

Overloading of the transport buses cause a lot of risk to the on board passengers as well as the road users. One solution to the overloading issue is to simply limit the number of on board passengers. In this project, the number of passengers boarding and leaving the buses are counted using IR sensors. As soon as the counter reaches the set maximum limit, then the door will automatically close. Then, the door will only open if a person wants to disembark the bus. If anyone is standing near the door for too long, then a buzzer will start buzzing, so that the person is notified to stay away from the door. The number of remaining seats are displayed outside on a 16x2 LCD Display. Also, there is one RGB LED which shows green light when there are seats available and shows red light when there is no seat available.

Step 1: Components Required

  1. Arduino UNO Board x 1
  2. USBcable x 1
  3. IR Sensors x 2
  4. 16x2 LCD x 1
  5. 180 degrees Servo motor x 1
  6. Buzzer z 1
  7. 10KΩ Potentiometer x 1
  8. RGB LED x 1
  9. 470Ω Resistor x 2
  10. Breadboard x 1
  11. Connecting Wires (Male to Male) x 40
  12. Connecting Wires (Male to Female) x 40

Step 2: Interfacing Infrared Sensor With Arduino

Infrared Sensor:

An infrared Sensor has two IR LED’s. One is IR Transmitter and the other one is IR Receiver. IR Transmitter transmits the IR rays. If there is some object in front of it, then the IR Rays are reflected from the object and is received by the IR Receiver. If there is black object or no object in front of it, then no rays will be reflected. As black colour absorbs light, the IR Rays are absorbed by the Black colour.

The IR Sensor can be directly connected to the Arduino UNO Board using Male to Female Connecting wire. There are 3 pins in an IR Sensor.

Note: We will be using Multiple IR Sensors in our Project. That is why we are connecting the GND And VCC Pins of the IR Sensor via Breadboard.

VCC – It is connected to the 5V Pin of the Arduino

GND – It is connected to the GND Pin of the Arduino

OUT – It is connected to any digital Pin. The input will be taken using this Pin.

Circuit Connections:

  1. Take one Male to Female connecting wire and connect the female header of the wire to the male VCC Pin of the IR Sensor.
  2. Connect the male end of the connecting wire on the Breadboard.
  3. Take one Male to Male wire and connect one male end of the wire on the Breadboard where the VCC is connected and other terminal to the 5V pin of the Arduino Board.
  4. Take another Male to Female Connecting wire and connect the Female Header of the wire to the male GND Pin of the IR Sensor.
  5. Connect the male end of the Connecting wire on the Breadboard.
  6. Take one Male to Male wire and connect one male end of the wire on the Breadboard where the GND is connected and other terminal to the GND pin of the Arduino Board.
  7. Take another Female to Male wire and connect the OUT Pin of the IR Sensor to Digital Pin 10 of the Arduino Board.(This IR sensor should be placed inside the bus)

Step 3: Connect One More Infrared Sensor

Circuit Connections:

The VCC And GND of both the IR Sensors will be connected to the Arduino Board via Breadboard.

  1. Connect the VCC pin of the IR Sensor to the 5v Pin of the Arduino using Breadboard.
  2. Connect the GND pin of the IR Sensor to the GND Pin of the Arduino using Breadboard.
  3. Connect the OUT Pin of the IR Sensor tot he digital pin 11 of the Arduino.(This IR sensor is placed outside the bus)

Step 4: Connecting LCD With Arduino

LCD

The LCD is expanded as Liquid Crystal Display. The module used in this project is a monotone display. It has two rows and 16 columns. Hence, total of 32 characters can be displayed at a time. The contrast of the display is controlled by the 10K Ω potentiometer. The display also possess a backlight feature.

Note: If your LCD does not have Male Header pins connected to it, then Solder some header pins to the LCD carefully.

Circuit Connections:

  1. Connect an M-F jumper wires from all the pins of LCD module to the breadboard.
  2. Connect an M-M jumper wire from 5V pin of the Arduino to one of the horizontal lines of the breadboard.(Henceforth referred as 5V line)
  3. Connect an M-M jumper wire from GND pin of the Arduino to another horizontal line of the breadboard.(Henceforth referred as GND line)
  4. Connect an M-M jumper wire from the GND pin of the LCD to the GND line of the breadboard.
  5. Connect an M-M jumper wire from the VCC pin of the LCD to the 5V line of the breadboard.
  6. Place the 10K ohms potentiometer on the breadboard.
  7. Connect an M-M jumper wire from the CONTRAST pin of the LCD to the wiper pin of the potentiometer.
  8. Connect an M-M jumper wire from one pin of the potentiometer to the GND line.
  9. Connect an M-M jumper wire from the last pin of the potentiometer to the 5V line.
  10. Connect an M-M jumper wire from the RS pin of the LCD to Pin 7 of the Arduino.
  11. Connect an M-M jumper wire from the RW pin of the LCD to GND pin of the LCD.
  12. Connect an M-M jumper wire from the EN pin of the LCD to Pin 6 of the Arduino.
  13. Connect an M-M jumper wire from the D4 pin of the LCD to Pin 5 of the Arduino.
  14. Connect an M-M jumper wire from the D5 pin of the LCD to Pin 4 of the Arduino.
  15. Connect an M-M jumper wire from the D6 pin of the LCD to Pin 3 of the Arduino.
  16. Connect an M-M jumper wire from the D7 pin of the LCD to Pin 2 of the Arduino.
  17. Place the 220 ohm resistor on the breadboard such that one pin is connected to BACKLIGHT(+) pin of the LCD and the other end is connected to the 5V line.
  18. Connect an M-M jumper wire from the BACKLIGHT(-) pin of the LCD to the GND line (or to the GND line in which one pin of potentiometer is connected ).

Step 5: Connecting RGB LED With Arduino

There are two types of RGB LED.

1. Common Anode RGB LED: All the anodes are tied together

2. Common Cathode RGB LED:All the cathodes are tied together.

The one that we are using is the common Cathode RGB LED. It means that the Negative terminal of all the LED’s is common. The longest Leg of the RGB LED is the negative terminal.

Circuit Connections:

  1. Take one 470Ω resistor and place it on the Breadboard.
  2. The Negative Terminal of the LED i.e. the longest leg of the LED will be connected to 470Ω Resistor which is placed on the Breadboard.
  3. The other terminal of the resistor will go to the GND Pin of the Arduino Board.
  4. The red colour terminal of the LED i.e. the left most terminal will be connected to Analog IN Pin A5 of the Arduino Board using Male to Female Connecting Wire.
  5. The green colour terminal of the LED i.e. the one on the right side of negative terminal will be connected to Analog IN Pin A4 of the Arduino Board using Male to Female connecting Wire.
  6. The blue colour terminal of the LED i.e. the right most terminal will be connected to Analog IN Pin A3 of the Arduino Board using Male to Female connecting Wire.

Step 6: Interfacing Servo Motor With Arduino

Servo Motor:

A servo motor is a rotary actuator that allows for precise control of angular position. It consists of a motor coupled to a sensor for position feedback. By varying the pulse width of the output voltage to a servo, you can move a servo to a specific position.

Circuit Connection:

  1. Connect the signal wire (orange) of the Servo Motor to Digital PWM Pin 10.
  2. Connect the ground wire (brown) of the Servo Motor to GND of the Arduino.
  3. Connect the VCC wire (red ) of the Servo Motor to the 5V pin of the Arduino.

The connections of the Servo Motor will be done using Male to Male connecting wire.

Step 7: Interfacing Buzzer With Arduino

Buzzer:

For interfacing buzzer with Arduino, we will use something known as tone(). The tone function generates a square wave of the specified frequency on a pin during the time of duration field (optional).

The syntax of tone function is: tone (pin, frequency, duration);

The parameters are:

1. pin: the pin on which to generate the tone

2. frequency: the frequency of the tone in hertz - unsigned int

3. duration: the duration of the tone in milliseconds (optional) - unsigned long

Circuit Connections:

  1. Connect the negative terminal of the buzzer to the GND Pin of the Arduino Board using breadboard.
  2. Connect the Positive terminal of the buzzer to the PWM Pin 9 of the Arduino Board.

Step 8: Upload the Arduino Sketch

Step 9: Reference Images for Construction