h1

Eat Sign Done

October 1, 2013


Finally finished my EAT sign. It has 3 modes you can click through using the button on the side. Mode one lights up one led at a time, mode 2 blinks all the led’s and mode 3 fades all the leds up and down.

I used a standalone arduino and 2 TLC 5940 chips plus 23 leds.
Here is my complete parts list.

1. 3 letters from junk store
2. plywood for base of sign
3. 2 Adafruit proto boards.
4. 2 TLC5940 chips
5. 1 photocell to know when it is dark enough.
6. 1 momentary pushbutton
7. 23 10.3CD leds
8. led mounts
9. Some resistors
10. Lots of wire
11. Paint
12. Wooden Dowel Pins


See below for actual Arduino code.

/*EATSign_7 Eat Sign Leds with 2 TLC 5940 September 25 2013 vs 7
corrected blink to stop and added effect redo every 15 min (changeable) */

#include “Tlc5940.h”
int channel=0;
volatile int state = HIGH;
volatile int bpCount=0;

int fadeCount=0;
int blinkCount =0;
int lightOneCount=0;
int sensorPin = 0;
int sensorRead = 0;
int lastsensorRead = 0;
int pushButton = 2;
int buttonRead = 0;

long interval = 11;
long interval2 = 11;
long interval3= 500;
long intervalQuart= 15*1000*60; // 60*1000*15 = 15 min wait and redo lighting effect

unsigned long previousMillis = 0;
unsigned long previousMillis2 = 0;
unsigned long previousMillis3 = 0;
unsigned long previousMillisQuart = 0;
unsigned long currentMillisQuart = 0;
unsigned long currentMillis2 = 0;
unsigned long currentMillis3 = 0;
unsigned long currentMillis = 0;

void setup()

{
Tlc.init();
channel=0;
attachInterrupt(0, blinkInterrupt, LOW);
pinMode(pushButton, INPUT);
digitalWrite (pushButton,HIGH);
Serial.begin(9600);
Serial.println(F(“Starting up…”));
}

void loop()

{
sensorRead = analogRead(sensorPin);
Serial.println(sensorRead);
if(bpCount>=4)
{
bpCount=1;
fadeCount=0;
blinkCount = 0;
lightOneCount=0;
}

Serial.println(bpCount);

if (sensorRead <=100 && lastsensorRead <= 100 || sensorRead <=100 && lastsensorRead intervalQuart)
{
currentMillisQuart = millis();
if(currentMillisQuart – previousMillisQuart > intervalQuart)
{
previousMillisQuart = currentMillisQuart;
fadeCount=0;
blinkCount = 0;
fadeCount=0;
lightOneCount=0;
}
// switch case chooses light pattern based on button presses
switch (bpCount)
{
case 1:
lightBlink();
break;

case 2:
lightFade();
break;

case 3:
lightOneataTime();
break;

default:
lightOneataTime();
}
lastsensorRead = sensorRead;
}
else
{
lightOff();
fadeCount=0;
blinkCount = 0;
lightOneCount=0;
}
}

void lightOff()
{
for (int y=0; y <=29; y++)
{
channel=y;
Tlc.set(channel, 0);
}
Tlc.update();
}

void lightFade()
{
if (fadeCount==0)
{
unsigned long currentMillis = millis();
for (int z=0; z <=4095; z=z)
{
currentMillis2 = millis();
for (int y=0; y interval2)
{
previousMillis2 = currentMillis2;
z=z+5;
Tlc.update();
}
}

for (int z=4095; z >=0; z=z)
{
currentMillis = millis();
for (int y=0; y interval)
{
previousMillis = currentMillis;
z=z-5;
Tlc.update();
}
}

for (int z=0; z <=4095; z=z)
{
currentMillis2 = millis();
for (int y=0; y interval2)
{
previousMillis2 = currentMillis2;
z=z+5;
Tlc.update();
}
}
fadeCount=1; // go through loop once and leave leds on if light level low enough.
}
}

void lightOneataTime()

{
// light one led at a time until all are lit.
if (lightOneCount<=2)
{
for (int y=0; y <=29; y++)
{
channel=y;
Tlc.set(channel, 4095);
Tlc.update();
delay(90);
}

if (lightOneCount=0; y–)
{
channel=y;
Tlc.set(channel, 0);
Tlc.update();
delay(90);
}
}
lightOneCount++;
}
}

void blinkInterrupt()

{
unsigned long currentMillis3 = millis();
if (currentMillis3 – previousMillis3 > interval3)
{
state = !state;
bpCount++;
previousMillis3=currentMillis3;
}
}

void lightBlink()
{
if (blinkCount <= 4)
{
for (int y=0; y <=29; y++)
{
channel=y;
Tlc.set(channel, 4095);
}
Tlc.update();
delay(400);
}
if (blinkCount <= 3)
{
for (int y=0; y <=29; y++)
{
channel=y;
Tlc.set(channel, 0);
}
Tlc.update();
delay(400);
}
blinkCount++;
}

About these ads

3 comments

  1. would you please share schematic?


  2. I added a rough schematic based on the one from Arduino. Look at the photos to see it.


    • Thanks for sharing I will build this cricuit this coming weekend.
      Next, how about: Auduino mega, touch screeen, and brushed motor. please email to me your decision.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: