Let's Make Robots!

Arduino RF remote LCD display of Temparature & Humidity

Gareth's picture

Aim of Project :- Transmit via RF remote values of Temparature & Humidity to a LCD display.

Why:- because i have always dreaded sending floating point values to a LCD display and

wanted to carve it in stone for other projects i have lined up.

& Why :- RF Links are just so cool 8-P        500ft range is not to be sneezed at......

-------------------------------------------------------------------------------------------------------------------------

 Basic Setup :- 

 

1x Duemilanova ( this will be the remote transmitter with SHT10 sensor attached)

1x SHT 10 (0.5% accuracy) Temparature & Humidity Sensor or SHT 11 ( temp 0.4% accuracy)

1x Arduino Mega (this will be the Receiver with LCD display attached)

1x 2 line LCD display

1x RF Link Receiver

1x RF Link Transmitter

 -------------------------------------------------------------------------------------------------------------------------

Part 1 - The Transmitter Station

--------------------------------------------------------------------------------------------------------------------------

        Temparature & Humidity Sensor

--------------------------------------------------------------------------------------------------------------------------

The SHT10 (its marked ALP10!!!) is a low cost Humidity (0-100%) & Temparature Sensor (-40°C to 123.8°C)

Its a SMD device - here i have soldered it to a some recycled PCB board to make it easier to handle and mount.

Its a pig to extract the data - however i recently found a Library that does all the hard work.

 

 

(Sensor(pin 1 GND)to Arduino GND)
(Sensor(pin 2 DATA)to Arduino(pin 12)) 
(Sensor(pin 3 SCK)to Arduino(pin 13))
(Sensor(pin 4 VDD) to Arduino 3.3V)

 ---------------------------------------------------------------------------------------------------------------------------

       RF Link Transmitter Module

----------------------------------------------------------------------------------------------------------------------------

The Remote Arduino uses a RF Link to transmit data

Just 4 wires using cd audio socket to make neat connection.

Black connected to Ground

White is the transmit data cable connected to pin 3 on the Arduino (however this is easy to re-assign to suit your needs)

Red is the power supply connected to 5 Volt pin on Arduino (actually you can apply anywhere between 2 Volts and 12 Volts - the higher the voltage the stronger the RF signal)

Grey (sticking out of the Top is the Antenna - around 30cm long

-------------------------------------------------------------------------------------------------------------------------------------------

TX Code :- you find below in the attachements (RF_TX_TEMP_HUMIDITY_LMR_Gareth.pde)

Caution  :- you will also have install two libraries VirtualWire.h & SHT1x.h in your hardware/libraries folder.

-------------------------------------------------------------------------------------------------------------------------------------------

 

-------------------------------------------------------------------------------------------------------------------------------------------

Part 2 :- The Receiving LCD Station
-------------------------------------------------------------------------------------------------------------------------------------------
2 Line LCD Display

-------------------------------------------------------------------------------------------------------------------------------------------

The LCD is a basic 2 line display attached to an Arduino Mega

 

 

---------------------------------------------------------------------------------------------------------------------------

RF Link Receiver Module
---------------------------------------------------------------------------------------------------------------------------

Only Four wires are required, i have used a audio cable from a cd drive which i rewired to accept the cables.

Yellow is the Antenna - approx 30cm long (other end connected to thin air)

Red is connected to 5 Volts

White is the Received data (in my case connected to pin 23 on the mega - can be easily assigned to another pin)

Black is Ground (it has three separate ground pins all connected together!!!!!!)

---------------------------------------------------------------------------------------------------------------------------

RX Code :- you find below in the attachements (RF_RX_TEMP_HUMIDITY_LMR_Gareth2.pde)

Caution  :- you will also have install This modified library LCD4Bit_mod.h

or equivilant LCD4Bit.h library to suit your display

---------------------------------------------------------------------------------------------------------------------------

AttachmentSize
RF_TX_TEMP_HUMIDITY_LMR_Gareth.pde2.61 KB
RF_RX_TEMP_HUMIDITY_LMR_Gareth2.pde1.23 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi, i'm trying to use my rf modules to send temp values, but it is not sending nothing.
My temperature sensor the setup described here: http://www.ladyada.net/learn/sensors/thermistor.html

So far i have this program:

// RF Link using VirtualWire to Transmit messages
// simplex (one-way) receiver with a 315MHz RF Link Transmitter module
// tx pin 3 on Duemilanova (arduino)


#include <VirtualWire.h>  // you must download and install the VirtualWire.h to your hardware/libraries folder
#include <stdio.h>
#undef int
#undef abs
#undef double
#undef float
#undef round

// which analog pin to connect
#define THERMISTORPIN A0        
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000     
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25  
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000   

int samples[NUMSAMPLES];
char* buff;

void setup()

{
    Serial.begin(2400);
    analogReference(EXTERNAL);

    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for RF Link module
    vw_setup(2000);                 // Bits per sec
    vw_set_tx_pin(3);                // pin 3 is used as the transmit data out into the TX Link module, change this to suit your needs.
}

void loop()
{

  uint8_t i;
  float average;

  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
   samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  }

  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;

  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;

  float steinhart;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;  // convert to C

  Serial.print("Temperature ");
  Serial.print(steinhart);
  Serial.println(" *C");

  delay(1000);

  sprintf(buff,"Temp:", steinhart);
  const char *msg = buff;       // this is your message to send

   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx();                                          // Wait for message to finish

   delay(200);
}

It is reading and printing the temp value only one time and then it does nothing. Can you help me?

ChuckCrunch's picture

i only used 3 lines of your program man and all my problems were over ,that's good Stuff wow

Gareth's picture

I can only dream to reduce the coding to 3 lines....... thanks for the feedback and good experiences with your project.....

I'm experimenting with this TXs and RXs:

TX+RX: http://www.futuraelettronica.net/pdf_ita/8110-RTFSAW.pdf

RX: http://www.futuraelettronica.net/pdf_ita/8110-AC-RX2.pdf

TX: http://www.futuraelettronica.net/pdf_ita/8110-TX433SAW.pdf

 

Codes:

#include <VirtualWire.h>
void setup()
{
vw_setup(2000); // Bits per sec
pinMode(13,OUTPUT);
}
void loop()
{
const char *msg = "this is a very very very long message i'm sending just for test rather than just saying hello";
vw_send((uint8_t *)msg, strlen(msg));
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,LOW);
delay(2000);



}







#include <VirtualWire.h>
void setup()
{
Serial.begin(9600);
Serial.println("setup");
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
pinMode(13,HIGH);
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
digitalWrite(13,HIGH);
delay(600);
digitalWrite(13,LOW);
delay(100);
if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;
// Message with a good checksum received, dump HEX
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i], HEX);
Serial.print(" ");
}
Serial.println("");
}
}




It does not work, both with separated TX and RX and with same TX/RX on two boards.
What do I miss?


 

Gareth's picture

Firstly i will direct you here to try this code out :-

Arduino RF Comms with RF Link units

Try the code off this link exactly (just remember to alter the pin number that the RX and TX are using) ....... then post your results ....(good or bad)

....... what seems to be missing in your code is the invert protocol ..... on my RF-link units the data signals have to be inverted.

  with this code line somewhere in the setup code :-

vw_set_ptt_inverted(true);    // Required for RX Link Module

maybe this could be your problem - i am not familiar with the modules you are using (i will keep my fingers crossed)

I eventually got it working!

I used the samples source provided with VirtualWire, but I had to connect ALL ground pins of the transceivers, rather than just connecting one of them and supposing all others where internally connected together...

Gareth's picture

Thats good news to hear.......

...... i have to admit when i saw the number of Gnd pins on your module >i was puzzled< ....... as my modules have also way to many.

I guess the Ground between the RX and TX units may have been separated (making them independant)

Good job and thanks for chase_ing up and posting your findings - it will be additional Info/help for others using the :-

RTF-DATA-SAW transceiver modules.     (you will save a lot of head scratching out there)

NB. Having the TX/RX in one unit is quite useful - maybe its worth you posting a tip/walkthrough, as robot_eers are always looking for quick simple comms solutions for data transfer.

As I said, I got RTF-SAW modules working, but I'm still in trouble with separared modules.

In this picture, you see in the first line an RF code I recorded using the AC-RX2 receiver and transmitted by a radio remote control; on second line you see the signal I send to the transmitter.. Last line is what I see on the AC-RX2 receiver!

http://img153.imageshack.us/img153/6688/segnalih.jpg

Which could be the cause?!? I have no oscilloscope to examine emitted RF signal.

Which should be the exact wiring of AC-RX2 receiver? I do not have the suggested "ceramic at least 100.00 pF capacitor) (see datasheet), so I'm using a 0,1 uF electrolitic:is that the same?

 

 

Gareth's picture

Two things 100.00 pf sounds strange (decimalpoint) i would guess 10.000pf which would be 10nf of .01uf  Here for convertion chart

The reason for using ceramic capacitors is that they are bi-polar meaning it does not matter which way round you apply voltage to them - electrolitic capacitors are polarity conscious (on low powerstuff you may get away with it -on  high power they can breakdown on reverse voltage) , from your trace the voltage is AC so needs i am afraid bipolar.

From your trace (thanks for including as it helpl) can you see the lazy ramp up of the RX signal (this is because large capacitors need time to charge) could be this is masking the first bits of the signal,  0.1uf is a tad high.

Secondly are those scale measurments on your scope trace Voltage? as it seams the logic levels are very low or close to the normal switch logic levels (1 off the trace) .

Hi,

the right value is 100000 pF (5 zeroes),as stated in the datasheet: http://www.aurelwireless.com/downloads/manuali-uso/650201133G_mu.pdf  (in italian, don't know if they also have english version).

I'll try sending a long "1" to allow capacitor being charged up.

About my oscilloscope... actually I do NOT have an oscilloscope, I just connected RX pin to MIC-IN of audio card on my PC: it works fine for frequencies up to 20 kHz! ;-) Anyway, I can't know voltage value, just time values, expressed in seconds.