Pages: [1]   Go Down
Author Topic: Countdown to Maker Faire on a Betabrite LED sign  (Read 2405 times)
0 Members and 1 Guest are viewing this topic.
SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Saw that the Call for Makers had launched for Maker Faire Bay Area...only 99 days left! They have a neat live countdown on their site, so I decided to use an Arduino to build a similar countdown timer...except BIG. I used a Betabrite sign I got from the electronics flea market, a Seeeduino, and a ChronoDot. The Time Library was a big help. More details here: http://macetech.com/blog/node/115

Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, and here's the code in case anyone would like to see how to talk to a Betabrite LED sign, or use the Time library:
Code:
// Betabrite Countdown
// Counts down the time until Maker Faire Bay Area 2012
// Uses Betabrite 1040 display, Arduino, and ChronoDot

#include <Time.h> // Time Library
#include <Wire.h> // Wire for RTC
#include <DS1307RTC.h> // DS3231/ChronoDot works like DS1307

time_t MFBA; // Start time of Maker Faire
time_t difftime; // difference between current and target time
int diff_seconds;
int diff_minutes;
int diff_hours;
int diff_days;

// Initialize RTC and Betabrite sign
void setup() {
  Serial.begin(9600); // set baud to 9600
  UCSR0C = (2<<UPM00)|(0<<USBS0)|(2<<UCSZ00)|(0<<UCPOL0); // configure for 7E1 not 8N1

  setSyncProvider(RTC.get); // set sync to use the ChronoDot
  setSyncInterval(10); // sync every 10 seconds if possible

  // check whether sync worked
  if(timeStatus()!= timeSet)
    Serial.println("Unable to sync with the RTC");
  else
    Serial.println("RTC has set the system time");

  tmElements_t MFBA_elements; // elements array to construct Maker Faire start time

  // 10:00 AM on May 19th, 2012
  MFBA_elements.Second = 0;
  MFBA_elements.Minute = 0;
  MFBA_elements.Hour = 10;
  MFBA_elements.Wday = 7;
  MFBA_elements.Day = 19;
  MFBA_elements.Month = 5;
  MFBA_elements.Year = 2012 - 1970;

  MFBA = makeTime(MFBA_elements); // Unix timestamp of Maker Faire start time

  // Initialize Betabrite memory locations
  for(int i = 0; i < 5; i++) Serial.write((byte)0x00); // auto detect baud
  Serial.write((byte)0x01); // SOH
  Serial.print("Z00"); // All displays
  Serial.write((byte)0x02); // STX
  Serial.print("E$AAU0100FF001BL00C00000"); // Set mem locations for text and string
  Serial.write((byte)0x04); // ETX

  delay(1000);

  // Initialize text file
  // String "1" will be called whenever scrolling animation restarts
  for(int i = 0; i < 5; i++) Serial.write((byte)0x00); // auto detect baud
  Serial.write((byte)0x01); // SOH
  Serial.print("Z00"); // All displays
  Serial.write((byte)0x02); // STX
  Serial.print("AA"); // Text string
  Serial.write((byte)0x1B); // ESC
  Serial.write((byte)0x20); // Line number
  Serial.print("a"); // Scroll right to left
  Serial.write((byte)0x10);
  Serial.print("1 until Maker Faire"); // Call string 1 plus text
  Serial.write((byte)0x04); // ETX


}


time_t systime; // holds current time for diff calculation

void loop() {

  if (systime != now()) { // wait for new second to do anything
    systime = now();
    difftime = MFBA - systime; // subtract current time from Maker Faire time
    diff_seconds = difftime % 60; // get seconds
    difftime /= 60; // convert to minutes
    diff_minutes = difftime % 60; // get minutes
    difftime /= 60; // convert to hours
    diff_hours = difftime % 24; // get hours
    difftime /= 24; // convert to days
    diff_days = difftime; // get days

    // Update string on Betabrite with updated countdown
    for(int i = 0; i < 5; i++) Serial.write((byte)0x00); // auto baud rate
    Serial.write((byte)0x01); // SOH
    Serial.print("Z00"); // All displays
    Serial.write((byte)0x02); // STX
    Serial.print("G1"); // Write to string 1
    digitalClockDisplay(); // Send countdown string
    Serial.write((byte)0x04); // ETX
  }
}

// modified routine from Time Library example
void digitalClockDisplay(){
  Serial.print(diff_days);
  Serial.print(" Days ");
  printDigits(diff_hours);
  Serial.print(" Hours ");
  printDigits(diff_minutes);
  Serial.print(" Minutes ");
  printDigits(diff_seconds);
  Serial.print(" Seconds");
}

// routine from Time Library example
void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  //Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}
« Last Edit: February 11, 2012, 07:52:43 pm by macegr » Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Cairns - Green Island for Winter
Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The first link I followed did not work The others I followed on th site did work but I didnt find anywhere I might buy one

Can you elaborate on what the sign is and what it needs as input . I am in Australia and would like to get one or something similar and give your project a go

A block diagram of your system would help . Obviously I have to drive the LED display with a RS323  12 volt driver from the timepiece and the arduino runs the program and feeds the LED's I suppose ?
« Last Edit: February 12, 2012, 07:43:36 am by tytower » Logged

Governments should do what they were designed to do only.
Manage the larger issues best done by Government.
My Family and my Property are no

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What was the first link you followed? Every link in the article appears to work fine. The LED signs are typically a bit expensive, so your best bet is to find a used one. Maybe with a discount due to no remote control etc. Or roll your own using one of the Sure Electronics matrices.

The sign accepts serial commands to control the text displayed, formatting, color, scroll effect, etc. It's quite a complex protocol. There are some efforts out there to create Arduino libraries.

The block diagram is: RTC--Arduino--MAX232--Betabrite. The Arduino handles all the time calculations etc.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So is this particular coding or library for control of the Betabrite display anywhere for download? I was having trouble searching for it. I was possibly interested in purchasing a RS232 shield to code my arduino to talk to my betabrite classic for a fun project or current project in need of a large eye catching display.
Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

All the code to control the Betabrite sign is right in the code I posted here.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Pages: [1]   Go Up
Jump to: