Smart 4 Way Traffic Signal Control with Variable Delay

Hello guys! I hope you’re all in a good mood today because we are going to review the design of an interesting project today. We’ll be looking to design 4-way traffic lights in such a way that their delay is variable and is dependent upon the traffic density. This project is of intermediate difficulty level for people studying in undergrad engineering school with electronics, electrical and mechatronics as their major. It is also for the people learning Arduino and basic circuit design on their own or through some course. We have already designed a Simple 4-Way Traffic Light Control using Arduino and today we will make it smart by adding a variable delay.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LEDsAmazonBuy Now
2ResistorAmazonBuy Now
3LCD 16x2AmazonBuy Now
4Arduino Mega 2560AmazonBuy Now

Variable 4 Way Traffic Light:

As you all already know the importance of traffic lights and their usage has solved a number of traffic problems, traffic is becoming denser on each road in the whole world by the hour. This leads us to consider traffic density at such roads as well. A number of different solutions have been developed in recent times to help with this problem such as roundabouts. This is done so to ensure the safety of vehicles on road and of people walking on pedestrian walks. With the world going towards automation and autonomous systems, this is the right time to switch traffic lights to an autonomous traffic light system too and make the system intelligent.

Software to Install:

We will be going through how to make an autonomous traffic system by using Arduino as a microcontroller. However, we’re not making an actual system rather we will be making a simulation of the said traffic system on a circuit simulating software Proteus. So make sure you already have the latest version of Proteus installed on your PCs and laptops. If not, you should first install the Proteus Software by following the embedded link. Proteus is open database software, meaning people can easily make their own circuit simulating libraries for the software and can easily integrate those libraries. This helps in making the software versatile and easy to use. You can easily add your own components or download libraries of components and place them within the software.

To start working with this project, you need to install and include the following libraries on your Proteus software:

  • Arduino Library for Proteus: This library includes all the microcontroller-based programming boards made by the company Arduino.cc. This allows you to program on the Arduino software and after that, you can see the implementation of this code in Proteus simulation.
  • LCD Library for Proteus: LCDs are displays that can be used to display text or values being used in a certain code. These LCDs come in two sizes, namely a 16x2 and 24x4. LCDs are controlled by the Arduino board.
  • Ultrasonic Sensor Library for Proteus: Since we are using an ultrasonic sensor as well in this project for which Proteus does not have a built-in component, you would need to download its library as well.

Project Overview:

This is a smart 4-way traffic light system. The pedestrian lights work such that whenever a certain traffic light is green its opposite pedestrian lights turn on. An addition of ultrasonic sensors have been made in the traffic light sequence. One ultrasonic sensor is placed at each traffic light. Each ultrasonic sensor controls the time of their respective green traffic light. When the ultrasonic sensor output is high, the traffic light opens for one second, when the ultrasonic sensor output is intermediate the traffic light opens for two seconds and when the ultrasonic sensor output is low the traffic lights open for 3 seconds.

The main components and their use in this project is given below:

  • Arduino Mega: We have used Arduino mega in this project and recommend using an Arduino mega as well. This is because there are about 40 digital pins required to perform communication between the microcontroller and only an Arduino Mega fulfills that requirement.
  • Traffic Light Module: Proteus provides an in-built module for simulating traffic lights and we will use this instead of using RGB lights to create a better effect.
  • Ultrasonic Module: This module is not built-in, but information to integrate this module with Proteus has been given above. This module has a test pin in order to simulate it and works just like real life.
  • LCD: Liquid crystal display will be used to show the time in which the traffic light remains on.

Components Needed:

  • Arduino Mega
  • Traffic Lights
  • Green and Red LEDs
  • Variable resistors
  • LCD
  • Ultrasonic Sensor

Component Details:

We will go through the details of some of the important components being used in this project.

Arduino Mega:

Arduino is an open-source programmable board that serves as a microcontroller and processes information based upon inputs and gives information to actuators in terms of output. Arduino Mega is based upon the chip ATmegaGA2560 and has 53 digital I/O pins.

Figure 1: Arduino Mega

LCD:

Liquid Crystal Displays used in electronics are of two basic sizes, 16x2 and 24x2. These represent the number of columns and rows of the LCD. Each pixel can store one character in it. It is also known as a character LCD. It comes equipped with a backlight. The intensity or glow of the backlight can be controlled by attaching a potentiometer at specified pins.

Figure 2: LCD display

Ultrasonic Sensor:

An ultrasonic sensor uses SONAR technology to identify objects. It is basically used to find the distance of objects from the sensor. The ultrasonic sensor works by sending out ultrasonic waves and when these waves or parts of waves hit an object, they are reflected backward and the time from their propagation to their return is then noted. This time is then converted into the distance because we already know the speed by which those waves are traveling.

Figure 3: Ultrasonic Sensor

Proteus Simulation of Variable Traffic Lights:

In order to simulate this project on Proteus software, we will first make the circuit diagram on Proteus. After that, we will write our code on Arduino IDE software and integrate it with the circuit made in Proteus.

Open Proteus and open a new project. Import the following components in your Proteus worksheet.

Figure 4: List of components

Place the component in your worksheet as illustrated in the figure below:

Figure 5: Placement of components

After placing the components, make the connections as follows:

  • Connect 0,1 and 2 digital pins of Arduino to red, yellow and green of traffic light 1 respectively.
  • Connect 3,4 and 5 digital pins of Arduino to red, yellow and green of traffic light 2 respectively.
  • Connect 6,7 and 8 digital pins of Arduino to red, yellow and green of traffic light 3 respectively.
  • Connect 9,10 and 11 digital pins of Arduino to red, yellow and green of traffic light 4 respectively.
  • Connect 12and 13 digital pins of Arduino to red and green LEDs of pedestrian light 1 respectively.
  • Connect 14 and 15 digital pins of Arduino to red and green LEDs of pedestrian light 2 respectively.
  • Connect 16 and 17 digital pins of Arduino to red and green LEDs of pedestrian light 3 respectively.
  • Connect 18 and 19 digital pins of Arduino to red and green LEDs of pedestrian light 4 respectively.
  • Ground the negative terminals of all LEDs.
  • Connect one end of a variable resistor to the Vss pin of LCD.
  • Connect the other end of the variable resistor to the input.
  • Connect the input pin of the variable resistor with the Vee pin of LCD.
  • Ground the RW pin of LCD.
  • Connect RS pin of LCD to 22 digital pin of Arduino.
  • Connect E pin of LCD to 23 digital pin of Arduino.
  • Connect D4, D5, D6 and D7 pin of LCD to 24, 25, 26 and 27 digital pins of LCD respectively.
  • Connect the test pin of ultrasonic sensors to their respective potentiometers.
  • Connect the trigger pin and echo pin of the ultrasonic sensor of traffic light 1 to 28 and 29 digital pins of Arduino respectively.
  • Connect the trigger pin and echo pin of the ultrasonic sensor of traffic light 2 to 30 and 31 digital pins of Arduino respectively.
  • Connect the trigger pin and echo pin of the ultrasonic sensor of traffic light 3 to 32 and 33 digital pins of Arduino respectively.
  • Connect the trigger pin and echo pin of the ultrasonic sensor of traffic light 4 to 34 and 35 digital pins of Arduino respectively.

With this, your circuit connections are complete and we will now move on to the firmware setup of this circuit.

Arduino Code:

We have divided the Arduino code in 3 segments:

  • Declaration Code
  • Void setup
  • Void loop

We will look at these sections separately now.

Declaration Code:

The first step in the code is the declaration of variables that we will utilize in our program. At first is the declaration of ultrasonic sensor pins and setting them up with their respective pins of Arduino board. The syntax of this code is as follows.

Figure 6: Ultrasonic declaration code

Now we will include the library of LCD into our Arduino program, you can download this library from within the software. After that we will declare the LCD by defining the LCD pins. The syntax for which is as follows:

Figure 7: LCD declaration

In the next step, we will declare traffic light variables and define their Arduino pins.

Figure 8: Traffic light variable declaration

Now, we will declare the variables of pedestrian LEDs and then allot them their Arduino pins being used in the circuit.

