Close
0%
0%

Next Bus 7-segments display

Next bus departure in real time

tjTJ
Similar projects worth following

This board is an Arduino mega shield with an ethernet module on it. It's displaying real time departures of the 3 nearest bus lines from my house.

The Green 7-segments are displaying the line number and the orange ones are for the times (HH MM SS / hours minutes seconds).

It connects on the Keolis open data server every 24 sec to get next departures and after that it displays the request time for 2 seconds then the departure time for 2 sec and a countdown during next 20 seconds.

  • 2 × MC14499 Interface and IO ICs / Display Interface
  • 2 × ULN2003-A Discrete Semiconductors / Transistor Arrays
  • 3 × 2*7-segments display (common cathode) Orange
  • 2 × 7-segments display (common anode) Green
  • 1 × Arduino Mega 2560

View all 9 components

  • Arduino (Uno/Mega) MC14499 code

    TJ03/08/2015 at 11:33 0 comments

    Arduino Uno:

    //MC14499
    static int latchPin = 8; //enable
    static int clockPin = 12; //clock
    static int dataPin = 11; //data

    Arduino Mega:

    //MC14499
    static int latchPin = A0; //enable
    static int clockPin = 49; //clock
    static int dataPin = 48; //data

    Common:

    void mc14499ShiftOut(byte val)
    {
          for (int i = 0; i < 4; i++)  {
                digitalWrite(dataPin, !!(val & (1 << (3 - i))));
                digitalWrite(clockPin, HIGH);
                digitalWrite(clockPin, LOW);            
          }
    }
    /*
    b1 => Green  7-segment "bus 1"
    b2 => Green  7-segment "bus 2"
    h1 => Orange 7-segment "hours 1"
    h2 => Orange 7-segment "hours 2"
    m1 => Orange 7-segment "minutes 1"
    m2 => Orange 7-segment "minutes 2"
    s1 => Orange 7-segment "seconds 1"
    s2 => Orange 7-segment "seconds 2"
    */
    static void affi7(byte b1, byte b2, byte h1, byte h2, byte m1, byte m2, byte s1, byte s2)
    {
     digitalWrite(latchPin, LOW);
     mc14499ShiftOut(B00001111);
     mc14499ShiftOut(s2);
     mc14499ShiftOut(s1);
     mc14499ShiftOut(m2);
     mc14499ShiftOut(m1);
     mc14499ShiftOut(B00001111);
     mc14499ShiftOut(b2);
     mc14499ShiftOut(b1);
     mc14499ShiftOut(h1);
     mc14499ShiftOut(h2);
     digitalWrite(latchPin, HIGH);
    }
    
    static void affi(int bus, int hours, int minutes, int seconds)
    {
     byte s2 = (byte)(seconds-(seconds/10)*10);
     byte s1 = (byte)(seconds/10);
     byte m2 = (byte)(minutes-(minutes/10)*10);
     byte m1 = (byte)(minutes/10);
     byte b2 = (byte)(bus-(bus/10)*10);
     byte b1 = (byte)(bus/10);
     byte h2 = (byte)(hours-(hours/10)*10);
     byte h1 = (byte)(hours/10);
     if (b1 == 0)
       b1 = 0xFF;
     if (hours == 0xFFFF) {
       h1 = 0xFF;
       h2 = 0xFF;
       
       if (minutes == 0xFFFF) {
         m1 = 0xFF;
         m2 = 0xFF;
       }
     }
     affi7(b1, b2, h1, h2, m1, m2, s1, s2);
    }
    
    void setup()  //arduino setup
    {
      pinMode(latchPin, OUTPUT);
      pinMode(clockPin, OUTPUT);
      pinMode(dataPin, OUTPUT);
    }
    On the picture:
    void loop()
    {
      affi(2, 19, 50, 00);
    }

View project log

Enjoy this project?

Share

Discussions

RODRANNER wrote 03/06/2015 at 20:26 point

hello, I recovered some cards with 8 display operated by 2 mc14499 but I can not manage them with arduino, could you help me with the code

  Are you sure? yes | no

TJ wrote 03/08/2015 at 11:38 point

Please find the new section "Code" in the project logs.

Regards,

TJ

  Are you sure? yes | no

TJ wrote 11/07/2014 at 15:50 point
Hi,
It's still working but I'm making a 3D printed box for it.

  Are you sure? yes | no

MakerSelf wrote 11/07/2014 at 05:05 point
Have you made any progress on this?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates