Introduction: Receiving and Sending Data Between Attiny85 (Arduino IDE 1.06) UPDATED Nov 2015

Picture of Receiving and Sending Data Between Attiny85 (Arduino IDE 1.06) UPDATED Nov 2015

I have struggled a lot with sending RF data between two Attiny85 chips, so I thought it might be helpful if I just explain how I did it. There are a number of such projects being described on the internet, but yet, it didn’t prove to be such a straightforward project, which i found to be mostly due to not using the right libraries and cores.

BOM
Transmitter:
Attiny85 - 0.82 euro/10
10k resistor
433 MHz transmittermodule - 1 euro per set
mini breadboard - 58 cts/piece

Receiver:
Attiny85
10k resistor
433 MHz Receiver module
mini breadboard
Optional: 2 wire LCD

There are two main libraries used to send and receive data on an Arduino platform: VirtualWire and Manchester code.
As Virtualwire is a bit older, no longer supported, and supposedly can only send characters (though there is a way around that) I decided to use Manchester code.

To make a long story short, it didn’t work. I had the MANCHESTER.h and MANCHESTER.cpp file and ran into a lot of trouble, until I discovered that was the wrong/old library, you need the Manchester.h and Manchester.cpp file from here. When I used that I got my transmitter to work, I could send data to an Arduino, that was already a big relief.

However....... whatever I did, I did not get my receiver to work. In testing something on an Attiny it is very frustrating to just stare at an LED that is supposed to light, but doesnt, without knowing what and why and how.
So i decided to add an LCD to the Attiny, so at least I could see what was happening..
However, the LCD on my attiny gave me other problems... and when I solved those, that proved to be the solution for my receive problem as well: I was using the wrong core. I was using the 'tiny core' rather than the 'attiny core'
The latter is the one from Highlowtech.
Also, I programmed the Attiny's with 8MHz internal oscillator by first 'burning the bootloader'

NOTE: it is generally agreed that the 'tiny core' works with the Manchester code and the attiny core does not, so it is possible that I mixed up the two. However, I had a line added to the Attiny core that I forgot about that will make it work with the Manchester code. Open up the "variants/tiny8/pins_arduino.h" file and add the line"#define __AVR_Attinyx5__" (See the picture)

NOTE2: Obviously it also works for the IDE 1.6.x but if you use the tiny core that does not come with a JSON file and as the core file folder structure for 1.6.x is different from 1.0.6 You need to do the install yourself. This website can help you with that. The attiny core comes with a json link that will do the install via the boards manager, but then you have to add the Attiny5__ definition as described above

Step 1: Receiving and Sending Data Between Attiny85: the Transmitter

Picture of Receiving and Sending Data Between Attiny85: the Transmitter

The built of the transmitter is easy:
Plug the attiny chip into your breadboard,
Connect a 433 MHz Transmitter module with its data in to pin PB0 (that is pin 5 on the chip).
Connect Vcc and Ground of the transmitter module to Vcc (pin 8) and ground (pin 4) of the Attiny
Insert a 10 k resistor between pin 1 (Reset) and pin 8 (Vcc)
Connect Vcc and ground to 5 Volt
Take a 17 cm stiff wire and attach that to the antenna hole of the transmitter.
use the following program:

#include <Manchester.h>
/*
Manchester Transmitter example In this example transmitter will send one 16 bit number
per transmission.
Try different speeds using these constants, your maximum
possible speed will depend on various factors like transmitter
type, distance, microcontroller speed, ...
MAN_300 0 MAN_600 1 MAN_1200 2 MAN_2400 3 MAN_4800 4 MAN_9600 5 MAN_19200 6 MAN_38400 7
*/
#define TX_PIN 0 //pin where your transmitter is connected
uint16_t transmit_data = 2761;
void setup() { man.setupTransmit(TX_PIN, MAN_1200); }
void loop() { man.transmit(transmit_data); delay(200); }

Just a word on the 2716 that I am sending. The program is not mine, I found it as such and since it worked and I was very happy to see the '2716' appear in my Arduino after days of fruitless trying, I decided to leave it there as a tribute. (it might have found it here)

Step 2: Receiving and Sending Data Between Attiny85: the Receiver

Picture of Receiving and Sending Data Between Attiny85: the Receiver

Building the receiver is easy:
Put the programmed attiny chip in your breadboard.
Connect a 10 k resistor between pin 1 and pin 8
Put your 433 MHz Receiver module in the breadboard
Connect the datapin (usually either one of the two middle pins) to pin PB1 (physical pin6) on the attiny.
Connect the Vcc and Ground of the transmitter module to Vcc (pin 8) and Ground (pin4) of the Attiny
Connect the LCD interface to pin PB0 (pin 5) (Clock) and pin PB2 (pin 7) (Data/Enable)
Connect Vcc and ground of the LCD to Vcc and Ground.
Attach a 17 cm (1/4 lambda for 433 MHz) to the Receiver module.
Use the following program in your chip:

#include <Manchester.h><br>#include <LiquidCrystal_SR.h>
LiquidCrystal_SR lcd(0,2,TWO_WIRE);
/*
  Manchester Receiver for Attiny
  In this example receiver will receive one 16 bit number per
transmittion to switch a relay on or off.
try different speeds using these constants, your maximum possible
speed will depend on various factors like transmitter type,
distance, microcontroller speed, ...

MAN_300 0 MAN_600 1 MAN_1200 2 MAN_2400 3 MAN_4800 4 MAN_9600 5 MAN_19200 6 MAN_38400 7 */
#define RX_PIN 1 //= pin 6 uint8_t moo = 1;
void setup()
{ lcd.begin(16,2); lcd.home(); lcd.print("Receive"); lcd.setCursor(0,1); man.setupReceive(RX_PIN, MAN_1200); man.beginReceive(); }<br>void loop() { if (man.receiveComplete()) { uint16_t m = man.getMessage(); man.beginReceive(); //start listening for next message right
//after you retrieve the message moo = ++moo % 2; lcd.print(m); } }

The LCD is ofcourse optional. You can use an LED that gets the variable 'moo' send to its pin and thus will flash on complete receival of the signal, but I just wanted to make sure that what I got was what I sent

Step 3: Receiving and Sending Data Between Attiny85: Results

Picture of Receiving and Sending Data Between Attiny85: Results

The results are good, no garbage is being received, but the reach is about 4-5 meters, with the antennas. The antenna on the receiver only makes a small difference. The one on the Transmitter makes a big difference.
Still, this is surprising as the transmitter module is capable of switching remote switches at greater distances even on different floors.

With regard to the length of the Antennas:

as f * λ= c (frequency * wavelength = lightspeed)
λ=c/f
λ= 299,792,458 /433,920,000
The wavelength is 0.690893386 meters.
Antenna would be λ/4= 0.172723346 meters (17.3 cm)
That is about 6.80013 inches.
If you would be using 315 MHz modules, the antenna would be: 0.238 m or 23.8 cm

You can also use the wavelength calculator.


Supposedly the transmitter module can take 12 Volts and still be steered by a 5 Volt microcontroller pin and will have a further reach then. Increasing the voltage on the receiver of course makes no difference

Once you have established The link between two attiny's, linking one of them with an arduino should not be a problem. I use mine to send data to an Arduino ( e,g. temperature, or the status of a tripwire), or to receive data from an Arduino to steer a servo or an RGB LED.

If you want to trigger a relay, you would do it like this:

void loop() {<br>  if (man.receiveComplete()) {
    uint16_t m = man.getMessage();
    man.beginReceive(); //start listening for next message right after you retrieve the message
    moo = ++moo % 2;
    lcd.print(m);
    if (m==2761){digitalWrite(Relay,HIGH);}
    if (m==0000){digitalWrite(Relay,LOW);}
  }

Ofcourse you need to define the Relay pin in the 'setup'

Step 4: Sending and Receiving Sensor Data With Attiny85/45: DHT11 and LDR Through Manchester Code

Picture of Sending and Receiving  Sensor Data With Attiny85/45: DHT11 and LDR Through Manchester Code

Sending a stationary number of course is fun at first, but isn’t much use. Below is a more practical example of sending 1 stationary value and 3 variable values through the ether.

/*
LDR=A1 RF433=D0 DHT11=D4 LED=D3 */ // libraries #include <dht11.h> #include <Manchester.h> dht11 DHT11; #define DHT11PIN 4 #define TX_PIN 0 //pin where your transmitter is connected //variables float h=0; float t=0; int transmit_data = 2761; int transmit_t = 0; int transmit_h = 0; int light=0;
void setup() {
  man.setupTransmit(TX_PIN, MAN_1200);
}
void loop() {
 int chk = DHT11.read(DHT11PIN);
 h=DHT11.humidity;
 t=DHT11.temperature;
 transmit_h=100*h;
 transmit_t=100*t;
  man.transmit(transmit_data);
  delay(200);
  man.transmit(transmit_h);
  delay(200);
  man.transmit(transmit_t);
 light= analogRead(A1);
 man.transmit(light);
}

It takes 3194 bytes so I could compile it in an Attiny45.

The transmitter is connected to D0 (pin 5). The DHT11 sensor is
connected to D4 (pin 3) and an LDR connected to A1 (pin 7), with the other end connected to either ground or Vcc and a corresponding pull up or pull down resistor, depending on your preference,

Variables h and t are floats that can have decimals. As I am only interested in 2 decimal accuracy, I multiply by 100 and turn them into integers. I then send a station identifier '2716', followed by 3 values: Humidity, temperature, light. The receiving station then can identify where it came from and process the incoming signals (starting by dividing them by 100 again)

Comments

Sam1ive made it! (author)2017-01-28

Hi guys! help please, can't send the code for the button with the Attiny 13. what did I do wrong, the code compiles but no action happens(( how can I improve? is it possible to feed from the batteries with sleep mode attiny to last longer worked?

Here is the code for the Arduino and it works great:

=====================================
#include <RCSwitch.h>

int button = 12;

RCSwitch mySwitch = RCSwitch();

void setup() {

Serial.begin(9600);

// Transmitter is connected to Arduino Pin #10

mySwitch.enableTransmit(10);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == HIGH){mySwitch.send(11235377, 24);}

delay(500);

}

============================================
And this is the code for Attiny 13, the code is loaded but no action, help to fix the problem

===============================================

#include <RCSwitch.h>

#include <avr/io.h>

#include <util/delay.h>

int button = 3;

RCSwitch mySwitch = RCSwitch();

int main( void ) {

// Transmitter is connected to Arduino Pin #0 (PB0)

mySwitch.enableTransmit(0);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == LOW){mySwitch.send(11235377, 24);}

_delay_ms(500);

}
===============================================

diy_bloke (author)Sam1ive2017-02-09

I apologize for my late reaction but somehow in the new comment format of instructables it is more difficult to keep track of new comments.
Anyway.... first, your question is a bit outside the realm of this instructable as i discuss data transmit between two attiny 85's using the manchester code, whereas you are having a problem with the attiny13 and the RCSwitch library and that might be exactly where yr problem lies. As i understand the 13 works on a 4.8 or 9.6MHz frequency and depending on yr core and proper programming, the timing might be a bit off and your receiver may just not recognize the signal as it is a bit off. I think for confirmation of this or for more help you better go to the RCSwitch github and raise the issue there, maybe they know a solution

Sam1ive made it! (author)2017-01-28

Hi guys! help please, can't send the code for the button with the Attiny 13. what did I do wrong, the code compiles but no action happens(( how can I improve? is it possible to feed from the batteries with sleep mode attiny to last longer worked?

?Here is the code for the Arduino and it works great:

?=====================================

?#include <RCSwitch.h>

int button = 12;

RCSwitch mySwitch = RCSwitch();

void setup() {

Serial.begin(9600);

// Transmitter is connected to Arduino Pin #10

mySwitch.enableTransmit(10);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == HIGH){mySwitch.send(11235377, 24);}

delay(500);

}

