Go Down

Topic: 8x10 LED Matrix with TMP36 and DS1307 Question (Read 10898 times) previous topic - next topic


  And do you have any idea how to get rid of that lit LED that always goes before the temp in the display? 

I can't spot the problem, but if you put in some debugging prints you will probably see where it is.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics


I know this is a lot to ask and I'm not sure how well I communicated this, but I would really appreciate some help with the code.

Ok, I know the DS1307 is working and programmed with the current time.  I have been able to scroll the hour or minute but for some reason they are followed by a digit like "8".  I don't know how to make it look normal like with a colon between the hour and minute, and change it to 12 hour with AM and PM and not 24 hour, then date in month/day.  I'm not sure if it is possible but I was also trying to make it play a round of "Conway's Game of Life" after the date.

So, this is my goal.  I want to have my display scroll the temperature with the degrees symbol followed by the time with colon between hour and min and in 12 hour format with AM/PM, followed by the date in month/day.  It would be cool to have it play a round of Game of Life.  Then start back to temperature.   example,  "68o  5:43PM  12/3"  Then "game of life" if possable and back to temp.

The display seems to be trying to display some random data before the temp., because there are random lit LEDs before it.

Specific questions are:
I have working code for "Conway's Game of Life."  How, or is it possible to add it to another program?
How to add things like to colon and dash or any symbol between the sensor's input?
This code makes things scroll.  If I wanted how could I change it to make switch between still images?

I have attached the code i was working with and "Game of Life" code.  It all looks really messy to me and i'm sure most of it needs to be changed or reworked, but it may be close. 

Thank you so much.


Can someone look at this code and tell me if I'm on the right track?  I'm trying to scroll the temp. and time.  I don't know how to add the degress symbol and colon in their proper places.  Thanks and I appreciate your help.

Code: [Select]
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

int adjust = -11;

//Other Symbols

#define degree {B00000000,B01110000,B01010000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define slash {B00000000,B00000100,B00000100,B00001000,B00001000,B00010000,B00010000,B00100000,B00100000,B00000000}
#define dash {B00000000,B00000000,B00000000,B00000000,B01111110,B01111110,B00000000,B00000000,B00000000,B00000000}
#define colon {B00000000,B00000000,B00011000,B00011000,B00000000,B00000000,B00011000,B00011000,B00000000,B00000000}

byte digits [10] [10] = {

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

//For the Time
#include <Wire.h>
#include "RTClib.h"


void setup(){
 //simple stuff here
 //reseting the 4017 IC, you have to do this

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);
     digitalWrite(LatchPin, 0);
    shiftOut(DataPin, ClockPin,MSBFIRST,0);
     digitalWrite(LatchPin, 1);

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 + adjust;

delay(1000);                                     //waiting a second
int temp = temperatureF;  // or whatever from the temperature sensor

char tempa [4];  // holds 3 digits plus terminator

sprintf (tempa, "%3i", temp);  // turn temperature into a string

// copy the bit patterns for each digit (digit 0, 1, 2)

for (byte i = 0; i < 3; i++)
  memcpy (&patterns [i], &digits [tempa [i] - '0'], 10);
DateTime now = RTC.now();

char hour [3];  // holds 3 digits plus terminator

sprintf (hour, "%2i", (now.hour()));  // 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 [hour [i] - '0'], 10);


char minute [3];  // holds 3 digits plus terminator

sprintf (minute, "%2i", (now.minute()));  // 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 [minute [i] - '0'], 10);



so how did your project went..? all done..?
i also wana do the same thing but with the 24X8 led matrix.if u finished the project...can you share the code with me..?

Go Up