Showing posts with label Micro Controllers. Show all posts
Showing posts with label Micro Controllers. Show all posts

Friday, November 18, 2011

Inductive Loop Sensor & Dynamic Traffic Control for Intelligent Traffic Light System

Our Intelligent Traffic Light System is capable of changing priority level of the roads according to their traffic level. To measure the traffic level we have several mechanisms.
  • Image Processing
  • Pressure sensors, give reading when pressure changes by the vehicles
  • Inductive Loops
From the above methods we choose inductive loop.It is build on the concept of inductance change of a coil when a metal object come closer.You know that when you send electrical current through a wire, it generates a magnetic field. For a coil this electromagnetic field is high.You can change the inductance of the coil and change the electromagnetic flux by introducing additional conductive materials into the loop's magnetic field. This is what happens when a car pulls up to the intersection. The huge mass of metal that makes up your car alters the magnetic field around the loop, changing its inductance. 


So we have made a coil develop the inductive loop.We have some kind of metering device to meter the voltage level change in the coil. After some reading we have found this article, it really help to achieve our target.

In the above  circuit diagram we can connect the LED's positive pin to PIC device to get the input. So using that we can easily develop a algorithm to achieve dynamic traffic controlling.

References : Above diagrams and pictures are extracted from the following resources on the purpose to gather all the knowledge in to one place for learn easily.
  1. http://www.fhwa.dot.gov/publications/publicroads/98septoct/loop.cfm
  2. http://auto.howstuffworks.com/car-driving-safety/safety-regulatory-devices/red-light-camera1.htm
  3. http://www3.telus.net/chemelec/Projects/Loop-Detector/Loop-Detector.htm

8*6 LED Matrix for Intelligent Traffic Light System