?============================================

?And this is the code for Attiny 13, the code is loaded but no action, help to fix the problem

?

?===============================================

#include <RCSwitch.h>

#include <avr/io.h>

#include <util/delay.h>

int button = 3;

RCSwitch mySwitch = RCSwitch();

int main( void ) {

// Transmitter is connected to Arduino Pin #0 (PB0)

mySwitch.enableTransmit(0);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == LOW){mySwitch.send(11235377, 24);}

_delay_ms(500);

}

?===============================================

?

SergeG13 (author)2016-10-20

Hello again.

I think, I solve the problem!

After a lot of different experiments I change the Clock to "External 8 MHz" (before that I use Internal 1 MHz). It works with External 16 MHz but slower.

Thank you for you lesson again!!!

diy_bloke (author)SergeG132016-10-21

That is exactly why I asked you what speed you burned the bootlaoder as I suspected that might be the problem :-)
I am happy you got it towork

SergeG13 (author)2016-10-20

I apologize for my offensive and stupid, but I've done all of your lesson. The transmitter works, which is signaled by the LED. But receiver does not want to operate (LED is silent). To test the receivers radio module I attached LED on its pins. LED blinks in time with the transmitter LED.

Then the microcontroller does not want to process the received signal. I downloaded your Manchester library, add a line but the situation has not changed.

