---
title: "An Intelligent Traffic Signal Controller based on CAN Bus"
url: "https://maker.wiznet.io/siva_ranjeet/projects/an-intelligent-traffic-signal-controller-based-on-can-bus/"
markdown_url: "https://maker.wiznet.io/siva_ranjeet/projects/an-intelligent-traffic-signal-controller-based-on-can-bus/md"
type: "UCC: User Created Content"
author: "Shan Ying Cheng, Xue Mei Zhou, Qin Jiang"
author_url: "https://www.scientific.net/AMM.599-601.1158"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Shan Ying Cheng, Xue Mei Zhou, Qin Jiang"
original_url: "https://www.scientific.net/AMM.599-601.1158"
published: "2022-10-06"
language: "en"
likes: 5
views: 1289
comments: 1
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# An Intelligent Traffic Signal Controller based on CAN Bus

> According to the characteristics of mixed traffic flow of China, An intelligent traffic signal controller is introduced.

Original author: Shan Ying Cheng, Xue Mei Zhou, Qin Jiang (source: https://www.scientific.net/AMM.599-601.1158)

## Article

#### Introduction

With the development of urbanization, more and more attention has been given to the problem of traffic jam. The traffic signal controller plays a key role in ITS. So the task of developing the suitable intelligent traffic signal controller in China is increasingly challenging getting tougher and tougher.

#### System Design

The control method of modern urban traffic is road traffic signal control. We can solve the traffic conflict of shared intersection with the traffic signal control. It involves the problems of safety passage, capacity of road and so on. The core of signal control is traffic signal controller. The study direction of modern traffic signal controller is to reduce the delay and environmental pollution
control. In china, the traffic signal falls into three types:

1. vehicle signal,

2. non-vehicle signal

3. mid-block street crossing signal.

The traffic signal light group of vehicle and non-vehicle must meet red, yellow and green color. While the traffic signal light group of mid-block street crossing only have 2 colors: red and green. In view of complex and volatile environment at the intersection, the controller has the authority to define the attribute of all signals, which can satisfy the universality of various devices under different conditions. The traffic signal controller use function modularization to guarantee the real time and fault freedom. The master control module supervises other functional module by means of star topology, and then all of modules work together to finish the control function.

#### Hardware Design

Module design is emphasized in traffic signal controller. The controller is divided into power, master control module, traffic light driver and detection unit, traffic flow collection unit, interfaces, system state detection and communication lines. The framework of hardware is illustrated in Fig.1.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665499522%2Epng)

When the controller starts to work, the main control unit sends out the state of traffic sign, and then obtains returned states by the work of traffic sign detection, which ensures the reliability of traffic sign states. The master control module adjusts the real time states of traffic sign and transmits these messages to the remote monitoring computer.

**Master Control Module:** STM32F207 MCU with the innovative adaptive real-time memory accelerator and multi-layer bus matrix is used as processor in the system. It is based on ARM 32-bit Cortex™-M3, which has flexible static memory controller, 2 × CAN interfaces (2.0B Active) and SDIO interface. Furthermore the Flash memory access speed is equivalent to 30 Mhz and the embedded SRAM access time is at CPU clock speed with 0 wait states. STM32F207 communicate with traffic light driver unit by CAN bus, then the STN32F103 in the traffic light driver unit verifies the accuracy of received states of traffic light and strictly control timeliness accuracy consistency of the output state. The key device DMA controllers, which have 16 streams, commit to finishing memory access requests. All of this guarantees the work of traffic sign controller validity to its fullest extent.

**I/O Module: **Traffic light control unit is in charge of high/low electrical level output of I/O ports, it controls the traffic light states. Due to broad intersection and multilane, one lane need a group traffic lights of red, yellow and green color at least. So it needs a large number of I/O ports to fulfill the traffic lights control of intersections. There are a great number of traffic light driver units; each driver unit is controlled by an independent MCU with the expansion drive module in new type traffic controller. The safety and reliability of traffic signal can be ensured. The MCU with the function of effective time control mechanism can jump automatically to yellow flash state to avoid the conflict of green light.

**Network communication:** In communication module, the W5500 is well suited for network communication. The Fig .2 is block diagram of W5500. It is a full-featured, fully hardwired, TCP/IP stack single chip. And it is 10/100 Ethernet controller which is designed for embedded systems with high stability and high performance. Hardwired TCP/IP stack supports TCP, IGMP, IPv4, ARP, ICMP, UDP and PPPoE. The MCU of communication control unit is STM32F103. It can access the W5500 speedily through high-speed parallel bus and control the connection of Ethernet. Simultaneously it also verifies the received data whether it is valid.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665499653%2Epng)

The Controller Area Network (CAN) is a serial communications protocol. The speed can get up to 1Mbit/s with a very high level of security when use it to communicate. The performance of error detection of CAN is very excellent; bit error rate is less than 4.7*10-11 by monitoring, cyclic redundancy check, bit stuffing and message frame check. Using message filtering technology, the realization of multicast can be easy.

**Driver and Fault Detection:** The principle of driver is shown in Fig.3. Using zero crossing triggering of MOC3041, BTA16 can decide to turn on or off traffic light by means of control of AC (alternating current) on -off.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665499755%2Epng)

The equipment failure of traffic light driver is classified 3 types:

1. a bi- directional triode thyristor is conducted all time;

2. a bi-directional triode thyristor is broken circuit;

3. a traffic light is short circuit.

The approach of fault diagnosis must combine the technology of electric current detection and electric voltage detection. Circuit diagram of electric voltage detection is shown in Fig.4. Photocoupler monitors alternating current in isolation. D1 carries on half wave rectification of alternating current, R1 limits electric current, R2 limits electric voltage. All of this is to protect the input ports of photocoupler. When the alternating current works normally, the output of photocoupler can give low level signal stably by the normal incoming signal 74HC14.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665499838%2Epng)

Circuit diagram of electric current detection is shown in Fig.5. The power of traffic light is from 15 to several hundreds. Current transformer samples electric current in isolation. The sampled signal will be amplified by LM358D and R1, then reaches 74HC14. With the stored energy of C1, 74HC14 can keep low level signal about 20 milliseconds after power fail. During the process, the function of electric current is realized.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665499879%2Epng)

In this paper, we design yellow flashing unit to guarantee the traffic safety as emergency respond. It will make all traffic lights yellow flashing, when the traffic signal controller finds the traffic lights do not work properly. We also design power supply module, RTC module, human computer interface and so on.

#### Software Design

The architecture of traffic signal controller software is distributed and parallel structure. The CoOS is an embedded multi-task real-time OS, especially for ARM Cortex M series. It supports preemptive priority and round-robin and provides Semaphore, Mutex, Flag, Mailbox and Queue for communication & synchronization. The traffic signal controller can work reliably and speedily with it. So we choose the CoOS RTOS in this paper. The software of traffic signal controller includes traffic flow collection unit, CAN communication unit, man machine interface, yellow flashing control unit, traffic light driver and system state detection unit; count down unit, traffic signal phase control unit.

#### Fuzzy Control in Isolated intersection

It can’t take complex control algorithm optimizations on embedded system because of the limitation of computing power. The fuzzy control doesn’t need set up accurate mathematical models. It’s an intelligent control algorithm based on rule. A mechanism of fuzzy control in isolated intersection is designed and the goal is to obtain the lowest vehicles average delay. In order to realize the fuzzy control, the data of traffic flow in real time must be collected by using induction coil to calculate queuing length in all directions. In this paper, the layout of induction coil takes a crossroad intersection as an example. A testing area consists of 2 induction coils on each entry. One is used to detect the going out traffic volume, which is installed in stop line. The other is used to detect the incoming traffic volume. The queuing length of vehicles could be obtained by the process. The distance of two induction coils in one lane is D; generally its range from 70 to 140 meters. The induction coils detect traffic volume in real time and get traffic flow information. The data obtained is the input of fuzzy control in real time. The mode of fuzzy control is variable phase, described as Fig.6.

![](https://maker.wiznet.io/upload/ckeditor5/490413977%5F1665500055%2Epng)

The input of phase strategies unit is queuing length Qj and red time Tj , which are from vehicle detector. Urgency degree of each red light can be calculated by fuzzy rules. The phase of max red light urgency degree is used as the successor Pj . The input of delay strategy unit is Qj and Qi. Qj isthe queuing length of the succeed Pj . Qi is queuing length of the current green light. The decision whether to keep the current phase or switch to the successor could be made according to fuzzy rules. The phase will switch to the next one when the delay reaches to max green time. This can prevent one phase works all time. The control method is similar to traffic dispersion measures which are taken by traffic policemen. Its process is not only simple but also it is easily to realize.

#### Conclusion

In order to alleviate traffic congestion, a traffic signal controller based on Cortex-M3 and CoOS were presented. The hardware design and software strategy was introduced. Fuzzy control mechanism is applied to deal with dynamic traffic flow and can increases traffic capacity effectively. Experiments show that traffic signal controller works stably and reliably.

---

Source: https://maker.wiznet.io/siva_ranjeet/projects/an-intelligent-traffic-signal-controller-based-on-can-bus/