Figure 9: Declaration of pedestrian LEDs

Now, there are two variables being used for each ultrasonic sensor for the calculation of their distance and time duration. We will declare those variables now.

Figure 10: Declaration of variables being used for calculations

Void Setup:

Void setup is the part of Arduino program that only runs once, in this section the program that only needs to run once is put, such as declaring pins as output pins or input pins.

Only the echo pins of ultrasonic sensor are input pins while all other pins are going to be output pins for this project.

We will first set up ultrasonic pins as follows:

Figure 11: Defining Ultrasonic pins as I/O for the Arduino Board

Now we will declare traffic light pins as output pins. The syntax for this is given as follows:

Figure 12: Setup of Traffic light Pins as Output

Now we will setup our pedestrian LEDs.

Figure 13: Setup of Pedestrian LEDs as Output

Now we will initialize our LCD, this basically tells the microcontroller to start the LCD and give power to it. The syntax is given below.

Figure 14: Initializing LCD

Void Loop:

This part of Arduino Program runs in a loop and consists of the main code of the program in which all the calculations are being done.

In the first part of the program, we will set the trigger pin of the first ultrasonic sensor to low and high. This would generate a pulse and send out a wave. After that we will read a pulse input from the echo pin. This will give us the duration in which the wave was propagated and returned. After that we will calculate the distance from the duration of the wave.

Figure 15: Syntax of 1st Ultrasonic Sensor

This distance calculation is for our first traffic light. Now we will use the if loop to check our distance value.

Figure 16: If Loop for Signal 1

If the value falls between our set limit for the loop, the signal will turn green for three seconds. This will also be displayed on the LCD.

Figure 17: Arduino Code

After that in our if loop, the yellow lights 1 and 2 will turn on to indicate transition.

Figure 18: Arduino Code

Now we will use the if loop to check our distance value.

If the value falls between our set limit for the loop of intermediate traffic, the signal will turn green for two seconds. This will also be displayed on the LCD.

Figure 19: Arduino Code

After that in our if loop, the yellow lights 1 and 2 will turn on to indicate transition.

Figure 20: Arduino Code

Now we will use the if loop to check our distance value again.

If the value falls between our set limit for the loop of low traffic, the signal will turn green for one second. This will also be displayed on the LCD.

Figure 21: Arduino Code

After that in our if loop, the yellow lights 1 and 2 will turn on to indicate transition.

Figure 22: Arduino Code

Now we will set the trigger pin of the second ultrasonic sensor to low and high. This would generate a pulse and send out a wave. After that we will read a pulse input from the echo pin. This will give us the duration in which the wave was propagated and returned. After that we will calculate the distance from the duration of the wave.

Figure 23: Arduino Code

This distance calculation is for our Second traffic light. Now we will use the if loop to check our distance value.

Figure 24: Arduino Code

If the value falls between our set limit for the loop, the signal will turn green for three seconds. This will also be displayed on the LCD.

Figure 25: Arduino Code

After that in our if loop, the yellow lights 2 and 3 will turn on to indicate transition.

Figure 26: Arduino Code

Now we will use the if loop to check our distance value.

If the value falls between our set limit for the loop of intermediate traffic, the signal will turn green for two seconds. This will also be displayed on the LCD.

Figure 27: Arduino Code

After that in our if loop, the yellow lights 2 and 3 will turn on to indicate transition.

Figure 28: Arduino Code

Now we will use the if loop to check our distance value again.

If the value falls between our set limit for the loop of low traffic, the signal will turn green for one second. This will also be displayed on the LCD.

Figure 29: Arduino Code

After that in our if loop, the yellow lights 2 and 3 will turn on to indicate transition.

Figure 30: Arduino Code

Now we will set the trigger pin of the third ultrasonic sensor to low and high. This would generate a pulse and send out a wave. After that, we will read a pulse input from the echo pin. This will give us the duration in which the wave was propagated and returned. After that we will calculate the distance from the duration of the wave.

Figure 31: Arduino Code

This distance calculation is for our third traffic light. Now we will use the if loop to check our distance value.

Figure 32: Arduino Code

If the value falls between our set limit for the loop, the signal will turn green for three seconds. This will also be displayed on the LCD.

Figure 33: Arduino Code

After that in our if loop, the yellow lights 3 and 4 will turn on to indicate transition.

Figure 34: Arduino Code

Now we will use the if loop to check our distance value.

If the value falls between our set limit for the loop of intermediate traffic, the signal will turn green for two seconds. This will also be displayed on the LCD.

Figure 35: Arduino Code

After that in our if loop, the yellow lights 3 and 4 will turn on to indicate transition.

Figure 36: Arduino Code

Now we will use the if loop to check our distance value again.

If the value falls between our set limit for the loop of low traffic, the signal will turn green for one second. This will also be displayed on the LCD.

Figure 37: Arduino Code

After that in our if loop, the yellow lights 3 and 4 will turn on to indicate transition.

Figure 38: Arduino Code

Now we will set the trigger pin of the fourth ultrasonic sensor to low and high. This would generate a pulse and send out a wave. After that, we will read a pulse input from the echo pin. This will give us the duration in which the wave was propagated and returned. After that, we will calculate the distance from the duration of the wave.

Figure 39: Arduino Code

This distance calculation is for our fourth traffic light. Now we will use the if loop to check our distance value.

Figure 40: Arduino Code

If the value falls between our set limit for the loop, the signal will turn green for three seconds. This will also be displayed on the LCD.

Figure 41: Arduino Code

After that in our if loop, the yellow lights 4 and 1 will turn on to indicate transition.

Figure 42: Arduino Code

Now we will use the if loop to check our distance value.

If the value falls between our set limit for the loop of intermediate traffic, the signal will turn green for two seconds. This will also be displayed on the LCD.

Figure 43: Arduino Code

After that in our if loop, the yellow lights 4 and 1 will turn on to indicate transition.

Figure 44: Arduino Code

Now we will use the if loop to check our distance value again.

If the value falls between our set limit for the loop of low traffic, the signal will turn green for one second. This will also be displayed on the LCD.

Figure 45: Arduino Code

After that in our if loop, the yellow lights 4 and 1 will turn on to indicate transition.

Figure 46: Arduino Code

Results/Working:

At first, after writing the code, generate its hex file and put that hex file on the Arduino board on your Proteus software. After that, run the simulation. The results of the simulation are shown below thoroughly.

At first, when sensor one gives the output within 500 cm, the traffic light will turn on for one second only.

Figure 47: Simulation Results

However, if the sensor one value is between 500 and 900 cm, the traffic light 1 will be green for 2 seconds with the LCD displaying the remaining time.

Figure 48: Simulation Results

If the sensor values are above 900 cm, then the lights will be green for 3 seconds.

Figure 49: Simulation Results

When the sensor two gives the output within 500 cm, traffic light 2 will turn on for one second only.

Figure 50: Simulation Results

However, if the sensor two value is between 500 and 900 cm, the traffic light 2 will be green for 2 seconds with the LCD displaying the remaining time.

Figure 51: Simulation Results

If the sensor values are above 900 cm, then the lights will be green for 3 seconds.

Figure 52: Simulation Results

When sensor three gives the output within 500 cm, traffic light 3 will turn on for one second only.

Figure 53: Simulation Results

However, if the sensor three value is between 500 and 900 cm, the traffic light 3 will be green for 2 seconds with the LCD displaying the remaining time.

Figure 54: Simulation Results

If the sensor values are above 900 cm, then the lights will be green for 3 seconds.

Figure 55: Simulation Results

When sensor four gives the output within 500 cm, traffic light 4 will turn on for one second only.

Figure 56: Simulation Results

However, if the sensor four value is between 500 and 900 cm, the traffic light 4 will be green for 2 seconds with the LCD displaying the remaining time.

Figure 57: Simulation Results

If the sensor values are above 900 cm, then the lights will be green for 3 seconds.

Figure 58: Simulation Results

Phew! I know that this was an extremely long project, but that is a part of an engineer’s life. Multiple receptions and running recurring patterns smoothly requires skill and patience only an engineer can possess. I hope you guys made it through. Kudos to your nerves of steel. Thanks for reading.