Please help me, what else should pay attention to make the receiver works?

diy_bloke (author)SergeG132016-10-20

you are not offebsive or stupid. Anyway so you have a setup in which neither the virtualwire nor the manchester library seems to work. hmm... at what speed did you burn the bootloader?

SergeG13 (author)diy_bloke2016-10-21

I solved the problem!

Please read my post below.

This solution is correct for the VirtualWire library too!

SergeG13 (author)2016-10-19

I decided to try Manchester library and your tutorial.

I don't need LCD. I took LED light to inform about connection.

SergeG13 (author)2016-10-18

It's realy cool!

In my project i made a transceiver atTiny85+FS1000A.

There is 2 buttons on transceiver and I must send them.

I use VirtualWire library.

The receiver consist of atTiny85 and XY-MK-5V.

And the receiver doesn't want to work :((

Do you know, maybe there is some secret?

I lost hope that someone can help me with this trouble

diy_bloke (author)SergeG132016-10-18

Serge I never used Virtual Wire so I am not sure if i can help you. So do i understand the transmitter works but the reciver doesnt?
send me yr code here

SergeG13 made it! (author)diy_bloke2016-10-18

Here is the sketch (on arduino it works):

#include <VirtualWire.h>

int led = 4; //LED for information
int radar = 2;// i tried pb0, pb1, pb2 - no results

void setup() {
vw_set_rx_pin(radar);
vw_set_ptt_inverted(true);
vw_setup(1000);
vw_rx_start();
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
delay (100);// check the LED
}
void loop()
{
digitalWrite(led, LOW);
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
vw_wait_rx();
if (vw_get_message(buf, &buflen)) // Non-blocking
{
if (buf[0] == 'g'){
if (buf[1] == 't'){
digitalWrite(led, HIGH);//if we have the signal, than turn on LED
delay(1000);
}
}
}
}

Thijxx (author)2016-09-23

Great stuff, the communication works very good. The LiquidCrystal seems to be a much harder nut to crack, I'm using TinyWireM and a LiquidCrystal library with Tiny85 support but still I get nothing more than a flashing backlight :( Ant more information on your display setup is welcome!

diy_bloke (author)Thijxx2016-09-23

I am happy the communication works.
Which LiquidCrystalLibrary do you use?

Thijxx (author)diy_bloke2016-09-24

This one: http://playground.arduino.cc/Code/USIi2c

diy_bloke (author)Thijxx2016-09-24

ok just to make sure we are on the same page. are you trying the LCD with an I2C connection or with a shiftregister? My solution with a shiftregister works with the Malpartida library, the I2C indeed with the BroHogan library that you linked to.
Anyway just make sure about the following:
right address for I2C (some modules have 0x27 others 0x20
right contrast
and then look here

https://www.instructables.com/id/Using-an-I2C-LCD-o...

Thijxx (author)diy_bloke2016-09-24

Thanks, I've followed the link, then followed all the steps, it's not clear what core the guy uses but I tried it with multiple cores and still get the same result. Black boxes on one line. Attached it to the Nano directly and then it works fine, must be something about the Tiny I do wrong..

diy_bloke (author)Thijxx2016-09-24

"The guy" is me and i think i used the standard attiny25/45/85 core that is in the IDE. perhaps a dumb question but have you maybe switched sda and scl?

Thijxx (author)diy_bloke2016-09-24

ok :) haha. I also thought I screwed up the 2 wires, switched them over but then the display goes all crazy, flickering or no backlight at all. pin5->sda, pin7->scl

diy_bloke (author)Thijxx2016-09-24

yep that is correct. can you send me the verbose output of yr compilation

Thijxx (author)diy_bloke2016-09-24

I've sent you a private message to keep things 'clean' in here.

