Problems with rf modul on ATtiny

Hello everyone.
I'm writing this message to ask for your help. I'd like to connect two ATtiny85s with 433MHz RF modules. Here is my code for the transmitter:

#include <Manchester.h>
#define datalength  4
uint8_t data[datalength];

void setup(){
  pinMode(3,INPUT);// Pin 3 is connected to a potentiometer
  pinMode(0,OUTPUT);// Pin 0 is connected to an LED
  man.setupTransmit(1, MAN_2400); // Pin 1 is connected to the transmitter
}


void loop(){
  int mesure = analogRead(3);
  int use = map(mesure,0,1023,0,255);
  analogWrite(0,use);
  data[0] = datalength;
  data[1] = 0;
  data[2] = highByte(use);  // potentiometer measurement (10 bits) is divided into
  data[3] = lowByte(use);   // on two bytes

  man.transmitArray(datalength, data);
}

Here is my code for the receiver:

#include "Manchester.h"
#define RX_PIN 3
#define LED_PIN 2
#define BUFFER_SIZE 22
uint8_t buffer[BUFFER_SIZE];

void setup(){
  pinMode(0,OUTPUT); // Pin 0 is connected to an LED
  pinMode(LED_PIN,OUTPUT); // Pin 2 is connected to an LED
  man.setupReceive(RX_PIN, MAN_2400); //The receiver is connected to pin 3
  man.beginReceiveArray(BUFFER_SIZE, buffer);
}

void loop() {
  if (man.receiveComplete()) { 
    uint8_t receivedSize = 0;
    receivedSize = buffer[0];
    int valeur = (buffer[2] << 8) + buffer[3];
    analogWrite(0,valeur);
    man.beginReceiveArray(BUFFER_SIZE, buffer);
  }
  else{digitalWrite(LED_PIN,HIGH);}
}

After my tests, I noticed that the LED attached to pin 2 of the receiver is on, while the LED on pin 0 is still off. So the receiver never receives anything.
Could someone please help me by improving my code or suggesting a new one, even if it uses another library?
(Sorry for my bad English, I'm French)

What modules are you using? Please post a link to specifications.

Also please post your schematic, and some good, clear photos of your setup

In the receiver code, the LED on pin 2 is sometimes turned on, but never turned off, and pin 1 is not addressed at all.

So that is the expected result.

Here is a my schematic :
for the transmitter :
shémat électronique pour forum émetteur.pdf (315,0 Ko)
for the receiver :
shémat électronique pour forum recepteur.pdf (275,7 Ko)
(sorry if it's not very conventional I'm new to electronics)
And here are the modules i am using : https://www.gotronic.fr/art-kit-emetteur-recepteur-433-mhz-txrx433-36883.htm

Have you soldered antennas to the pad on each circuit board?

1 Like

Please put the pictures directly in the post - you can simply copy & paste:

Transmitter:

Receiver:

Note that the schematic symbol for an LED is distinguished from an "ordinary" diode by 2 arrows - indicating the light being emitted:
image

Do you really have those LEDs with no series resistor?

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds/all

Hi, I would like to use two 433MHz RF modules such as: https://www.otronic.nl/fr/emetteur-et-recepteur-rf-433mhz.html?source=googlebase&gclid=EAIaIQobChMIvr2lpNC-gAMVYkhBAh3usQy9EAQYBCABEgKY7PD_BwE on two ATtiny85 to pass the position of a potentiometer. But my codes never work. So I ask you if you can give me the codes that worked for you with their connections if possible.

I have merged your cross-posts @cypriengrandin.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Are you using the library they recommend?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.