How Technology has evolved the Online Casino Industry?

Hello everyone, welcome to today article which we are going to have a look at how technology has evolved the online casino industry. Some of you might be having knowhow on what casino industry is and some might be having partial or no knowledge at all. So, we are going to start with simple things as we advance our topic of discussion further. You should also have a look at the Technology behind Online Casinos.

Definition of the global casino industry

The global casino industry is an industry that is made of facilities that involves predictions of outcomes of the final result that will be obtained after an invent has passed. The predictions are made before the event has started. It is made up of the gambling activities such as the gaming machines and the table wagering boards. it is also a common thing for some of these facilities to provide dinning, lodging and the beverage services to their customers. This industry has evolved to an online modernized activity. The online facility has become the most used one especially in this era of corona virus where lockdowns have really affected the physical appearances in the normal global casinos. Online facilities have offered players and bookies a very momentous offer where they can play the game at any place of their comfort.

The first online casino which was referred to as Inter-casino was launched in 1996 and at this time nobody had an idea of what awaited the casino industry. Bookies never thought that one day the industry would evolve to what it is today. Currently, the online casino industry is worthy over 45 billion US dollars something that is still forcing more investors to put their capital in this new area of business and entertainment. You can imagine after the launch of the first online casino industry, in the same month, there was a raise in the number to 15 and a year later, more than 150 online casinos had been launched. Actually, this was the area where investors had started seeing some great potential.

Since the industry crossed the one billion net worth mark in 1998, there have been new inventions and innovations that have led to drastic change and growth in the online casino industry. More technological advances have been made which has led to more players feeling comfortable in joining the industry. This article will focus on how technology has impacted on the online casino industry.

Multiple payment options

Multiple payment option is one of the areas that have greatly improved the online casino industry. Players can now deposit and withdraw money from sites within seconds. This payment systems introduction has lowered the cost incurred by clients and also fastened the process. Several cashless payment methods have also hit the market. These payment methods such as PayPal, Skrill, mobile money and Wire Transfer, etc have impacted greatly on how customers receive their winnings from the booking sites. You can check on OBLG to take note of all the casinos that offers their payment through PayPal which is the most commonly used universal payment methods by the majority of the bookies especially in Europe and America. Moreover, because of this online payment system, casinos also offer no deposit free spins offers, in order to attract customers.

Although landless betting has a limited amount that a client can play with, the online casino has offered a lot of options that can be used in the process and this has led to the expansion of the casino industry. One greatest thing that happens in technology is that you can adapt to new trend very quickly. Currently, cryptocurrency is taking over as the means of payment because with it you are guaranteed of great financial security and anonymity. Most popular cryptocurrency is the Bitcoin and it has offered very strong facility where even governments are unable to track owners of the casinos or even the players. With this cryptocurrency being used as a mode of payment, the casino industry has grown internationally simply because players from restricted countries can play in anonymity and get their winnings in form of cryptocurrency.

There has also been a shift in focus where most online casinos are introducing casinos that operate in the blockchain technology whereby there is an outcome of better features and makes the future of the casino industry look great.

Choice and variety

With new trend in the area of technology, there have been development of the multi-dimensional approach across the casino industry. There has been great input in the development of the games that offers great and clear features to the players and the viewers.

With online gambling, bookers can feel a redefined industry. When you look at the betting sites, you will realize that they have been customized in a manner that it has a very powerful interface which offers the gamers a very welcoming experience while carrying out the gambling at the comfort of their wish. The introduction cool visuals and the tense atmosphere which tries to mimic the situations in real-life has made the online casino industry more and more beautiful. This actually evidence from the growth of the numbers on the gamblers who are who prefer doing their gambling online as compared to those who prefer doing it manually or in the traditional land-based gambling. For example, most online gambling industry have decided to introduce the eSports games in their online gambling platform and this shows the potential of that innovation has made in the gambling industry.

The variety of the games available in the online casino platform has also led to the increased number of gamers joining the gambling industry where some online casinos offer more than 2000 games that a gamer can choose from. The vast options of the games that are available ensure that gamers are never bored due to the availability of too many games options to choose. In some occasions, virtual reality has been involved in making this online gaming industry a reality. The use of this high technology glasses has made gamblers experience more entertainment as they feel inserted into the world of different reality. Users are able to have a real time interaction that is based on the traditional land-based casino interactions.

Customer support system and security

Despite the great growth in the online gaming industry, it comes home with some disadvantages especially on matters security since it is accompanied with a lot of attacks that are directed towards the gamers. This frequent security attacks are more as compared to what is experienced in the traditional land-based casino. Since the digital information is always very sensitive, it is the duty of the casino site to keep the information very safe lest it falls in the hands of the wrong person. The sensitive personal information that is required for online casino can be used for identity where the client can lose a lot of money through hacking. Online casinos have been forced to use new technology in securing their sites in order to protect their clients from insecurity that might occur.

Some online casinos have even gone a step higher whereby they use the artificial intelligent to improve the security of the site and ensure that they monitor every movement that is made on the sites. There has also been a way where users have to provide the 2FA authentication to ensure that only authorized members get access to the sites.

Customer support has also moved a notch higher with the advent of new advanced ways of solving customer issues in the online casino platforms. In the online casino platforms, you will come across emails, call centers and even live chats which have been introduced in the recent years to improv on customer care services. Some of these casinos have a way of offering 24/7 customer care services and this is done to prove to the customers that they are gambling in a very safe place. This proper customer care services have led to the expansion of the casino industry globally.

The mobile casino industry

The advent of the smartphone industry has also increased the growth in the online industry. Today, the largest population of the world have a smartphone in their pocket and this has led to the people participation more in the online casino games and gambling. Online casinos have taken advantage in the growth of the smartphone owners and have come up with sites that are mobile friendly giving their players a very fascinating environment to entertain themselves. The mobile casino games are very revolutionary as players can get access to the games at any time and any locations and this has made it very convenient to the gamers the mobile phones have introduced portability to this industry.

Better marketing

Some few years ago, the gamers used to visit the betting shops to play games. With the introduction of the online casino, it has become do possible for the games to rich people easily and in any location of this world. Some companies have moved the impact higher by organizing gaming competitions that involves millions of people which could not be achieved in the traditional hall because of the spacing and difficulty in managing the outcome. The online casino has actually introduced the new investment opportunity for the people. This online casino has actually introduced new technology trends in order to place itself in a position which can rival the competitors and also give the pundits an improved gaming experience. They have come up with very user -friendly interfaces that come in with several important features. Some of these sites use artificial intelligent to settle and update results and games too. All these activities are being done to ensure that the online casino site has more clients joining.

Artificial intelligent

Modern online casinos have gone into another level whereby the use of artificial intelligent have revolutionized the industry. Artificial intelligence such as the use of the chatbots have been used to help the gamblers in placement of the bets. The same artificial intelligence has been used by the sites to help customers in the processing of their payments from the bookies and also process withdrawal request for the clients. The bot is very important in this industry because they can offer unlimited customer support. The artificial intelligence has also found use in the online casino industry where the gamers have an interest in playing against the machines instead of playing against the other gamers. Also, the Sportbooks have been using various artificial intelligence mechanism to help the users of the various websites find the various icons and learn how to use the sites.

Mobile phone applications

The smartphone, tablets and the internet industry has made major technological impact in the area of the online casino industry. Statistics show that in 2012 there was a great improvement in the use of the online casino by 12% globally. This improvement was introduced due to the revolutionization of the smartphone and the internet industry. Now close to over one hundred and sixty million pundits visit online casinos on their phones using the mobile phones applications. The mobile gambling is said to be contributing at least 50% of the revenue that is generated from the gambling industry. The mobile applications have greatly impacted on the growth of the online casinos industry.

In conclusion, the online casino industry has grown to a greater extent through the introduction of so many trends in the areas of money transfer, online payment methods, the introduction of artificial intelligence, the great extent to which the mobile phone application industry has grown higher, the introduction of better marketing strategies, better customer support and security systems. With all these, the industry has grown to something else, something better and something magnificent attracting more bookies worldwide.

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir