Two ATtiny45 communication project

Hello. A friend of mine and I have a small school project, and could use some help.

One of the goals of the project is to establish a communication of two ATtiny45s such that the tiny with a transmitter on it would send data (lets say number one) constantly and the other tiny with a receiver and a buzzer would signal if the communication stopped for more than 5 seconds.

We bought the cheapest transmitter + receiver (433 MHz) from ebay, and managed to use it with Virtual Wire library on Arduino UNO R3, but the problem occurs with receiver, because to check whether the communication stopped we must use a timer interrupt every five seconds, but VW lib also uses timer interrupt, so we get a conflict somehow.

We also saw on the forum that it is not possible to import VW to tiny (http://forum.arduino.cc/index.php?topic=149928.0, someone made an alternative library that works for ATtiny85). We decided to try to make a small improvised library, that could work for ATtiny45, would only need to send and receive one type of message (just to establish a connection, e.q. constantly sending "a" or something easier) and could easily be made to work well with the simple timer interrupt so we could check the number of received messages every 5 seconds.

Any help would be appreciated. Thank you!

P.S. Because we don't know that much about timer interrupts, we just copy-pasted the interrupt found here: http://www.hobbytronics.co.uk/arduino-timer-interrupts, and managed to make it do interrupts every five seconds.

Hi,
What ELSE does the receiver Tiny need to do??

Maybe you don’t NEED an interrupt… See “Blink Without Delay” on the EXAMPLES part of your Arduino IDE…

Maybe read this thread and see if the links from it go anywhere interesting.

@terryking228: Nothing more for now, just to see if the connection broke within five seconds, and signaling so with a buzzer. I forgot all about it, thank you. But still remains the problem with VW, and making an alternative library compatible with ATtiny45 just to establish a connection. We don't need to use most of the VW features. We only need to send one message, over and over again, and find a way to decipher it with a receiver.

@Riva: I already posted that link in the thread. :)

robotsftw: @terryking228: Nothing more for now, just to see if the connection broke within five seconds, and signaling so with a buzzer. I forgot all about it, thank you. But still remains the problem with VW, and making an alternative library compatible with ATtiny45

So, you removed your 5-second interrupt and VW still does not work on the ATtiny?

robotsftw:
@Riva: I already posted that link in the thread. :slight_smile:

Duh.
The youtube link to here gives the impression the Manchester library will work on the tiny85 & tiny45. Are you saying it does not?

These are the errors I get when compiling with the manchester library: http://pokit.org/get/?a9151c31bd9e201115b9530d694f5da5.jpg

The library works great when I use two arduinos, but I can't upload the code for transmitting nor for receiving data on the tiny.

This guy here claims that his project worked with cores found here, but I really don't know where to put these. I tried the hardware directory (I only have a folder named attiny there, which I got when following the shrinkify project on high-low tech group), but still it wouldn't compile.

Any other ideas, or advice would be appreciated. Thank you!

I just downloaded the tiny core from here and followed the README file contained within the zip file to install the core and edit the boards.txt file. Then I downloaded manchester library from here and extracted it to the usual projects\libraries folder and renamed the extracted folder to manchester. When I load either the TX Check or RX Check examples included with the manchester library and select the tiny84@8MHz as the target board it compiles fine. I don't have hardware here to test it with though.

I would like to thank all of you for the help, especially Riva. If someone finds himself in the same trouble I would like to explain exactly what we did to solve the problem.

First of all, we used this TX-RX link.

We then used what Riva said could compile, but with those core files, even though it compiled well, for some reason it wouldn't work. Then we tried the core files (and fallowed the Read Me in the "tiny" folder) found in the youtube video description here.

We are now facing with a couple of clock problems, because delay(1000) doesn't exactly last for 1s, but instead depending on which speed we choose for the Manchester (MAN_300, MAN_600, etc) it varies. We will try to scale that, and experiment further, and if we find anything more of use, we'll make sure to post it here. :)

Could you post your code?

I must be misunderstanding how those transmitters work. Similar transmitters that I’ve seen work very much like a garage door opener control. In two main versions - momentary or latching…much like a connected button, but wireless. So, you wouldn’t need to do much different than if you wanted to keep an LED lit “while” a button was being pressed. .

Also, I forgot to mention that the main problem occurred because while doing the high-low tutorial, the core files for the tiny were located in hardware/attiny, and we needed to put new core files into hardware/tiny. Because we didn’t delete the attiny folder, there was some interference going on, so we couldn’t compile most of the sketches…

The code is almost identical to the examples code:

#include <Manchester.h>

const int TX_PIN = 2;  //pin where your transmitter is connected

void setup() {
  man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
  man.setupTransmit(TX_PIN, MAN_600);
}

void loop() {
  man.transmit(24); //using 24 because it's my favorite number ^^
}
#include <Manchester.h>

const int buzzer = 2;
const int RX_PIN = 3;

int counter = 0;
unsigned long prevMillis = 0;

void setup() {
  pinMode(buzzer, OUTPUT);  
  man.setupReceive(RX_PIN, MAN_600);
  man.beginReceive();
}

void counterChecker()
{
  if(counter == 0) 
  {
    digitalWrite(buzzer, HIGH); //this is the alarm
    delay(2000);                 //only made it two seconds long for testing
    digitalWrite(buzzer, LOW);
  }
  counter = 0;
}


void loop() {
  if (man.receiveComplete()) 
  {
    uint16_t received = man.getMessage();
    man.beginReceive(); //start listening for next message right after you retrieve the message
    if(received == 24) //checking if 24 is received (favorite number)
    {
      counter++;
    }
  }
  
  if(millis() - prevMillis >= 5000)
  {
    prevMillis = millis();
    counterChecker();
  }
}

Hi, you just need to use this to control correctly your Attiny with the arduino ide https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0015.zip

And this to send-recieve (it's the manchester library) https://github.com/mchr3k/arduino-libs-manchester

Easy with this informations ! :)