Now I have an Arduino RF shield, what next? The Smart Arduino Sensor

After purchasing the Arduino RF Shield, something else came to mind, what can I do with one of them?

Most of our customers bought only one RF Shield each so we asked ourselves what can you use use it for, so we decided to offer something to go along with it. This is how the next idea came along, the RF Shield Arduino compatible Smart Humidity and Temperature sensor.

Now you can program your own sketches straight onto our smart sensors which is fully Arduino IDE compatible. Get the two of them to talk to each other, add more sensors, create a full network of sensors and monitor your environment using Arduino based smart sensors and our Arduino RF Shield.

There are several versions of the Smart Sensor available, one with PCB based antenna, one with external antenna, one version without enclosure and one with a plastic enclosure. The power is given by 2 AA alkaline batteries (not included).

PCB base Humidity Temperature Arduino Sensor


Enclosure Smart Humidity Temperature Arduino Sensor

So, how does it work?

Here is the code to be used with the Arduino 1.0 IDE

// Experiment with time-controlled periodic transmission.
// Temperature and Humidity is sampled every 4 sec and transmitted

#define NODE 25
#define GROUP 4

#include <Ports.h>
#include <RF12.h>

#include <Sensirion.h>

//pin definitions for the SDA & SCL pins
const uint8_t dataPin  =  18;
const uint8_t clockPin =  19;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

MilliTimer sendTimer;
byte pending;
word seqnum;
char buf[20]; /* main buffer for transmission */
char buf_tmp[10]; /* temporary buffer */

char *ftoa(char *a, double f, int precision);

void setup () {
  pinMode(7, OUTPUT); /* led on pin 7 */

  rf12_initialize(NODE, RF12_433MHZ, GROUP); /* initializing radio module */


void loop () {

tempSensor.measure(&temperature, &humidity, &dewpoint);

ftoa(buf, temperature, 2);
ftoa(buf_tmp, humidity,2);
strcat(buf, “C:”);
strcat(buf, “RH%:”);
ftoa(buf_tmp, humidity,2);
strcat(buf, “Dew”);

  if (rf12_recvDone() && rf12_crc == 0 && rf12_len == 2) {


  if (sendTimer.poll(4096))
    pending = 1;

  if (pending && rf12_canSend()) {
    pending = 0;
     digitalWrite(7, LOW);
    //rf12_sendStart(RF12_HDR_ACK, “hello!”, 6);
    rf12_sendStart(RF12_HDR_ACK, buf, 20);
     digitalWrite(7, HIGH);

//this function is  converting a float into a string
char *ftoa(char *a, double f, int precision)
  long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000};

  char *ret = a;
  long units = (long)f;
  itoa(units, a, 10);
  while (*a != ‘\0′) a++;
  *a++ = ‘.’;
  long decimal = abs((long)((f – units) * p[precision]));
  itoa(decimal, a, 10);
  return ret;

Arduino IDE Code can be downloaded from here in *.ino format.

You will also need the following libraries to be copied to your Libraries folder in your Arduino IDE Instalation folder; the Sensirion library and the Jeelink library.

Before you compile de code there is one last change to be made, you will have to define the Smart sensor board in the boards.txt file which can be found in your Arduino Instalation folder for example if is on the disk c:\arduino-1.0\hardware\arduino\boards.txt you will have to add this section at the begining of the file: = Adaptive atmega88p

For your convenience the full boards.txt file with the edit included can be downloaded from here

Now all the prerequisites are in place, we are quite ready to program the sensor, all that is needed is the AVRISP MKII cable needed to program the board.

To receive the data from the sensor just use the Arduino RF Shield and load the pde file available here.

Leave a Reply