sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.89k stars 651 forks source link

Have anyone try Rcswitch with esp32c3 supermini #508

Open feyhong1112 opened 3 months ago

feyhong1112 commented 3 months ago

The issue that I am facing now is the recieve pin is did not work anyone else go this problem?

lllwan commented 2 months ago

I have also encountered this problem but it remains unsolved.

feyhong1112 commented 1 month ago

Hi IIIwan, Sorry about late reply. I hope you still keep going on this work. I wait about 2 week to get a new supermini board. The reason that I want to buy a new one because I am curious is that 1) I broke my board by connect module on 5V to recieve the code 2) I suspect that the board itself have malfunction since it shiped to me <----I think this is the most true reason becuase I buy 2 borad on same vendor I act the same phenomenon and I think that on rf433 module, I think it should have smd transistor to seperate different voltage. That why my previous esp8266 microcontroller still work find. (Just random speculate by the way)

I am now changing to lib "smartrc cc1101" by Lsatan with cc1101 3.3V on now new supermini esp32c3 board What I am done is that:

I use pin 4 to recieve without needed to use digitaltointerrupt() or any spacial method. I setting upload with JTAG disable, I setting erase all flash*... : disable

and if all of this work on me I guess I hope that it would be work on you also. Try on different supermini borad is my main suggestion

If you switch to cc1101 please don't for get to change spi pin dont trust the google supermini spi pin image. Use the chinese vendor data wire. I am also attach my code

`

include "ELECHOUSE_CC1101_SRC_DRV.h"

include

include

define SCK_PIN 8

define MISO_PIN 5

define MOSI_PIN 6

define SS_PIN 7

//#define RXD2 A3

int pin; // int for Receive pin.

RCSwitch mySwitch = RCSwitch();

void setup() { Serial.begin(115200); delay(1000);

/*

ifdef ESP32

pin = 3; // for esp32! Receiver on GPIO pin 4.

elif ESP8266

pin = 4; // for esp8266! Receiver on pin 4 = D2.

else

pin = 0; // for Arduino! Receiver on interrupt 0 => that is pin #2

endif

*/ ELECHOUSE_cc1101.setSpiPin(SCK_PIN, MISO_PIN, MOSI_PIN, SS_PIN);

if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection. Serial.println("Connection OK"); }else{ Serial.println("Connection Error"); }

//CC1101 Settings: (Settings with "//" are optional!) ELECHOUSE_cc1101.Init(); // must be set to initialize the cc1101! //ELECHOUSE_cc1101.setRxBW(812.50); // Set the Receive Bandwidth in kHz. Value from 58.03 to 812.50. Default is 812.50 kHz. //ELECHOUSE_cc1101.setPA(10); // set TxPower. The following settings are possible depending on the frequency band. (-30 -20 -15 -10 -6 0 5 7 10 11 12) Default is max! //ELECHOUSE_cc1101.setMHZ(330); // Here you can set your basic frequency. The lib calculates the frequency automatically (default = 433.92).The cc1101 can: 300-348 MHZ, 387-464MHZ and 779-928MHZ. Read More info from datasheet. ELECHOUSE_cc1101.setMHZ(348);

mySwitch.enableReceive(4); // Receiver on pin 4

ELECHOUSE_cc1101.SetRx(); // set Receive on

}

void loop() { // for (float freq = 330.00; freq <= 331.00; freq += 0.01) {

if (mySwitch.available()) {
  output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(), mySwitch.getReceivedProtocol());
  mySwitch.resetAvailable();
}

//delay(100);  // Wait for 1 second

// }

} `

Result:

15:42:09.007 -> Decimal: 12653360 (24Bit) Binary: 110000010001001100110000 Tri-State: 100F0F010100 PulseLength: 294 microseconds Protocol: 1 15:42:09.039 -> Raw data: 9112,962,277,966,284,325,883,302,906,310,883,337,854,337,876,962,279,316,903,302,879,329,878,954,311,298,884,323,884,951,286,946,305,319,899,299,890,956,270,959,300,316,880,331,877,308,901,312,877,