diy_bloke (author)Thijxx2016-09-24

appreciated

Thijxx (author)diy_bloke2016-10-03

Finally found the solution. Details: http://arduino.stackexchange.com/questions/29546/attiny85-i2c-lcd

diy_bloke (author)Thijxx2016-10-03

thanks. So was it using 4k7 resistors that solved it?

The libary that Dimitris posts is the Bro Hogan library I advised
The Arduino Tiny core appears to be one of the cores I advised

The only difference are the two resistors.

That makes sense as this project worked for me and others so it must have been a hardware lcd issue. I had not added the pull ups as the lce i2c interface has those, Given the fact yours has a different address, it is not impossible you have a different module.

Anyway,I am happy you got it to work and thanks for the feedback. I will add a mention of the resistors in the text

Thijxx (author)diy_bloke2016-10-03

The libraries are not the same. This setup with the LiquidCrystal_I2C from the Arduino website does not work. As mentioned earlier, I have tried your configuration with pull-ups. It was absolutely not a hardware issue.

diy_bloke (author)Thijxx2016-10-04

This becomes more and more interesting.
I compared the two libraries and the only difference is that the Bro Hogan library performs a check on the processor to determine if Wire" or "TinyWireM" is needed, whereas the library you found doesnt perform that check but just uses the TinyWireM library
That suggests that somehow maybe your processor was not recognized.
How? I dont know

Thijxx made it! (author)2016-09-25

Replaced the receiver with a Pro Mini for the photo, LiquidCrystal does not work for me on the ATTiny no matter what I try.

diy_bloke (author)Thijxx2016-09-25

Great. Still at a loss why the LCD isnt working

Tamadite made it! (author)2016-09-24

What provided on this instructable is to be used to enhance diverse solutions I have at home. The biggest challenge so far has been to get the Attiny85 and an Arduino board to cooperate (no RF, just by jumper wire). This instructable -and thanks to the inestimable help of the author, has put me now on the right track.

diy_bloke (author)Tamadite2016-09-24

My pleasure

Tamadite (author)2016-09-22

For some reason I do not get a reliable performance. When connecting the attiny85 acting as a TX (sender) to an Arduino board acting as RX (pin-5 on attiny85 to pin-7 on Arduino Uno with a jumper wire, no RF yet) I get either the expected number (very few times), rubbish or nothing/gaps (not reading every 200ms). I tried:

1) Arduino I.D.E 1.6.5 and 1.6.12

3) The only configuration that reports something is attiny85@8Mhz/internal@1200baud.

4) I have tried attiny core 1.0.0 (by David A.) and 1.0.2 (latest)

No progress... any idea?

diy_bloke (author)Tamadite2016-09-22

did you burn the proper bootloader?

Tamadite (author)diy_bloke2016-09-22

Arduno ISP with attiny85@8MHz internal clock. I know the attiny85 is Ok because I see it generating de Manchester encoding on the oscilloscope.

diy_bloke (author)Tamadite2016-09-23

ok,just checking. I was going to advise to try the attiny core rather than the Mellis core but if the scope shows a proper signal that is not likly where the problem is (still could try though).

On the other hand. there cant be much wrong with the receiving Arduino.

Much of the initial problems I had to do with using the wrong Manchester library and with the attiny85 core.

Can i suggest the following?

1 if you have another Arduino, try that as sender and see what that does

2 try the 'other' attiny core instead of the Mellis core

3 tell me which manchester library u are using, preferably the origin

Tamadite (author)diy_bloke2016-09-23

Hi, I appreciate your "questionnaire" :) It helps me on my rationale too...

I have checked it now with other Arduino board and with other Attiny85. Same results. I have also tried with both cores. The Mellis performs better than the other one; with Mellis I get something at least. Here is the sequence I get when transmitting "1234" (no RF, just jumper wire): 1234, 1234, 19265, 1234, 19265, 16883 (and very unstable response, time wise)

The library I am using is: http://mchr3k.github.com/arduino-libs-manchester/

I am still banging my head trying to understand that if we both have the same scenario & sketch, how could it be I do not get it to run? I want to think something is different or I am doing something wrong somewhere...

BTW, if this gives a clue to something: when measuring the duration of a Manchester pulse on the scope, I get a frequency of 657Hz.

diy_bloke (author)Tamadite2016-09-23

seems like you use the proper libray. I also know the program is ok as it works for me and many others and I have prgrammed several attinys with it. Can I suggest you forget the IDE and try codebender.either copy the program into codebender or use this link:

https://codebender.cc/sketch:361820

just one question.In my example i send the number 2761, whereas you seem to send different numbers. that means u have altered the program.Ofcourse one can but it makes me wonder if the alteration maybe introduced a mistake.

Apologies if I come back to the bootloader and ask a very basic question but i just want to cover all possibilities. Just want to make sure we are on the same page. when u said you used the 8 MHz bootloader, did you indeed mean: before i put any program in it i selected the 8Mhz board and selected the 'burn the bootloader' option and after that was done i loaded the proper program and burned thatin the attiny"

The 657hz you mention doesnt immediately ring a bell for me

Tamadite (author)diy_bloke2016-09-24

BINGO!!!!

Thanks to your brilliant idea of using codebender (first time I use it) instead of my IDE I discovered that everything went down to my IDE environment. The solution performs stable (no gaps) and 100% accurate. I suspect the problem was on the Attiny85 side -most probably on the way the IDE loaded the code onto it, since when looking at the Manchester code now generated I see a much longer preamble than before (even when the transmitted "core" pattern still the same). BTW and for the record, the cycle is still on 657Hz (8MHz@1200baud). I MADE IT to you!

(what a many hours headache... :/ )

diy_bloke (author)Tamadite2016-09-24

I have my bright moments Kacka.Vacka. :-) Anyway, I am happy you got it to work.
You may want to consider a cleanup of your IDE
I once had horrible trouble with an attiny85 code that worked before. Couldnt get it to work anymore. I moved all the previous sketches, libraries and cores into a backup folder, re-installed the IDE, only added those libraries and cores I needed and bingo, worked like before again. Sometimes I guess the entire IDE can get screwed up a bit

harishnb (author)2016-06-07

I wanted to know if ATtiny2313 can be used instead of Attiny85?

diy_bloke (author)harishnb2016-06-08

I see no reason why it couldnt be used. But I myself have no experience with the 2313

pavanjadhav18 (author)2016-04-26

Hello Friend,

Very nice concept,

I was also trying the same thing but was unable to receive data properly.. In my case, LED is blinking with very less intensity and i was also cross checking whether data has been received or not on serial port using software "Dockight" but it is showing garbage data.. Please help me...

diy_bloke (author)pavanjadhav182016-04-26

I have been helping you for some time via direct messaging and just made some suggestions.

But it seems we have found the core of your problem. Please let me know if that solved your problem

Hyperstrike (author)2016-02-10

I'm trying to do step 4 but sending DHT11 temperature and humidity values using an ATtiny85 and an RF transmitter to an Arduino Uno with an RF receiver. How would I edit the receiver or transmitter code to do this? I see you are transmitting each data value separately but how would the receiver know which value is which?

diy_bloke (author)Hyperstrike2016-02-10

The code in fact stays the same.
What I have done in the example is to first send a station identifier followed by the humidity, temperature and light, as explained in the last paragraph.
However, that worked well for short distances but on larger distances sometimes a value would get lost, so I figured I really only needed two digits accuracy and I came up with two methods:
1- As I was interested mainly in temperature and humidity, I multiplied one with 100 and added the other one. So, if for instance my temperature was 21 degrees and the humidity 50%, I would send the number 2150 (but 5021 ofcourse also would have been a possibility). The receiver would then always know which was the temperature and which was the humidity because of the order.
2-As I added a couple of stations, I actually needed to know where the numbers came from. The garage, outside or the living room.
Then I did the following:
I assigned a number to each space. Say 1: living room, 2: garage, 3: outside
then I assigned a number to each modality: say 1=humidity, 2= temperature 3 is light.
Then if my receiver would get the number 1130, it would know the humidity in the living room was 30%. If it would get 2215, it would know the temperature in the garage was 15 degrees.
If on occasion a value would get lost in transmission, that wouldnt be a big problem as it would just get it the next time.
As you may have guessed it isnt a good idea to have 3 (or more) stations to constantly send an RF signal as it will jam the ether in yr own house (never mind the neighbours), so I have put the attiny's to send only 1 or 2 bursts at specific intervals. That you can do with a delay, but if you battery feed the attiny, it is better to put it to sleep with a watchdog timer. As yo u dont need an update of the environmental values per second, you can set the delay/watchdog timer for such values that there is ample time for all to burst out their measurements without interference from eachother

