I wanted to display my weather station data in other rooms in my house without using wires:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291352241/3#3
I chose a simple and cheap(AUD5.6 for tx/rx pair) 433.92 MHz link:
They are really only meant for things like a garage door controller.
The frequency response is very limited, I run them at 2000 b/sec.
I use VirtualWire(modified) library for the Transmitter which uses a ATmega328:
//Transmitter. Sends integer as 2 bytes once per second
#include <VirtualWire.h>
#undef rounduint16_t data =0; //the integer to send
void setup()
{
vw_set_tx_pin(4);
vw_setup(); // 2000 Bits per sec
}void loop()
{
data +=1;
uint8_t number[2] ;
number[0] = data;
number[1] = data >> 8; //send 2 bytes
vw_send(number, 2);
vw_wait_tx(); // Wait until the whole message is gone
delay(1000); //send every second
}
I further modified this library to get VirtualWireTiny library to work with the ATtiny85.
It handles receive only at 2000 b/sec.
The display is 4 digits of 7 segments. I use my SEVENtiny library.
http://arduino.cc/forum/index.php/topic,7866.0.html
The receive code is very simple for the ATtiny85 RX:
//Receiver. Waits to receive two bytes. Displays the integer.
#include <SEVENtiny.h>
#include <VirtualWireTiny.h>
#undef roundvoid setup()
{
vw_set_rx_pin(3);
vw_setup(); // 2000 Bits per sec
vw_rx_start(); // Start the receiver PLL running
}//end of setupvoid loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];//message length defined as 12 bytes
uint8_t buflen = VW_MAX_MESSAGE_LEN;vw_rx_start(); // Start the receiver PLL running
if (vw_get_message(buf, &buflen)) // Non-blocking
{
uint16_t data = buf[1];
data =(data << 8) | buf[0];
SEVENtiny.displayI(data);
vw_rx_stop();
}//end of got data
}//end of loop
This code only uses 1756 bytes of Flash.
To program the ATtiny85 I use:
http://arduino.cc/forum/index.php/topic,59968.0.html
The lfuse must be set to 0xE2.
Download tinyRFlink.zip from: