This is the RF Link Kit in question:
http://www.seeedstudio.com/depot/2km-long-range-rf-link-kits-w-encoder-and-decoder-p-321.html
(2KM Long Range RF link kits w/ encoder and decoder)
I am building a wireless link to be able to remotely monitor a greenhouse temperature. The temperature will be represented by an analogue voltage derived from a thermistor, say in range 0-3V.
I am using an Arduino Mega to convert the analogue input to a digital output and plan to feed this into a wireless board. I then have a matching wireless receiver which feeds a Arduino Duemilanove which is connected to the PC via USB.
The wireless transmitter and receiver work OK over the required distance - I can transmit a binary signal to flash an LED on the receiver, using the following code
// RECEIVER - DUEMILANOVE
void setup()
{
pinMode(A1, INPUT); // Receiver (using analog as digital for convenience)
pinMode(13, OUTPUT);
}
void loop()
{
int sig = digitalRead(A1);
if (sig) {
digitalWrite(13, HIGH);
}
else{
digitalWrite(13, LOW);
}
}
// TRANSMITTER - MEGA
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(50, OUTPUT); // transmitter, digital pin
}
void loop()
{
digitalWrite(50, HIGH);
digitalWrite(13,HIGH);
delay(200);
digitalWrite(50, LOW);
digitalWrite(13,LOW);
delay(200);
}
However I can't figure out how to get it to send a data message representing the analogue signal from the thermistor. My plan was to use virtual wire, but I haven't got the following code to work...
// RECEIVER
#include <VirtualWire.h>
void setup()
{
pinMode(13, OUTPUT);
vw_set_ptt_inverted(true);
Serial.begin(9600);
vw_set_rx_pin(A1);
vw_setup(500);
vw_rx_start();
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen))
{
Serial.print("Got: ");
Serial.print(buf[0]);
digitalWrite(13, HIGH);
delay(100);
}
}
// TRANSMITTER
#include <VirtualWire.h>
void setup()
{
pinMode(13, OUTPUT);
vw_set_ptt_inverted(true);
vw_set_tx_pin(50);
vw_setup(500);
}
void loop()
{
char message = 'test';
vw_send((uint8_t *)&message, strlen(&message));
vw_wait_tx();
digitalWrite(13,HIGH);
delay(400);
digitalWrite(13,LOW);
delay(400);
}
I have read something about soldering the pads on the tx and rx boards but I don't see how this would help transmit a message that will vary according to the analogue input to the Arduino....and then pass this on to the PC to decode and translate into a temperature reading.
Can anyone help ? Thanks in advance