Go Down

Topic: ATtiny45 using VirtualWire Library!!!!! (Read 5990 times) previous topic - next topic

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

ThievingSix

#1
Feb 20, 2013, 12:02 pm Last Edit: Feb 20, 2013, 12:18 pm by ThievingSix Reason: 1
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.

http://mchr3k-arduino.blogspot.com.au/2012/01/wireless-sensor-node-part-2.html

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.

jin_3209

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

ThievingSix

#3
Feb 20, 2013, 12:44 pm Last Edit: Feb 21, 2013, 11:31 am by ThievingSix Reason: 1
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

Code: [Select]
#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
Code: [Select]
#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);
}
}


jin_3209

wat version of arduino is best suited in Manchester??

ThievingSix

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

jin_3209

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 ?

jin_3209

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

ThievingSix

#8
Feb 21, 2013, 11:32 am Last Edit: Feb 21, 2013, 11:59 am by ThievingSix Reason: 1
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
https://github.com/mchr3k/arduino-libs-manchester

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

kowalski

#9
Mar 02, 2013, 11:05 pm Last Edit: Mar 02, 2013, 11:15 pm by kowalski Reason: 1

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

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: https://github.com/mikaelpatel/Cosa 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.

Goulaf

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

http://www.youtube.com/watch?v=bLLzRRX8a60

Go Up