Show Posts
Pages: 1 [2]
16  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: October 08, 2011, 09:55:53 pm
Ok, and you want to  move the  bytes down the page now, vs across the page.
You need to flip your loop around so that happens, and rotate the pattern with it.

Try this:
make z go up 10
make y go up to 8
swap x & y in these two

          byte temp = patterns [ x ] [ y ];
          byte temp_2=patterns [ x+1 ] [ y ];

What you to end up with is writing a byte (which you need as the vertical column of a letter now vs the horizontal row)
to the shift register, make it show with a low bit from the 4017, turn it off, put out the next column and make it show with the next bit low from the 4017, ...

Ok, If I'm doing what you said right it's not working.  It makes the leds flash very fast with no discernible pattern.  I'll show the code to make sure.  And thanks for the word on the RTC.  And thanks Nick, I'll try that change.

Code:
int DataPin = 9;
int LatchPin = 11;
int ClockPin = 10;
int clock = 13;
int Reset = 12;
//x,y for the loop
int x;
int y;
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures

#define space   {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define degree {B00000000,B00001110,B00001010,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define F          {B00000000,B01111110,B01000000,B01000000,B01111100,B01000000,B01000000,B01000000,B01000000,B00000000}

byte digits [10] [10] = {
 {B00000000,B00111100,B01000110,B01001010,B01001010,B01001010,B01010010,B01100010,B00111100,B00000000},
 {B00000000,B00001000,B00011000,B00001000,B00001000,B00001000,B00001000,B00001000,B00011100,B00000000},
 {B00000000,B00111100,B01000010,B00000100,B00001000,B00010000,B00100000,B01000000,B01111110,B00000000},
 {B00000000,B01111110,B00000010,B00000010,B00011100,B00000010,B00000010,B01000010,B00111100,B00000000},
 {B00000000,B00000100,B00001100,B00010100,B00100100,B01000100,B01111110,B00000100,B00000100,B00000000},
 {B00000000,B01111110,B01000000,B01000000,B00111100,B00000010,B00000010,B00000010,B01111100,B00000000},
 {B00000000,B00111100,B01000000,B01000000,B01111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B01111110,B00000010,B00000100,B00001000,B00010000,B00010000,B00010000,B00010000,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B00111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B01000010,B00111110,B00000010,B00000010,B00111100,B00000000},
};

const int numPatterns = 5;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={space,space,degree,F};// the patterns order

void setup(){
  pinMode(DataPin,OUTPUT);
  pinMode(ClockPin,OUTPUT);
  pinMode(LatchPin,OUTPUT);
  //simple stuff here
 pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  //reseting the 4017 IC, you have to do this
 digitalWrite(Reset,HIGH);
  delayMicroseconds(5);
  digitalWrite(Reset,LOW);
}

void display_pattern(int loops)//int loop acts like a delay, it take 8 mSecands to scan all of the rows so int loops = 15 is a good time for it
{
  for(x=0;x<numPatterns-1;x++){ // loop over the patterns
   for (int z=0;z<10;z++){ //scrolls one bite at a time
    for(int t=0;t<loops;t++){// the delay we get with loops
     for(y=0;y<8;y++){// loops over the array of bytes
     byte temp = patterns[y][x];
     byte temp_2=patterns[y+1][x];
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,((temp<<z)+(temp_2>>7-z)));//writes digital outputs, Z is for how much bites it need to scroll
          digitalWrite(LatchPin, 1);
      delayMicroseconds(800);
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
      digitalWrite(LatchPin, 1);
     digitalWrite(clock,HIGH);
     digitalWrite(clock,LOW);
   }
  }
 }
}
}

void loop(){
 
 
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin); 
 
 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage /= 1024.0;
 
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
 
 // now convert to Fahrenheight
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 
 delay(1000);                                     //waiting a second
 
 int temp = temperatureF;  // or whatever from the temperature sensor
 
 char buf [3];  // holds 3 digits plus terminator
 
 sprintf (buf, "%02i", temp);  // turn temperature into a string
 
 // copy the bit patterns for each digit (digit 0, 1, 2)

 for (byte i = 0; i < 2; i++)
   memcpy (&patterns [i], &digits [buf [i] - '0'], 10);
   
 display_pattern(15);
}
17  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: October 08, 2011, 05:55:33 pm
Has anyone worked with a DS1307 RTC before?  I would also like to scroll the time with the temp and add some buttons to fix the time so a computer is not needed.  How can I add a clock code to the code i have?  Can this easily be done?

Quote
Code:
byte patterns[numPatterns][10]={space,degree,F};// the patterns order

I see you have changed it to 2 digits (let's hope it doesn't get over 99 F eh?).

You need to allow for the two digits, eg.

Code:
byte patterns[numPatterns][10]={space, space, degree, F};// the patterns order



sorry that image was so big.  Your idea worked though, I didn't allow for the 2 digits.  I did change the temp to 2 digits because the display always had a "0" before the 2 digit temp.  I can now display the "degrees F."  So, I'm understanding better now.  Thanks guys
18  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: October 08, 2011, 03:13:52 pm
Quote
How can I add "degree symbol" and "F" after the temp?
Define them exactly like you did the numbers.

I tried that, but i must have done it wrong.  This is what i tried:

Code:
int DataPin = 9;
int LatchPin = 11;
int ClockPin = 10;
int clock = 13;
int Reset = 12;
//x,y for the loop
int x;
int y;
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures

#define space   {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define degree {B00000000,B00001110,B00001010,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define F          {B00000000,B01111110,B01000000,B01000000,B01111100,B01000000,B01000000,B01000000,B01000000,B00000000}

byte digits [10] [10] = {
 {B00000000,B00111100,B01000110,B01001010,B01001010,B01001010,B01010010,B01100010,B00111100,B00000000},
 {B00000000,B00001000,B00011000,B00001000,B00001000,B00001000,B00001000,B00001000,B00011100,B00000000},
 {B00000000,B00111100,B01000010,B00000100,B00001000,B00010000,B00100000,B01000000,B01111110,B00000000},
 {B00000000,B01111110,B00000010,B00000010,B00011100,B00000010,B00000010,B01000010,B00111100,B00000000},
 {B00000000,B00000100,B00001100,B00010100,B00100100,B01000100,B01111110,B00000100,B00000100,B00000000},
 {B00000000,B01111110,B01000000,B01000000,B00111100,B00000010,B00000010,B00000010,B01111100,B00000000},
 {B00000000,B00111100,B01000000,B01000000,B01111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B01111110,B00000010,B00000100,B00001000,B00010000,B00010000,B00010000,B00010000,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B00111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B01000010,B00111110,B00000010,B00000010,B00111100,B00000000},
};

const int numPatterns = 5;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={space,degree,F};// the patterns order

void setup(){
  pinMode(DataPin,OUTPUT);
  pinMode(ClockPin,OUTPUT);
  pinMode(LatchPin,OUTPUT);
  //simple stuff here
 pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  //reseting the 4017 IC, you have to do this
 digitalWrite(Reset,HIGH);
  delayMicroseconds(5);
  digitalWrite(Reset,LOW);
}

void display_pattern(int loops)//int loop acts like a delay, it take 8 mSecands to scan all of the rows so int loops = 15 is a good time for it
{
  for(x=0;x<numPatterns-1;x++){ // loop over the patterns
   for (int z=0;z<8;z++){ //scrolls one bite at a time
    for(int t=0;t<loops;t++){// the delay we get with loops
     for(y=0;y<10;y++){// loops over the array of bytes
     byte temp = patterns[x][y];
     byte temp_2=patterns[x+1][y];
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,((temp<<z)+(temp_2>>7-z)));//writes digital outputs, Z is for how much bites it need to scroll
          digitalWrite(LatchPin, 1);
      delayMicroseconds(800);
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
      digitalWrite(LatchPin, 1);
     digitalWrite(clock,HIGH);
     digitalWrite(clock,LOW);
   }
  }
 }
}
}

void loop(){
 
 
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin); 
 
 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage /= 1024.0;
 
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
 
 // now convert to Fahrenheight
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 
 delay(1000);                                     //waiting a second
 
 int temp = temperatureF;  // or whatever from the temperature sensor
 
 char buf [3];  // holds 3 digits plus terminator
 
 sprintf (buf, "%02i", temp);  // turn temperature into a string
 
 // copy the bit patterns for each digit (digit 0, 1, 2)

 for (byte i = 0; i < 2; i++)
   memcpy (&patterns [i], &digits [buf [i] - '0'], 10);
   
 display_pattern(15);
}
19  Using Arduino / LEDs and Multiplexing / 8x10 LED Matrix schematic on: October 08, 2011, 03:05:01 pm
Here is the schematic I used:

Thanks
20  Using Arduino / LEDs and Multiplexing / How to change the direction of the scrolling temp and add "degrees F" after it? on: October 08, 2011, 11:38:36 am
Thanks Nick, that worked great. But now I have 2 questions:

1. i have a 8x10 matrix and the words scroll across the rows (8 wide).  I want to have the matrix on its side (10x8)  How do I change the code to make  the words (temp) scroll across the long ways (10 wide)?

2. With this code I have just the temperature scrolling.  How can I add "degree symbol" and "F" after the temp?
Thanks

Code:
int DataPin = 9;
int LatchPin = 11;
int ClockPin = 10;
int clock = 13;
int Reset = 12;
//x,y for the loop
int x;
int y;
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures

#define space {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}

byte digits [10] [10] = {
 {B00000000,B00111100,B01000110,B01001010,B01001010,B01001010,B01010010,B01100010,B00111100,B00000000},
 {B00000000,B00001000,B00011000,B00001000,B00001000,B00001000,B00001000,B00001000,B00011100,B00000000},
 {B00000000,B00111100,B01000010,B00000100,B00001000,B00010000,B00100000,B01000000,B01111110,B00000000},
 {B00000000,B01111110,B00000010,B00000010,B00011100,B00000010,B00000010,B01000010,B00111100,B00000000},
 {B00000000,B00000100,B00001100,B00010100,B00100100,B01000100,B01111110,B00000100,B00000100,B00000000},
 {B00000000,B01111110,B01000000,B01000000,B00111100,B00000010,B00000010,B00000010,B01111100,B00000000},
 {B00000000,B00111100,B01000000,B01000000,B01111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B01111110,B00000010,B00000100,B00001000,B00010000,B00010000,B00010000,B00010000,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B00111100,B01000010,B01000010,B01000010,B00111100,B00000000},
 {B00000000,B00111100,B01000010,B01000010,B01000010,B00111110,B00000010,B00000010,B00111100,B00000000},
};

const int numPatterns = 3;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={space};// the patterns order

void setup(){
  pinMode(DataPin,OUTPUT);
  pinMode(ClockPin,OUTPUT);
  pinMode(LatchPin,OUTPUT);
  //simple stuff here
 pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  //reseting the 4017 IC, you have to do this
 digitalWrite(Reset,HIGH);
  delayMicroseconds(5);
  digitalWrite(Reset,LOW);
}

void display_pattern(int loops)//int loop acts like a delay, it take 8 mSecands to scan all of the rows so int loops = 15 is a good time for it
{
  for(x=0;x<numPatterns-1;x++){ // loop over the patterns
   for (int z=0;z<8;z++){ //scrolls one bite at a time
    for(int t=0;t<loops;t++){// the delay we get with loops
     for(y=0;y<10;y++){// loops over the array of bytes
     byte temp = patterns[x][y];
     byte temp_2=patterns[x+1][y];
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,((temp<<z)+(temp_2>>7-z)));//writes digital outputs, Z is for how much bites it need to scroll
          digitalWrite(LatchPin, 1);
      delayMicroseconds(800);
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
      digitalWrite(LatchPin, 1);
     digitalWrite(clock,HIGH);
     digitalWrite(clock,LOW);
   }
  }
 }
}
}

void loop(){
 
 
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin); 
 
 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage /= 1024.0;
 
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
 
 // now convert to Fahrenheight
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 
 delay(1000);                                     //waiting a second
 
 int temp = temperatureF;  // or whatever from the temperature sensor
 
 char buf [3];  // holds 3 digits plus terminator
 
 sprintf (buf, "%02i", temp);  // turn temperature into a string
 
 // copy the bit patterns for each digit (digit 0, 1, 2)

 for (byte i = 0; i < 2; i++)
   memcpy (&patterns [i], &digits [buf [i] - '0'], 10);
   
 display_pattern(15);
}
21  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: October 08, 2011, 12:29:55 am
Thanks so much for your time.  I'll try it out. 
~Matt
22  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: October 07, 2011, 01:51:54 pm
OK, I'm still stuck.  I added a shift register and it works great.  Now I really want it to scroll the temperature from a TMP36.  I have tried for some time now and I need help with the code.  And can someone tell me how to tweak the code to make it scroll lengthwise?  Thanks
23  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 Question on: September 29, 2011, 12:46:46 pm
Hey again,
     I hope you don't feel you are repeating yourself.  I guess I know less about this than I thought, but I would really like to learn.  I read up on strings but it's not quite clicking with me.  I just don't understand how to make the Matrix read and scroll the temp from the tmp36.  Can you maybe give more clear instruction?  I have scoured the internet looking for an example with no luck.

Here's the code i'm working from.
Code:
int DataPin = 9;
int LatchPin = 11;
int ClockPin = 10;
int clock = 13;
int Reset = 12;
//x,y for the loop
int x;
int y;
// here the definion of all the letter(big ans small) and numbers  (I took out the letters to save space in the forum.)

#define space {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define num_0 {B00000000,B00111100,B01000110,B01001010,B01001010,B01001010,B01010010,B01100010,B00111100,B00000000}
#define num_1 {B00000000,B00001000,B00011000,B00001000,B00001000,B00001000,B00001000,B00001000,B00011100,B00000000}
#define num_2 {B00000000,B00111100,B01000010,B00000100,B00001000,B00010000,B00100000,B01000000,B01111110,B00000000}
#define num_3 {B00000000,B01111110,B00000010,B00000010,B00011100,B00000010,B00000010,B01000010,B00111100,B00000000}
#define num_4 {B00000000,B00000100,B00001100,B00010100,B00100100,B01000100,B01111110,B00000100,B00000100,B00000000}
#define num_5 {B00000000,B01111110,B01000000,B01000000,B00111100,B00000010,B00000010,B00000010,B01111100,B00000000}
#define num_6 {B00000000,B00111100,B01000000,B01000000,B01111100,B01000010,B01000010,B01000010,B00111100,B00000000}
#define num_7 {B00000000,B01111110,B00000010,B00000100,B00001000,B00010000,B00010000,B00010000,B00010000,B00000000}
#define num_8 {B00000000,B00111100,B01000010,B01000010,B00111100,B01000010,B01000010,B01000010,B00111100,B00000000}
#define num_9 {B00000000,B00111100,B01000010,B01000010,B01000010,B00111110,B00000010,B00000010,B00111100,B00000000}
#define times {B00000000,B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000,B00000000}

const int numPatterns = 17;//this is the number of patterns you want to display
byte patterns[numPatterns][10]={space,M,A,D,E,space,B,Y,space,V,A,D,I,M,space};// the patterns order
void setup(){
  pinMode(DataPin,OUTPUT);
  pinMode(ClockPin,OUTPUT);
  pinMode(LatchPin,OUTPUT);
  //simple stuff here
 pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  //reseting the 4017 IC, you have to do this
 digitalWrite(Reset,HIGH);
  delayMicroseconds(5);
  digitalWrite(Reset,LOW);
}

void display_pattern(int loops)//int loop acts like a delay, it take 8 mSecands to scan all of the rows so int loops = 15 is a good time for it
{
  for(x=0;x<numPatterns-1;x++){ // loop over the patterns
   for (int z=0;z<8;z++){ //scrolls one bite at a time
    for(int t=0;t<loops;t++){// the delay we get with loops
     for(y=0;y<10;y++){// loops over the array of bytes
     byte temp = patterns[x][y];
     byte temp_2=patterns[x+1][y];
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,((temp<<z)+(temp_2>>7-z)));//writes digital outputs, Z is for how much bites it need to scroll
          digitalWrite(LatchPin, 1);
      delayMicroseconds(800);
      digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
      digitalWrite(LatchPin, 1);
     digitalWrite(clock,HIGH);
     digitalWrite(clock,LOW);
   }
  }
 }
}
}

void loop(){
 display_pattern(15);// calls for the display_pattern function and says that int loop = 15(if you do more loop the pattern whould scrrol slower).
}

The example code from the TMP36 i have used in the past is found at http://www.ladyada.net/learn/sensors/tmp36.html

I really appreciate any help making this more clear so i can move on with my project.
24  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 on: September 28, 2011, 01:51:32 pm
Ok, so I'm working off the code the Instructables guy gave and i'm trying my best to figure it out.  I think I understand most of it.  But i don't understand how I can take a value from the temp sensor and assign it a pattern array.  I have a video of me testing it    So now I want to add a shift register and figure out how to make it scroll lengthwise and have it on it's side.  i know I'll have to change the "font."  After reading your website, i hope I made it correctly.  Do you know of a site that clearly explains how a sensor value like temp or time can be assigned to the right bit pattern to represent it's number?  Or an example code to learn from?  Thank you
25  Using Arduino / LEDs and Multiplexing / Re: 8x10 LED Matrix with TMP36 and DS1307 on: September 28, 2011, 11:58:48 am
I'll look into it.  Thanks for the help. smiley
26  Using Arduino / LEDs and Multiplexing / 8x10 LED Matrix with TMP36 and DS1307 Question on: September 27, 2011, 04:40:59 pm
Hi, this is my first time writing in a forum.  I am making an 8x10 LED Matix with a shift register from http://www.instructables.com/id/810-LED-Matrix-with-4017/.  When finished I would love to have it show the temp with my TMP36 and possibly the time with my DS1307 Time IC.  But I am so confused about how i would code that.  I have used the TMP36 on a LCD but not a LED Matrix.  Can anyone help me with the coding for that or show me where I can learn how to get data from the IC's and show it on my matrix?  I have tried my best looking online for answers but have came up short.  This would be a great help.  Thank you.
Pages: 1 [2]