Next Task was to make the controlling mechanism for traffic lights. Major problem was, there are not enough I/O pins in the PIC to control each bulb of the traffic light. So we choose small mechanism to avoid that problem. That is the 8*6 LED Matrix. To explain this concept I will use a article publish by electronic department of our university. (http://www.ent.mrt.ac.lk/web/knowledgebase/uc/5.3.pdf) . Here we use the mechanism used to light up pixels in a LCD display. I will explain the steps to light up all the 40 LEDs using this mechanism at same time.

     
  • To light a single LED in this matrix we have to give +,- voltages to its pins. You can notice that if we set any pin in PORTB to logic 1, it will give + voltage to LED's + pin. 
  • Then How we can give the ground connection to the - pin of the LED. For that we have to turn on the D400 transistor for that particular column.
  • After that particular LED will be light up. For example we can use this code to light up all the LEDS RA0 column,
          PORTB=0b11111111;
          PORTA=0b00000001;
  • To light up all the LEDS RA1 column,
          PORTB=0b11111111;
          PORTA=0b00000010;
  • To light up all the LEDS RA2 column,
          PORTB=0b11111111;
          PORTA=0b00000100;
  • To light up all the LEDS RA3 column,
          PORTB=0b11111111;
          PORTA=0b00001000;
  • To light up all the LEDS RA4 column,
          PORTB=0b11111111;
          PORTA=0b00010000;
  • To light each other LED in RA0 Column you can use this code,
          PORTB=0b10101010;
          PORTA=0b00000001;
  • Like that we can control each LED in a column using PORTB pins.But you can identify that you cant light up RA0 columns 0the row LED and off the   RA1 columns 0the row LED at the same time. Because we use PORTA pins to choose the column and PORTB to choose the row.
  • So how can we light up all the columns at same time. We use the weakness of human eye to this.If we light different columns at high speed you cant see a difference you will notice that all the LEDs are lighting at the same time.
  • Here is the code for that,
    while(1){
          PORTB=0b10101010;
          PORTA=0b00000001;
          PORTB=0b10101010;
          PORTA=0b00000010;
          PORTB=0b10101010;
          PORTA=0b00000100;
          PORTB=0b10101010;
          PORTA=0b00001000;
          PORTB=0b10101010;
          PORTA=0b00010000;
    }
  • In the same mechanism we implement the control system for our traffic light system. Below diagram will show you how we implement that.

    Bluetooth Wireless Communication method for Intelligent Traffic Light System

    • We choose Arduino Bluetooth Module Slave Wireless Serial Port 4P for our wireless communication purposes (http://www.ebay.com/itm/Arduino-Bluetooth-Module-Slave-Wireless-Serial-Port-4P-/150653185968?pt=LH_DefaultDomain_0&hash=item2313a12fb0).



      To use this device in the mood working 100% correct, we have to use a resistor divider to reduce the operating  Because PIC18f452's RX,TX operating in 5V-0V range but in this Bluetooth reviver it operates in 3.3V to 0V range. So we put up a voltage divider between the Arduino Bluetooth Module Slave Wireless Serial Port and the PIC's RX, TX pins. After setup according to the below diagram Bluetooth Module will start working. When you search for new Bluetooth it will appear as a other type of device.You can couple the device with your laptop using its embedded pin code. After that your PC will have a serial port open via Bluetooth. you can easily communicate with that.

    Choosing suitable micro controller for Intelligent Traffic Light System

    • Our first challenge was to find a suitable micro controller for this system. For this we consider following facts,
      • It have to control unknown number of lights belong to traffic lights. Most of the time it will more than 30.
      • It have to communicate with a laptop via Bluetooth or other wireless communication method.
      • It have to read unknown number of sensor values, most probably  less than 10.
      So considering above facts we choose the micro controller PIC 18f452 (http://www.microchip.com/wwwproducts/devices.aspx?ddocname=en010296) To fulfill the above aspects we have found some mechanisms.

    Inteligent Traffic Ligth System

    For the Semester 4 of the Computer Engineering Department of  University of Moratuwa, we learn a subject call Micro-Controllers and Applications. The aspect of this to learn the way of handling Micro-Controllers in their limited environment. For the project of this subject some of we have been asked to build a intelligent traffic light system.To describe it's functionality read this,

      
     
    • Control of the road traffic on junctions :
      Up to maximum of 4 roads are intersecting with 4 pedestrians crossings in each road, near the junction. This will be the extreme, but system will be able to control all the other subset of junctions.
    • Dynamic priority level for roads :
      This system will be able to sense all the vehicle movements through the junction.After sensing these movements, the system will adjust its timing parameters automatically to give the higher priority to roads which have much traffic level.
    • Ability to configure system easily after installation:
      After installing the traffic light system in the roads, the configurations can be changed by plugging a simple interface to the system.
    • Manual Override:
      When a Police Officer does traffic controlling, he will be able to control all the traffic lights using a remote control device.
    • Fail Safe :
      If something goes wrong, the system should be able to move into state which will stop all the movements of vehicles and people, which will cause further damage.
    • Energy Saving:
      Should be able to control the intensity of the lights in the night and day time.
    • Automatic roll back to auto mood:
      If system has been changed to manual mood and if there are no commands issued to the system for a particular time period it switches back to auto mood.
    • Can be configuring according to the place of installation:
      The abstract system is constructed to install in a junction which has 4 roads. But after doing few steps of configuration it can be used in any kind of place.
    Our design was done based on the above functionality. I like to describe the steps we go through, First of all the below diagram shows our basic block diagram of the design.
























    Thursday, November 4, 2010

    Programmable Logic Controller (PLC)



    The automation of many different processes, such as controlling machines or factory assembly lines, is done through the use of small computers called a programmable logic controllers (PLCs). This is actually a control device that consists of a programmable microprocessor, and is programmed using a specialized computer language. A modern programmable logic controller is usually programmed in any one of several languages, ranging from ladderlogic to Basic or C. Typically, the program is written in a development environment on a computer, and then is downloaded onto the programmable logic controller directly through a cable connection. The program is stored in the programmable logiccontroller in non-volatile memory.

    Programmable logic controllers typically contain a variable number of input/output (I/O) ports, and are usually Reduced Instruction Set Computer (RISC) based. They are designed for real-time use, and often must withstand harsh environments on the shop floor. Theprogrammable logic controller circuitry monitors the status of multiple sensor inputs, which control output actuators, which may be things like motor starters, solenoids, lights and displays, or valves.
    This controller has made a significant contribution to factory automation. Earlier automation systems had to use thousands of individual relays and cam timers. In many cases, a PLC allows all of the relays and timers within a factory system to be replaced with a single controller. Today, programmable logic controllers deliver a wide range of functionality, including basic relay control, motion control, process control, and complex networking, as well as being used in distributed control systems (DCS).
    Digital signals yield an on or off signal, which the programmable logic controller sees as Boolean values, those with only two states: true or false. Analog signals may also be used, such as those from devices like volume controls, and these analog signals can be seen by the programmable logic controller as floating point values. This is one way in which a computer can represent a rational number, but can be imprecise.
    There are several different types of interfaces that are used when people need to interact with the programmable logic controller to configure it or work with it. It might be configured with simple lights or switches, or a text display. More complex systems might use a web interface on a computer running a supervisory control and data acquisition (SCADA) system.

    Friday, October 15, 2010

    The Circuit Make Me Crazy......



    People Said that i can do a PHD about that circuit.That has only 4Capacitors,1 IC, 1 serial port
    I maid it nearly 50 times.

    That circuit is USART circuit with max 232.

    If you guys want to do robotics with communication with PC that is the circuit.
    But that makes all thing a mess.

    If you guys want to do it follow these tips.
    1. Do not use a PC which leaks AC currents to the body.
    2. Use a proper communication cable.
    3. Make this circuit in separate PCB.
    4. If you guys have communication problem, please check the IC.
    If you guys still have trouble contact me.


    Avoiding Oscillation in Line Following Robots _ Algorithum

    Every one who build a line following Robot know that when we build it it follow straight lines really well. But when it comes to curved lines it will follow the line, but it will oscillate. I found a algorithm for avoid that.

    From This Video You Can See the problem.

    Hear is the tutorial which i followed.

    Hear are some tips to follow

    1. Make your line sensor small. The distance between photo transistors should be place close to each other.
    2. Put your line sensor little far away from your motor axis. That will make sensitivity more. Hear is my robot.(But not suitable for micro applications.)
    3. Also Follow Above Algorithms.
    Hear is my Robot.




    Thursday, October 14, 2010

    Robotics, Line Sensors

    Hear is the line sensor produced by Mora VAPS team. It works fine with digital out puts.


    If you guys want to create good line sensors hear are some useful tips.

    Use IR led
    Use coverings to total Led set.
    Also we found a really good line sensor with really good resolution.(http://www.pololu.com/catalog/product/961)