diy_bloke (author)Hyperstrike2016-02-10

The code in fact stays the same.
What I have done in the example is to first send a station identifier followed by the humidity, temperature and light, as explained in the last paragraph.
However, that worked well for short distances but on larger distances sometimes a value would get lost, so I figured I really only needed two digits accuracy and I came up with two methods:
1- As I was interested mainly in temperature and humidity, I multiplied one with 100 and added the other one. So, if for instance my temperature was 21 degrees and the humidity 50%, I would send the number 2150 (but 5021 ofcourse also would have been a possibility). The receiver would then always know which was the temperature and which was the humidity because of the order.
2-As I added a couple of stations, I actually needed to know where the numbers came from. The garage, outside or the living room.
Then I did the following:
I assigned a number to each space. Say 1: living room, 2: garage, 3: outside
then I assigned a number to each modality: say 1=humidity, 2= temperature 3 is light.
Then if my receiver would get the number 1130, it would know the humidity in the living room was 30%. If it would get 2215, it would know the temperature in the garage was 15 degrees.
If on occasion a value would get lost in transmission, that wouldnt be a big problem as it would just get it the next time.
As you may have guessed it isnt a good idea to have 3 (or more) stations to constantly send an RF signal as it will jam the ether in yr own house (never mind the neighbours), so I have put the attiny's to send only 1 or 2 bursts at specific intervals. That you can do with a delay, but if you battery feed the attiny, it is better to put it to sleep with a watchdog timer. As yo u dont need an update of the environmental values per second, you can set the delay/watchdog timer for such values that there is ample time for all to burst out their measurements without interference from eachother

wesm4 (author)2015-09-26

I totally burned the boot loader at 8mhz arduino as ISP and choose attiny85 @ 8 MHz. That was the easy part. Just wondering is there any way to tell or test attinys with a certain sketch or hardware configuration to know for a fact that it's burned at 8mhz?

diy_bloke (author)wesm42015-09-28

Wes. I mentioned codebender before. Try this link

https://codebender.cc/sketch:157660
In the boards choose "attiny85 (8MHz) Arduino-tiny core".
There is also an attiny85 from David Mellis but that has a bug on codebender, so scroll down till you get to the tinies

diy_bloke (author)diy_bloke2015-11-28

correction the Attiny85 does not have a 'bug' on codebender. The 'bug' is in the core itself but that can easily be fixed by adding a line in the "pins_arduino.h" file as described in my ibble

wesm4 (author)diy_bloke2015-10-05

Ok came back home and tried installing arduino 1.6.5 it deleted my 1.0.6 and i moved all cores and libraries to 1.6.5 and the board wont even show up. im pretty sure im doing something wrong... As i was looking at your 'ible i realized i dont have a 10 k resistor on my tiny's from reset to vcc. I do however have one going from ground to my led. will it not transmit if i dont have a 10 k resistor on my tiny? what if i dont have a 10k resistor? i have a bunch of random ones laying around but none of them are 10k can i substitute for a different one? why does it need a 10k resistor in between vcc and reset?

Thanks again for helping in my journey of being a complete n00b. =]

diy_bloke (author)wesm42015-10-06

not having the 10 k should not be a problem. it can be another value just as well. The pin 1 is the reset so if there is a LOW signal on the pin the chip will reset. A resistor between pin 1 and Vcc just makes sure there is a HIGH signal on that pin. can be 1 k 10 k 47k
If you move cores from 1.06 to 1.6.5 you are going to have a problem because there is a different folder structure between 1.06 and 1.6.5.
What you need to do is to use the board installer that 1.6.5 has. Go to the mit page

http://highlowtech.org/?p=1695

and follow the instructions.
Alternatively, as I explained earlier you can use codebender you will find the code in the link I supplied before:

https://codebender.cc/sketch:157660

and use the attiny85 tiny core (NOT the D.A. Mellis core)

About This Instructable

41,614views

166favorites

License:

Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Working With the Funduino W5100 Ethernet Module.Uploading Data to ThingSpeak With MQTTAdding an MCP23017 I/O Extender to Arduino or ESP8266
Add instructable to: