ATtiny85 and RadioHead

After various posts and help from forum members, I finally got my ATtiny85 to compile error free using RadioHead for an ASK transmitter. See my thread below:

However, when connected to an ASK RF Tx module, it fails to work in conjunction with an Rx ASK module linked to an Arduino Uno. If I replace the Tx side ATtiny85 with a Uno the system works correctly.

The ATtiny85 code is as follows:

#include <RH_ASK.h>
//#include <SPI.h> // Not actually used but needed to compile

//RH_ASK driver;
//RH_ASK driver(2000, 3, 4, 0); // ATTiny, RX on D3 (pin 2 on attiny85) TX on D4 (pin 3 on attiny85), 
RH_ASK driver(2000, 4, 3); // 200bps, TX on D3 (pin 2), RX on D4 (pin 3)
void setup()
{
/*  Serial.begin(9600);    // Debugging only
  if (!driver.init())
  {
    Serial.println("init failed");
  }
  else
  {
    Serial.println("init success");
  }*/
}

void loop()
{
  const char *msg = "Hello World!";
  driver.send((uint8_t *)msg, strlen(msg));
  driver.waitPacketSent();
  delay(1000);
}

I have tried all combinations as shown in the code commented out.
In the original RH_ASK.h, the PAYLOAD was 67 bytes and the compiler gave a warning that instability could occur as there was too little memory available so I reduced it to 25 bytes as per below and the warning disappeared.
#define RH_ASK_MAX_PAYLOAD_LEN 25
However still no luck.

I investigated pins 2 and 3 on the ATtiny85 with a CRO and could not see any data so obviously the ASK Tx module would not be transmitting data.

Has anyone got any ideas why an ASK Tx module working with the ATtiny85 doesn’t work and if so could they help with a possible fix?

I must say that I haven’t seen a project published with an ATtiny85 driving an ASK RF Tx module although I have seen one using rc_switch which is an alternative to RadioHead.

1 Like

why an ASK Tx module working with the ATtiny85 doesn't work

Wrong question, and pointless to start a new thread on the same topic.

I investigated pins 2 and 3 on the ATtiny85 with a CRO and could not see any data

Then the error is clearly in your code. You don't even need radios to test it, substitute with directly wired connections on the workbench. Don't forget to connect the grounds.

I haven't seen a project published with an ATtiny85 driving an ASK RF Tx module

You didn't look very hard. Working example.

I disagree, as the original post was trying to get the RadioHead/ATtiny85 Tx combination to compile without errors.

This post is trying to get a RadioHead ASK system working with an ATtiny85 based Tx and an Arduino Uno based Rx.

And of course I have tried direct connections with an Arduino Uno Tx which works and the ATtiny85 Tx which does not work and cannot be expected to work if no data is observed on the allocated Tx pin of the ATtiny85.

In effect, the code output pin of the Arduino configured with the Tx code shows data whereas that of the ATtiny85 configured with the same Tx code except for the line:
RH_ASK driver(2000, 4, 3); // 200bps, TX on D3 (pin 2), RX on D4 (pin 3)
shows no data.

Further to your comment " You didn't look very hard Working example" this also shows problems and from this I quote "But, for some reason, using the ATTINYs, I couldn’t manage to get to work the virtual wire communication." That example reverted to simple codes not related to either VirtualWire or RadioHead.

Note: VirtualWire is the predecessor of RadioHead and is no longer supported.

My final post and conclusion regarding this topic:

RadioHead is fine when using it with Arduino's such as Uno's, Nano's, Megas etc but cannot be used successfully with an ATtiny85.

However, I would like to be proved wrong as for some applications it's small size and power requirements are ideal.

cannot be used successfully with an ATtiny85.

Unlikely.

It can be correctly concluded that whatever it is you tried did not work.