0

I have the following components:

I got a communication flow transmit/receive working between two Wemos D1 and like to outsource the transmitting part now to a ATtiny85. I used the same code as for the Wemos:

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  pinMode(1, OUTPUT);
  mySwitch.enableTransmit(2);
}

void loop() {    
    mySwitch.send("000110110001010100010001");  
    digitalWrite(1, HIGH);
    delay(250);  
    digitalWrite(1, LOW);
    delay(250);  
}

But the serial monitor for the Wemos does not receive any communication. I went so far that I built up the communication between the two Wemos again and connected only the data pin of the transmitter to the ATtiny85 in order to exclude any voltage problems (ATtiny gets 5V, transmitter likes <3.6V).

Now I am out of ideas. How can I debug the problem or what else can I try?

Requested setup: enter image description here

  • And your ATtiny runs at 8MHz, while the Wemos runs at 80 or 160MHz? What are the used supply and logic voltages? The seller page says you should use 2.0-3.6V for the transmitter. Does the transmitter still work when you re-attach it to a Wemos? IMHO the next low-level debugging step (after checking voltages) would be use a logic-analyzer to compare the timing diagrams for the TX pin between the boards, as these are timing-ciritcal in the microsecond range (github.com/sui77/rc-switch/blob/master/RCSwitch.cpp#L523) – Maximilian Gerhardt May 8 '18 at 21:14
  • @MaximilianGerhardt The ATtiny runs on 16.5Mhz and Wemos on 80Mhz. Didn't know that it is critical to have the same timing - how do I do that? The transmitter is working fine (i power it by the second wemos and only connect the data pin to the ATtiny) – jwillmer May 8 '18 at 21:22
  • 1
    Timing analysis would be done with a logic analyzer (e.g. salae logic clone, extremely cheap, youtube.com/watch?v=rR5cEFRO9_s). So even if you feed 5V I/O Levels to the transmitter from the ATTiny but use the 3.3V supply from the weemos (and common GND I suppose) it works? Can you edit your question to include the working Wemos and non-working ATTiny circuits (with power supplies included)? – Maximilian Gerhardt May 8 '18 at 21:30
  • Nice to see it resolved, you should mark your answer as correct. Side note: Your right circuit is wrong in the sense that you don't have common ground between them. It might be just by chance that your two power supplies (if they come from the same computer, e.g.) have the same GND, but in general these can be at different potentials;the "3.3V" with respect to the GND of the 1st power supply might be a compeletly different voltage with respect to the GND of the 2nd pow.supply. That's why you should connect the GNDs of the power supplies together (youtube.com/watch?v=vhZQbFeEfPM) – Maximilian Gerhardt May 9 '18 at 10:40
  • 1
    But it seems like the transmitter just didn't like 5V I/O levels (as the datasheet said), which you have successfully resolved by making your ATTiny run on 3.3V. Another solution would be to add a level shifter (example) from 5V to 3.3V, but you'd still need a 3.3V supply for the transmitter. So I think you're overall better off with running on 3.3V entirely. – Maximilian Gerhardt May 9 '18 at 10:42
0

I got it to work. The last comment of @Maximilian Gerhardt about I/O output got me thinking and I read up on it. So if I use 5V to power the ATtiny the I/O output voltage representation for 1 and 0 are significantly higher then with 3.3V. So now I underclocked the ATtiny to 8Mhz in order to use a 3.3V power supply. This way the I/O output matches the transmitters expectations. Now the communication is working.

Thanks for your help Max!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.