Go Down

Topic: RF link display using the ATtiny85 (Read 17 times) previous topic - next topic

carl47

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:

http://littlebirdelectronics.com/products/433mhz-rf-link-kit

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:

http://www.open.com.au/mikem/arduino/VirtualWire.pdf

Quote

//Transmitter. Sends integer as 2 bytes once per second

#include <VirtualWire.h>
#undef round

uint16_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:

Quote

//Receiver. Waits to receive two bytes. Displays the integer.

#include <SEVENtiny.h>
#include <VirtualWireTiny.h>
#undef round

void setup()
{
    vw_set_rx_pin(3);
    vw_setup();    // 2000 Bits per sec
    vw_rx_start();       // Start the receiver PLL running
}//end of setup

void 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:

http://code.google.com/p/mysudoku/downloads/list

theepdinker

Cool project!

I can think of some ways to use an affordable RF link at 2000 b/s
Occasional activity,
sporadic progress

carl47

Thanks theepdinker.

It does have some limitations like I cant use it to monitor my Oregon weather station.

It uses 433.92 but needs a 10 kb/s to get an output.

WEBAFF

Why you used modified library for the ATmega328 Transmitter? This lib works on it perfectly (at least for me.).

carl47

Yes it works perfectly for me to when I use a 328(with xtal) to TX and a 328(with xtal) to RX.

When I used a ATtiny85 with an internal clock for RX I got a lot of dropouts.
I guessed it was because the setting of Timer1 in VirtualWire was not quite right.

I tried using Timer2 in the 328 transmitter and this seemed to give much more reliable results.




Go Up