libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
382 stars 55 forks source link

Remote receiver not working as expected on the CBU (BK7231N) #231

Open spupetic opened 6 months ago

spupetic commented 6 months ago

I have installed ESPHome on a CBU based 433 MHz wireless doorbell. It has a doorbell chime chip (that works well via the remote_transmitter component) and a CMT2217B OOK RF receiver, which does not work somewhy. I can confirm that the RF receiver itself works with ESPHome on an ESP32.

Here is the code for the protocol decoder:

https://github.com/pauln/esphome-linp-doorbell-g04/tree/main/components/linptech_g6l

I don't get any errors or warnings, except that the PIN should be inverted, but when I invert it, that doesn't change anything. By setting the log level to very verbose, nothing useful comes up, it seems like the protocol decoder never sends log messages.

My settings for the remote_receiver:

remote_receiver:
  pin: 
    number: P8
  dump: linptech_g6l
  filter: 20us
  idle: 900us
spupetic commented 6 months ago

I have tried connecting the same RF receiver to an ESP32, and with that, it works fine.

ESP32:

remote_raw_esp32

Taking a look at the remote.raw codes, and comparing the ESP32 and the CBU logs, it seems like the latter interprets the signal differently. Inverting the PIN mode does not help.

CBU:

remote_raw_bk7231n
spupetic commented 6 months ago

I have tried with an ESP8266 connected to the receiver, and it works perfectly fine with that too.

BrainP4in commented 5 months ago

Don't know if this is related, but I get pretty similar logs on my CBU remote_receiver with an IR Sensor. It worked on OpenBK, so there should be nothing wrong with the Setup. Is it possible that the problem is not in the linptech_g6l protocol?

spupetic commented 5 months ago

Don't know if this is related, but I get pretty similar logs on my CBU remote_receiver with an IR Sensor. It worked on OpenBK, so there should be nothing wrong with the Setup. Is it possible that the problem is not in the linptech_g6l protocol?

Does your receiver work with ESPHome on the CBU? I think that the problem is not with the linptech_g6l protocol decoder, as it works fine with an ESP32 and an ESP8266 too.

If I connect the same receiver to an ESP-based device, it works fine, but with the CBU, it does not, so it should be CBU or libretiny related. The libretiny remote_receiver is based on the ESP8266's remote_receiver codebase, and it works with that on an ESP. So, that leaves two possibilities, something is behaving different: the CBU or the implementation.

BrainP4in commented 5 months ago

The receiver only worked in OpenBK. In ESPHome I get raw logs like in your Screenshots. So I think your assumption is right.

spupetic commented 5 months ago

The receiver only worked in OpenBK. In ESPHome I get raw logs like in your Screenshots. So I think your assumption is right.

What pin do your receiver use? And were there warnings that stated it should be inverted?

BrainP4in commented 5 months ago

Im using P8 for der Receiver. And at first the log showed the warning, which went away after adding invert to the pin configuration.

spupetic commented 5 months ago

Im using P8 for der Receiver. And at first the log showed the warning, which went away after adding invert to the pin configuration.

In my case, with an ESP-device, the receiver should not be inverted, it does not work when inverted. The problem can also be P8 related then.

BrainP4in commented 5 months ago

My problem is that I can't easily change that since it is a "Sonoff" IR Blaster/ Remote

spupetic commented 5 months ago

My problem is that I can't easily change that since it is a "Sonoff" IR Blaster/ Remote

Yes, it should not be changed.

BrainP4in commented 5 months ago

Have you only tried receiving messages? Has sending worked on your Device? Maybe related as well.

Not sure if it's a user error, but it logs that the message was sent but the IR Device ex. TV, AV Receiver don't react.

spupetic commented 5 months ago

Have you only tried receiving messages? Has sending worked on your Device? Maybe related as well.

Not sure if it's a user error, but it logs that the message was sent but the IR Device ex. TV, AV Receiver don't react.

The remote_transmitter works on my device, but it is not IR or RF, it just controls the interconnected doorbell chime chip. So I have a doorbell, which dings when I ask it, but cannot react to the button presses :D

Which pin do you use for the transmitter?

BrainP4in commented 5 months ago

Have you only tried receiving messages? Has sending worked on your Device? Maybe related as well. Not sure if it's a user error, but it logs that the message was sent but the IR Device ex. TV, AV Receiver don't react.

The remote_transmitter works on my device, but it is not IR or RF, it just controls the interconnected doorbell chime chip. So I have a doorbell, which dings when I ask it, but cannot react to the button presses :D

Which pin do you use for the transmitter?

Sounds cool ^^

I'm using P7 to transmit the data but as I said, this coud be a error on my side.

spupetic commented 5 months ago

Maybe you can try to add it like this:

remote_transmitter:
  pin:
    number: P7
    mode:
      output: true
  carrier_duty_percent: 50%
spupetic commented 5 months ago

Did you have success?

BrainP4in commented 5 months ago

No not really, I also tried input pullup on the receiver and got more realistic logs but almost everything is raw.

spupetic commented 5 months ago

I have also tried input pullup, pulldown and inverting with all of these combinations, but none of them worked. Can we say that we have ruled out user error?

BrainP4in commented 5 months ago

I think so, yes.

spupetic commented 5 months ago

@kuba2k2 Can you give us some advice, what can we do to investigate this further?