ATtiny45 using VirtualWire Library!!!!!

Good Day Ma'am Sir!!!
I'm using virtualwire for connecting 2 arduino's using 433MHz tx rx modules. However, I'm doing the "shrinkify your project" on the transmitter side so that I will not use arduino anymore and instead use ATtiny45. but the virtualwire library won't upload in the ATtiny45. How can I program this IC with VirtualWire without touching/reprogramming the receiver side ? thanks for your help :slight_smile:

You'll need to use the Manchester library. I'm currently in the process of writing a tutorial on how I got it to work. I'll update this post in a few days with the link if your still interested.

http://mysudoku.googlecode.com/files/manchester.zip

For both the receiving and transmitting ends. VirtualWire won't work with the tiny's. I came across the same problem. You can read more here.

On a side note, i couldn't get the github version of that library to work, so i'm using the older version, posted above.

thnx ThievingSix!!!
will work on it now HOPE it will be ok!!!
can you send me code for tx and rx ? :slight_smile:
tx side ATTiny45 ---> button press
rx side arduino ----> output beeper
tnx using manchester

The code I'm using is essentially the same as the library examples with a few modifications. It turns an led on the Rx on for a second and then off for a second.
Tx

#include <MANCHESTER.h>

#define TxPin 4  //the digital pin to use to transmit data

unsigned int ON = 1010;  //the 16 bits to send
unsigned int OFF = 0000;  //the 16 bits to send

void setup() 
{  
  MANCHESTER.SetTxPin(TxPin);      // sets the digital pin as output default 4

}

void loop() 
{
       MANCHESTER.Transmit(ON);
      delay(1000);
   
      MANCHESTER.Transmit(OFF);
      delay(1000);

}

Rx

#include <MANCHESTER.h>

#define RxPin 4
#define ledPin 0

void setup() 
{ 
 pinMode(ledPin, OUTPUT);
 MANCHESTER.SetRxPin(RxPin); //user sets rx pin default 4
 MANCHESTER.SetTimeOut(1000); //user sets timeout default blocks
}

void loop() 
{
 unsigned int data = MANCHESTER.Receive();
 if (data == 1010)
 {
   digitalWrite(0, HIGH);
 }
 else
 {
  digitalWrite(0, LOW); 
 }
}

wat version of arduino is best suited in Manchester??

I use the latest version. You'll also need to be sure to Burn the bootloader(so it sets the internal clock of the attiny) at 8Mhz. I used an AtTiny85 for my project.

Be sure to use the cores from d.mellis

http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0015.zip

I think im almost there. last thing that has error is

manchesterR.pde: In function 'void loop()':
manchesterR:20: error: 'lastValue' was not declared in this scope
manchesterR:20: error: 'sensorValue' was not declared in this scope

any help ?

this is the last one...
how to upload Manchester code. in arduino uno ??
it says

In file included from manchesterR.pde:1:
C:\arduino-1.0.3\libraries\MANCHESTER/MANCHESTER.h:49:22: error:
WProgram.h: No such file or directory

My mistake, i've adapted the code slightly, you can remove the line "lastValue = sensorValue;", i forgot to delete that.

If your using the Uno as the Rx or Tx end, you'll need to use the newer version of the Manchester library. The syntax is slightly different. The bottom link shows examples of how to do it. The top link is the new library. You still need to use the older version on the AtTiny45 end. They should be able to transmit to each other. But i can't guarantee it 100% as i haven't tried it. I use two ATTiny85's one for Rx, one for Tx.

https://github.com/mchr3k/arduino-libs-manchester/archive/master.zip

I'll try it tomorrow and see if it works and I'll post here if i get it working.

jin_3209:
Good Day Ma'am Sir!!!
I'm using virtualwire for connecting 2 arduino's using 433MHz tx rx modules. However, I'm doing the "shrinkify your project" on the transmitter side so that I will not use arduino anymore and instead use ATtiny45. but the virtualwire library won't upload in the ATtiny45. How can I program this IC with VirtualWire without touching/reprogramming the receiver side ? thanks for your help :slight_smile:

You could try using the Virtual Wire Interface (VWI) class in Cosa. I have ported the VirtualWire library so that it works with ATtiny85. Depending on the size of the sketch you could also compile for ATtiny45.
Please see: GitHub - mikaelpatel/Cosa: An Object-Oriented Platform for Arduino/AVR and the examples in VWI. There is an example of a sender that transmits messages with 32-bit identity, sequence number and two analog sample values (CosaVWIsender). There is also an example where serial output is redirected over the wireless interface if the is more useful (CosaVWIOtrace). You do not have to have Cosa on both the ATtiny and the Arduino. It is possible to transmit with the Cosa VWI to VirtualWire on Arduino.

Hi !
Just use the librarie and the attiny core files in the description of my video, it works great :smiley: