Interfacing with a SURE DC-SS500 Tem & RH Module


The SURE DC-SS500 is a temperature and relative humidity module which as of this date is readily available on eBay and inexpensive ($15 including shipping).

The interface is via serial at 9600 baud, SPI or via analog. It is packaged as a 24 pin DIP, but unfortunately, it is a full inch wide and thus is somewhat difficult to work with on a standard solderless breadboard. At Ralf Kramer's site, he has excellent photos which show that he opted to hang the module off the breadboard. I opted to place it on the same style solderless breadboard, leaving me with only a single row of holes on one side of the module. Connections on the other side were made on the underside of the module.

There are seven GND points and I first started with only one point connected to ground. However, I did meter it and discovered that not all of these grounds are interconnected on the module and thus took the time to connect a ground to each of these seven points.

Ralf Kramer's Website


Arduino - Serial Interface using TxD and RxD

/*
Program DC_SS500_1.pde (Arduino - 328)
 
Illustrates how to inteface with the Sure Electronics DC-SS500 Temperature and Relative
Humidy Module using the serial TXD and RXD interface at 9600 baud.

 ARDUINO                             DC-SS500

 PIN 3 ---------------------------> RxD (term 3)
 
 PIN0 <---------------------------- TxD (term 0)

Note that I opted to use the Software Serial on Pin2 for sending to the module but used the 
normal serial on Pin0 for receiving data.  This affords the use of the Arduino's UART.

The program measures and displays temperature in degrees F and relative humidity. 

This program can be improved by dealing with such error conditions as the receipt of
no response from the module or a response other than 079Fahrenheit or 056%RH.

I tested this with relatively short direct wire connections.  The range could be extended
to some 4000 feet using a pair of ADM485 transceivers.

copyright, Peter H Anderson, Baltimore, MD June 1, '10

*/

#include <SoftwareSerial.h>

#define rxPin 12 // actually, I am not using a rxPin
#define txPin 2

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

int get_str(char *s, int ms);
int str_to_int(char *s);

void setup() 
{
  // define pin modes for tx, rx, led pins:
  pinMode(txPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  Serial.begin(9600);
}

void loop() 
{
    char s[30];
    int T, RH;
    
    // measure and display the temperature in degrees F
    Serial.flush();  // clear the Rx UART   
    mySerial.println("$sure temp -f");
    get_str(s, 100);
    T = str_to_int(s);    
    Serial.print("T_F = ");
    Serial.print(T);
    Serial.print("   ");
    
    // Now the same for the relative humidity,
    Serial.flush();  // clear the Rx UART   
    mySerial.println("$sure humidity");
    get_str(s, 100);
    RH = str_to_int(s);    
    Serial.print("RH = ");
    Serial.println(RH);    
        
    delay(5000);
    
} 

int str_to_int(char *s)
{  // assummes the firt three characters are numeric 
   int v = 0, n;
   
   for (n=0; n<3; n++)
   {
       v = v * 10 + (s[n] - '0');
   }
   return(v);
} 

int get_str(char *s, int ms)
{
    char ch;
    int n=0;
    
    while(ms--)
    {
       while (Serial.available() > 0) 
       {
           ch = Serial.read();
           if ((ch == 0x0a) || (ch == 0x0d)) // CR or LF
           {
              s[n] = 0; // null terminate the string
              return(n);
           }
           else
           {
              s[n] = ch;
              //Serial.print(".");
           }
           
           ++n;
         
           if (n>30)
           {
               return(0); // intended as error indicator
           }
       }
       delay(1);
    }
    return(0);  // indicates error
}