Go Down

Topic: Arduino Due with USB Weatherboard (Read 2203 times) previous topic - next topic


Apr 17, 2013, 01:27 am Last Edit: Apr 17, 2013, 02:46 am by awest5 Reason: 1
Has anyone done this project yet, using the Due with the sparkfun USB weatherboard. I have been trying to get them to work together but there is no code that is designed for the Due with the weatherboard. I must be hooking into the wrong input on the Due. Any help would be great.

Code: [Select]

String weatherSentence = "";  // string to read data from the weather board
int ready = 0;                // used to mark when we have a complete string to process
char data;                    // use to read a byte from the serial
char charArray[100];          // create a char 100 position char array por parsing the data

unsigned long humidity=0, fahrenheit=0, celcius=0, SCPfahrenheit=0, presure=0;

void setup() {
 Serial1.begin(9600);        // starts the second hardware serial port at 9600 to communicate with the weather board
 Serial.begin(9600);         // starts the serial at 9600
 pinMode(48, OUTPUT);        // turn ON the board LED for diagnostics
 digitalWrite(48, HIGH);    

void loop() {
 while(Serial1.available() > 0) {  // if data vailable from the weather board
   data = Serial1.read();          // read it
   if((data != '\n')) {            // if no end of line
     weatherSentence += data;      // add it to the string
   else {  // if end of line reached, readu to parse the buffer
     ready = 1;
 if(ready == 1) {                         // parse the buffer
   if(weatherSentence.startsWith("#")) {  // verify if it is a good reading
     // Serial.println(buffer);           // uncomment just to see what we got
     weatherSentence.toCharArray(charArray, 100);  // get the characters copied into charArray of size 100
     processReading(charArray);           // parse the char array extracting the data
   weatherSentence = "";                  // clean up the string for next reading
   ready = 0;

// function that parses information received in a char array
void processReading(const char packet[]) {
 byte i;
 char* endptr;

 // start parsing
 i = 0;
 humidity = strtod(&packet[i], &endptr);       // next field: humidity

 while(packet[i++] != ','); // next field: fahrenheit
 fahrenheit = strtod(&packet[i], &endptr);

 while(packet[i++] != ','); // next field: celcius
 celcius = strtod(&packet[i], &endptr);

 while(packet[i++] != ','); // next field: SCPfahrenheit
 SCPfahrenheit = strtod(&packet[i], &endptr);

 while(packet[i++] != ','); // next field: presure
 presure = strtod(&packet[i], &endptr);

 while(packet[i++] != ','); // next field: counter

 while(packet[i++] != '$'); // next field: checksum

 Serial.print("humidity: ");
 Serial.print(humidity, DEC);
 Serial.print(" fahrenheit: ");
 Serial.print(fahrenheit, DEC);
 Serial.print(" celcius: ");
 Serial.print(celcius, DEC);
 Serial.print(" SCPfahrenheit: ");
 Serial.print(SCPfahrenheit, DEC);
 Serial.print(" presure: ");
 Serial.println(presure, DEC);


what are your symptoms - hangup, no data, garbled data?  Is the board compatible with 3.3 volt logic on Due?. Are you connected to rx1 and tx1 and you have rx of board to tx of due and visa versa?


Powering the Arduino by USB connection right now. I'm sending 5V from the Arduino to the Weatherboard, and I have the RX-1 from the Weatherboard to the TX1 on Arduino and TX-0 on Weatherboard to RX1 on Arduino. No data being received to the arduino from the Weatherboard.


can the weatherboard communicate at 3.3 volt?  if it is using 5v signals it could fry the Due input rx


Weatherboard is suppose to be operated between 3.7-12V


There is a 3.3V regulator within the board to limit voltage

Coding Badly

Go Up