Arduino Powered Weather Station

Well not really a weather station, it displays the weather and the Arduino part has no idea its displaying weather data..

http://www.82smugglers.com/blog/?p=3

Really nice display.
I'm working on a weather station. It has a classic 2x20 LCD display, use Dallas sensor and send the data to the net thru a Xport AR. Here's the result (graph made with JpGraph).

Tim,

I'm trying to run your code to build a similar kind of thing, but the sketch won't compile for me (using Arduino 0011). First I got this error:

22: error: invalid suffix "b11101100100010" on integer constant

That was on the line:
case 'A': return 0b11101100100010;

So, I changed all the '0b's to B in each of the binary formatted integers for the two switch statements. Then I got this error:

In function 'unsigned int LineOne(char)':
error: 'B11101100100010' was not declared in this scope

I have no idea how to get around that one. Is that even the right syntax? I found a few references to that B prefix instead of 0b, but I'm still pretty new to this so I may be way off.

Here is my modification to the sketch so far:

// definitions for 14 segment chars
unsigned int LineOne(char index) {
  switch (index) {
    case 'A': return B11101100100010;
    case 'B': return B11110010101000;
    case 'C': return B10011100000000;
    case 'D': return B11110010001000;
    case 'E': return B10011100100010;
    case 'F': return B10001100100010;
    case 'G': return B10111100100000;
    case 'H': return B01101100100010;
    case 'I': return B10010010001000;
    case 'J': return B01110000000000;
    case 'K': return B00001101010010;
    case 'L': return B00011100000000;
    case 'M': return B01101101000001;
    case 'N': return B01101100010001;
    case 'O': return B11111100000000;
    case 'P': return B11001100100010;
    case 'Q': return B11111100010000;
    case 'R': return B11001100110010;
    case 'S': return B10110100100010;
    case 'T': return B10000010001000;
    case 'U': return B01111100000000;
    case 'V': return B00001101000100;
    case 'W': return B01101100010100;
    case 'X': return B00000001010101;
    case 'Y': return B00000001001001;
    case 'Z': return B10010001000100;
    default: return B00000000000000;
  }
}

// definitions for 7 segment displays
unsigned int LineTwo(char index) {

 switch (index) {
  case '0': return B1111110;
  case '1': return B0110000;
  case '2': return B1101101;
  case '3': return B1111001;
  case '4': return B0110011;
  case '5': return B1011011;
  case '6': return B0011111;
  case '7': return B1110000;
  case '8': return B1111111;
  case '9': return B1111011;
  case 'H': return B0110111;
  case 'L': return B0001110;
  case '-': return B0000001;
  default: return B0000000;
 }
}

This may help you.

http://www.arduino.cc/en/Reference/Byte

Ok, so from there I see that the B formatter only works on up to 8 bits. The original code went like this:

// definitions for 14 segment chars
unsigned int LineOne(char index) {
  switch (index) {
    case 'A': return 0b11101100100010;
    case 'B': return 0b11110010101000;
    case 'C': return 0b10011100000000;
    case 'D': return 0b11110010001000;
etc...

I can now see that 14 bits are too many to use the B formater. What is this 0b about, and can I use that somehow, or would it be easier for me to just manually reformat those values into another format such as hex or decimal?

Actually, it'll be easy enough to reformat them. Google calculator works very easily.

Thanks for the pointer, I had missed the 8 bit fact on that page somehow.

Ok, I changed this function to define the display elements with hex values, and it compiles and runs properly. I'm sure there are 100 other ways to do this as well, but I don't feel compelled to find them all. :slight_smile:

I now have a display showing text, so I'm happy. Thanks everyone!

// definitions for 14 segment chars
unsigned int LineOne(char index) {
  switch (index) {
    case 'A': return 0x3B22; // 0b11101100100010;
    case 'B': return 0x3CA8; // 0b11110010101000;
    case 'C': return 0x2700; // 0b10011100000000;
    case 'D': return 0x3C88; // 0b11110010001000;
    case 'E': return 0x2722; // 0b10011100100010;
    case 'F': return 0x2322; // 0b10001100100010;
    case 'G': return 0x2F20; // 0b10111100100000;
    case 'H': return 0x1B22; // 0b01101100100010;
    case 'I': return 0x2488; // 0b10010010001000;
    case 'J': return 0x1C00; // 0b01110000000000;
    case 'K': return 0x352;  // 0b00001101010010;
    case 'L': return 0x700;  // 0b00011100000000;
    case 'M': return 0x1B41; // 0b01101101000001;
    case 'N': return 0x1B11; // 0b01101100010001;
    case 'O': return 0x3F00; // 0b11111100000000;
    case 'P': return 0x3322; // 0b11001100100010;
    case 'Q': return 0x3F10; // 0b11111100010000;
    case 'R': return 0x3332; // 0b11001100110010;
    case 'S': return 0x2D22; // 0b10110100100010;
    case 'T': return 0x2088; // 0b10000010001000;
    case 'U': return 0x1F00; // 0b01111100000000;
    case 'V': return 0x344;  // 0b00001101000100;
    case 'W': return 0x1B14; // 0b01101100010100;
    case 'X': return 0x55;   // 0b00000001010101;
    case 'Y': return 0x49;   // 0b00000001001001;
    case 'Z': return 0x2444; // 0b10010001000100;
    default: return 0x0;     // 0b00000000000000;
  }
}

wow.. glad you found the code somewhat helpful. I tried to make it pretty readable.

Yep, it's pretty cool. I have it displaying static data in the sketch ok, but now I'm working on getting your perl code to run on my mac.

I really appreciate you sharing your code with the project!

Hey, nice work on your display!

I'm trying to adapt your code for use in my project. I was wondering if I could get some help.

I've stripped the serial connectivity out of your code because I don't use it. I would really like to be able to display the contents of a array or variable to only one display. I'd like to, for example, do something along these lines:

myarray[] = {
"LINE ONE TEXT","LINE TWO NUMS"
}

Then, just update the contents of the array as I need to change the display. I'm using a pot as a selector knob here is what I'm doing now and it works somewhat

val = analogRead(potPin);
if (val <= 50)
{
  disp[0] ="ONE    ";
  totalsteps = 1000;
}
else if (val >= 51 && val < 100)
{
  disp[0] ="TWO    ";
  totalsteps = 2000;
}
else if (val >= 101 && val < 150)
{
  disp[0] ="THREE  ";
  totalsteps = 3000;
}
else if (val >= 151 && val < 200)
{
  disp[0] ="FOUR   ";
  totalsteps = 4000;
}
else if (val >= 201 && val < 250)
{
  disp[0] ="FIVE   ";
  totalsteps = 5000;
}
else if (val >= 251 && val < 300)
{
  disp[0] ="SIX    ";
  totalsteps = 6000;
}
else if (val >= 301 && val < 350)
{
  disp[0] ="SEVEN  ";
  totalsteps = 7000;
}
else if (val >= 351 && val < 400)
{
  disp[0] ="EIGHT  ";
  totalsteps = 8000;
}
else if (val >= 401 && val < 450)
{
  disp[0] ="NINE   ";
  totalsteps = 9000;
}
else if (val >= 451 && val < 500)
{
  disp[0] ="TEN    ";
  totalsteps = 10000;
 
}
else
{
disp[0] ="HIGH   ";
remStep = 0;
}

All I'm doing is writing to your existing array the text I need updated on display 1, line 1, frame 1.

It's very messy and I'd like to clean it up a bit, but I'm having trouble modifying your code to my needs.

Thanks for your help (and your code :slight_smile: )