Pages: [1]   Go Down
Author Topic: ATtiny45 using VirtualWire Library!!!!!  (Read 4988 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: February 20, 2013, 06:18:51 am by ThievingSix » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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:
#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);
 }
}

« Last Edit: February 21, 2013, 05:31:55 am by ThievingSix » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

wat version of arduino is best suited in Manchester??
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: February 21, 2013, 05:59:25 am by ThievingSix » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 442
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
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.
« Last Edit: March 02, 2013, 05:15:00 pm by kowalski » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: