CC1101 & ESP32 insanity starting to set in, CC1101 marked bad

With the new integrated cc1101 support, I excitedly upgraded HA, ordered a cc1101 board from Amazon and repurposed my test hardware. I really want to control a couple of Hunter ceiling fans. The cc1101 is always "marked bad" in the logs. I cannot for the life of me figure out what I am missing and I have been at it for hours making and re-making and verifying connections. I have stripped out the remote_receiver section as well.

Link to cc1101 board:
cc1101

ESP32 board:
ESP32

Relevant log sections:

[22:24:19.129][C][cc1101:232]: CC1101:
[22:24:19.129][C][cc1101:232]:   Chip ID: 0x0000
[22:24:19.129][C][cc1101:232]:   Frequency: 433919840 Hz
[22:24:19.129][C][cc1101:232]:   Channel: 0
[22:24:19.129][C][cc1101:232]:   Modulation: ASK/OOK
[22:24:19.129][C][cc1101:232]:   Symbol Rate: 4996 baud
[22:24:19.129][C][cc1101:232]:   Filter Bandwidth: 203125.0 Hz
[22:24:19.129][C][cc1101:232]:   Output Power: 9.6 dBm
[22:24:19.130][C][cc1101:152]:   CS Pin: GPIO27
[22:24:19.135][E][component:224]:   cc1101 is marked FAILED: unspecified
[22:24:19.213][C][remote_receiver.esp32:120]: Remote Receiver:
[22:24:19.213][C][remote_receiver.esp32:120]:   Clock resolution: 1000000 hz
[22:24:19.213][C][remote_receiver.esp32:120]:   RMT symbols: 192
[22:24:19.213][C][remote_receiver.esp32:120]:   Filter symbols: 0
[22:24:19.213][C][remote_receiver.esp32:120]:   Receive symbols: 192
[22:24:19.213][C][remote_receiver.esp32:120]:   Tolerance: 50%
[22:24:19.213][C][remote_receiver.esp32:120]:   Carrier frequency: 0 hz
[22:24:19.213][C][remote_receiver.esp32:120]:   Carrier duty: 100%
[22:24:19.213][C][remote_receiver.esp32:120]:   Filter out pulses shorter than: 250 us
[22:24:19.213][C][remote_receiver.esp32:120]:   Signal is done after 4000 us of no changes
[22:24:19.220][C][remote_receiver.esp32:152]:   Pin: GPIO25

My config file:

substitutions:
  name: esphome_tank_test
  friendly_name: ESPHome Tank Test
  devicename: esphome_tank_test
#  esphome_platform: esp32
  esphome_board: esp32dev
  esphome_project_name: "Matt.Ward Aquarium Monitor"
  esphome_project_version: "aquarium-monitor-v.2"

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
#  platform: $esphome_platform
#  board: $esphome_board
  name_add_mac_suffix: false
  project:
    name: $esphome_project_name
    version: $esphome_project_version
  on_boot:
    if:
      condition:
        api.connected: null
      then:
        - logger.log: API is connected! Now we can trigger what we want!

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    advanced:
      minimum_chip_revision: "3.1"
      sram1_as_iram: true

network:
    enable_ipv6: true
    min_ipv6_addr_count: 2
    enable_high_performance: true

#status_led:
#  pin:
#    number: 02
#    inverted: false

# Enable logging
logger:
  level: DEBUG

debug:
  update_interval: 30s

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
  platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  domain: .home
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Set up a wifi access point
  ap:  
    ssid: "${friendly_name}"
    password: !secret wifi_ap_password

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true


# To have a "next url" for improv serial
web_server:
  include_internal: True

i2c:
  sda: GPIO21
  scl: GPIO22
  frequency: 400kHz

spi:
  clk_pin:  GPIO18                   # SCK
  miso_pin: GPIO19                   # MISO
  mosi_pin: GPIO23                   # MOSI

cc1101:
  cs_pin: GPIO27
  frequency: 433.92MHz
  modulation_type: ASK/OOK   #  ASK/OOK # 2-FSK  #  4-FSK  #  GFSK  #   MSK

#remote_transmitter:
#  pin: GPIO02      # Must match GDO0
#  id: transmitter0
#  carrier_duty_percent: 100

remote_receiver:
  pin:
    number: GPIO25      # GDO2 (Optional for TX-only)
    inverted: true
  id: receiver0
  dump: raw
  # Settings to optimize recognition of RF devices
  tolerance: 50%
  filter: 250us
  idle: 4ms

display:
  - platform: lcd_pcf8574
    id: mydisplay
    dimensions: 16x2
    address: 0x27
    lambda: |-
      //Print IP address and heater state on row 0
      it.printf(0, 0, "%s", id(IP).state.c_str());
      it.printf(13, 0, "%s", id(tank_heat).state.c_str());
      // Print the current time on row 1
      it.strftime(1,1,"%I:%M%p  %m/%d", id(my_time).now());
      if (id(tank_backlight).state) {
      // Binary sensor is on
      // Control backlight on mydisplay
      // Binary sensor is on in HA
      id(mydisplay).backlight();
      } else {
      // Binary sensor is off in HA
      id(mydisplay).no_backlight(); 
      }

time:
  - platform: homeassistant
    id: my_time

text_sensor:
  - platform: homeassistant
    id: tank_heat
    entity_id: binary_sensor.tank_heating
    internal: true
  # Send Uptime in raw seconds                                                                                                                                                                                                           
  - platform: template
    name: $friendly_name Uptime
    id: uptime_human
    icon: mdi:clock-start
  
  
    # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: IP
      id: IP
#    address_0: # This usually holds the primary IPv6 address
      address_1:
        name: IPv6 LL
      address_2:
        name: IPv6 routed
 
    ssid:
      name: SSID
    #bssid:
    #  name: BSSID
    mac_address:
      name: ESP Mac Wifi Address
    #scan_results:
    #  name: ESP Latest Scan Results
  
  #- platform: debug
  #  device:
  #    name: "Device Info"
  #  reset_reason:
  #    name: "Reset Reason"

sensor:
    # Uptime sensor.
  - platform: uptime
    name: $friendly_name Uptime
    id: uptime_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            # Custom C++ code to generate the result                                                                                                                                                                                     
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);                                                                                                                                                                                          
              seconds = seconds % (24 * 3600);                                                                                                                                                                                           
              int hours = seconds / 3600;                                                                                                                                                                                                
              seconds = seconds % 3600;                                                                                                                                                                                                  
              int minutes = seconds /  60;                                                                                                                                                                                               
              seconds = seconds % 60;                                                                                                                                                                                                    
              return (                                                                                                                                                                                                                   
                (days ? to_string(days) + "d " : "") +
                (hours ? to_string(hours) + "h " : "") +
                (minutes ? to_string(minutes) + "m " : "") +
                (to_string(seconds) + "s")
              ).c_str();

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 60s
    
binary_sensor:
  - platform: homeassistant
    id: tank_backlight
    entity_id: input_boolean.esphome_backlight
    internal: false
  
  - platform: status
    name: "Connected"

switch:
  - platform: restart
    name: "Restart"

Physical pinouts:
|1 GND black
|2 3.3v red
|3 gdd0 brown gpio 02
|4 csn yellow gpio 27
|5 sck gray gpio18
|6 mosi purple gpio 23
|7 miso / gd01 white gpio19
|8 gd02 green gpio 25

Verify your wiring once more. Replace your jumper cables with "new" ones.

What are the minimum pins to be found? I assume Vcc, and, clock, miso and mosi?

You need to connect them all (except gdd0 if you just receive).

Ok, Amazon replace the unit and it started seeing my remote right away...

How do I know I am transmitting? I do see log entry with very verbose turned on that indicates it is sending. What I really do not understand is what to populate the command with. I have posted a couple of sample runs and my transmit target is in the relevant config lines.

Config sections:

spi:
  clk_pin:  GPIO18                   # SCK
  miso_pin: GPIO19                   # MISO
  mosi_pin: GPIO23                   # MOSI

cc1101:
  cs_pin: GPIO27
  id: transceiver
  frequency: 350MHz

remote_transmitter:
  pin: GPIO4      # Must match GDO0
  id: transmitter0
  carrier_duty_percent: 100%
  non_blocking: true

remote_receiver:
  pin:
    number: GPIO25      # GDO2 (Optional for TX-only)
    inverted: true
  id: receiver0
  dump: raw
  # Settings to optimize recognition of RF devices
  tolerance: 30%
  filter: 250us
  idle: 4ms

 - platform: template
    name: "TR light off"
    on_press:
      - remote_transmitter.transmit_raw:
          carrier_frequency: 350MHz
          code: [1581, -3360, 1600, -3360, 1591, -3360, 1569, -3360, 1588, -3355, 1590, -3360, 1589, -3357, 1588, -3358, 1594, -3365, 1617, -1579, 1578,
          -1565, 1615, -1567, 1680, -1581]
          repeat:
            times: 10
            wait_time: 10ms
 
21:11:49
[V]
[button:019]
'TR light off' Pressed.

But it does not show the codes it is sending.

RX run 1

21:24:37
[I]
[remote.raw:036]
Received Raw: 1604, -3378
21:24:37
[I]
[remote.raw:036]
Received Raw: 1571, -3372
21:24:37
[I]
[remote.raw:036]
Received Raw: 1569, -3367
21:24:37
[I]
[remote.raw:036]
Received Raw: 1563, -3356
21:24:38
[I]
[remote.raw:036]
Received Raw: 1586, -3348
21:24:38
[I]
[remote.raw:036]
Received Raw: 1575, -3354
21:24:38
[I]
[remote.raw:036]
Received Raw: 1561, -3353
21:24:38
[I]
[remote.raw:036]
Received Raw: 1561, -3351
21:24:38
[I]
[remote.raw:036]
Received Raw: 1565, -3350
21:24:38
[I]
[remote.raw:036]
Received Raw: 1559, -3352
21:24:39
[I]
[remote.raw:036]
Received Raw: 1560, -3352
21:24:39
[I]
[remote.raw:036]
Received Raw: 1572, -3352
21:24:39
[I]
[remote.raw:036]
Received Raw: 1563, -3367
21:24:39
[I]
[remote.raw:036]
Received Raw: 1570, -3385
21:24:39
[I]
[remote.raw:036]
Received Raw: 1587, -1548
21:24:39
[I]
[remote.raw:036]
Received Raw: 1563, -1545

RX run 2:

21:25:50

[I]

[remote.raw:036]

Received Raw: 1619, -3374

21:25:50

[I]

[remote.raw:036]

Received Raw: 1581, -3367

21:25:50

[I]

[remote.raw:036]

Received Raw: 1561, -3366

21:25:50

[I]

[remote.raw:036]

Received Raw: 1590, -3348

21:25:51

[I]

[remote.raw:036]

Received Raw: 1562, -3353

21:25:51

[I]

[remote.raw:036]

Received Raw: 1570, -3353

21:25:51

[I]

[remote.raw:036]

Received Raw: 1563, -3350

21:25:51

[I]

[remote.raw:036]

Received Raw: 1579, -3349

21:25:51

[I]

[remote.raw:036]

Received Raw: 1552, -3347

21:25:51

[I]

[remote.raw:036]

Received Raw: 1575, -3347

21:25:52

[I]

[remote.raw:036]

Received Raw: 1572, -3347

21:25:52

[I]

[remote.raw:036]

Received Raw: 1572, -3348

21:25:52

[I]

[remote.raw:036]

Received Raw: 1572, -3347

21:25:52

[I]

[remote.raw:036]

Received Raw: 1573, -3348

21:25:52

[I]

[remote.raw:036]

Received Raw: 1574, -3348

21:25:52

[I]

[remote.raw:036]

Received Raw: 1557, -3355

21:25:53

[I]

[remote.raw:036]

Received Raw: 1566, -3342

21:25:53

[I]

[remote.raw:036]

Received Raw: 1592, -3358

21:25:53

[I]

[remote.raw:036]

Received Raw: 1615, -1573

21:25:53

[I]

[remote.raw:036]

Received Raw: 1554, -1545

So, I set up my rtl-sdr in windows and do not see the unit transmitting. Do I somehow need to enable the transmitter?

I was missing this...

on_transmit:
    then:
      - cc1101.begin_tx
  on_complete:
    then:
      - cc1101.begin_rx

Sadly no lights work, but I am sending a signal now.

Why you expect the signal to be 350MHz? And how you got the signal (and wait time) that you are sending?

The FCC ID number indicated 350mhz and the back of the remote says 350mhz and my rtl sdr picks up a 350mhz signal when a button is pressed.

I captured the signal with the CC1101 several times and then inserted the pattern. I am sure the timing is off, but I am not sure how to correct it. When I listen to it with the sdr the audio frequency of the signal is off, so the speed to the transmission is not right.

I need a guide and cannot find on how to interpret the signal data... I just do not understand enough. There are not many examples of working configs for the new esphome integration out there.

Remote systems are usually quite forgiving for timings. CC tuned for 433 is not ideal for 350 though.

Post what you get with this:

remote_receiver:
  pin:
    number: GPIO25      # GDO2 (Optional for TX-only)
    inverted: false
  id: receiver0
  dump: raw
  filter: 150us
  idle: 30ms

I will test it this evening. I do change the CC freq manually during testing. Once something works, I will try to figure out a lambda that will change freq for each device on button press.

First get the whole signal captured, I'm quite confident it can be transmitted successfully.

My point for the frequency was different, while cc has adjustable frequency, the module is tuned for 433 and the antenna is as well. Performance drops when you move farther from that.

This is what I got with your suggested settings.

18:15:44
[I]
[remote.raw:027]
Received Raw: 200, -417, 178, -425, 178, -225, 378, -223, 378, -223, 381, -223, 375, -223, 378, -224, 379, -424, 206, -407, 179, -428, 179, -427, 177, -6983, 195, -402, 174, -415, 201, -197, 396, -197, 399, -222, 375, -221, 376, -222, 375, -222, 378,
18:15:44
[I]
[remote.raw:027]
-423, 179, -429, 179, -425, 178, -425, 177, -6953, 196, -397, 197, -406, 199, -195, 394, -197, 398, -221, 375, -222, 374, -222, 375, -223, 377, -422, 179, -427, 178, -425, 177, -423, 178, -6978, 171, -423, 172, -410, 201, -197, 395, -221, 374, -222,
18:15:44
[I]
[remote.raw:027]
376, -222, 375, -223, 377, -222, 379, -422, 179, -429, 179, -426, 178, -424, 177, -6977, 172, -423, 173, -411, 200, -197, 397, -197, 397, -223, 377, -197, 397, -222, 377, -223, 377, -423, 180, -430, 178, -425, 177, -423, 178, -6955, 195, -423, 172,
18:15:44
[I]
[remote.raw:027]
-408, 200, -196, 394, -198, 398, -198, 398, -222, 375, -222, 377, -222, 378, -422, 179, -428, 178, -425, 177, -423, 178, -6955, 195, -423, 172, -408, 200, -195, 394, -197, 398, -222, 376, -221, 376, -221, 375, -223, 377, -422, 179, -427, 178, -424,
18:15:44
[I]
[remote.raw:027]
178, -424, 177, -6979, 171, -423, 172, -410, 200, -196, 395, -221, 375, -222, 375, -221, 376, -222, 377, -223, 378, -422, 179, -430, 179, -426, 177, -423, 177, -7004, 174, -409, 200, -420, 177, -199, 400, -222, 375, -223, 377, -222, 376, -222, 379,
18:15:44
[I]
[remote.raw:027]
-224, 381, -451, 182, -409, 180, -430, 179, -427, 178, -7061, 185, -413, 178, -424, 178, -226, 377, -222, 377, -223, 382, -421, 179, -426, 177, -424, 178, -425, 178, -423, 178, -421, 177, -421, 178, -6930, 194, -400, 195, -398, 196, -212, 388, -197,
18:15:44
[I]
[remote.raw:036]
397, -221, 374, -418, 177, -422, 178, -421, 177, -422, 176, -419, 176, -420, 176, -420, 176, -6883, 190, -399, 177, -397, 201, -195, 393, -197, 393, -196, 394, -391, 201, -418, 177, -419, 177, -418, 176, -393, 200, -393, 201, -417, 176

So, I created a file with the above values and built the following and it worked!

 - platform: template
    name: "TR light off"
    on_press:
#      - lambda: |-
#          // Change frequency to 350 MHz before sending
#          id(transceiver).set_frequency(350);
      - remote_transmitter.transmit_raw:
          carrier_frequency: 350MHz
          code: [200, -417, 178, -425, 178, -225, 378, -223, 378, -223, 381, -223, 375, -223, 378, -224, 379, -424, 206, -407, 179, -428, 179, -427, 177, -6983, 195, -402, 174, -415, 201, -197, 396, -197, 399, -222, 375, -221, 376, -222, 375, -222, 378,
-423, 179, -429, 179, -425, 178, -425, 177, -6953, 196, -397, 197, -406, 199, -195, 394, -197, 398, -221, 375, -222, 374, -222, 375, -223, 377, -422, 179, -427, 178, -425, 177, -423, 178, -6978, 171, -423, 172, -410, 201, -197, 395, -221, 374, -222,
376, -222, 375, -223, 377, -222, 379, -422, 179, -429, 179, -426, 178, -424, 177, -6977, 172, -423, 173, -411, 200, -197, 397, -197, 397, -223, 377, -197, 397, -222, 377, -223, 377, -423, 180, -430, 178, -425, 177, -423, 178, -6955, 195, -423, 172,
-408, 200, -196, 394, -198, 398, -198, 398, -222, 375, -222, 377, -222, 378, -422, 179, -428, 178, -425, 177, -423, 178, -6955, 195, -423, 172, -408, 200, -195, 394, -197, 398, -222, 376, -221, 376, -221, 375, -223, 377, -422, 179, -427, 178, -424,
178, -424, 177, -6979, 171, -423, 172, -410, 200, -196, 395, -221, 375, -222, 375, -221, 376, -222, 377, -223, 378, -422, 179, -430, 179, -426, 177, -423, 177, -7004, 174, -409, 200, -420, 177, -199, 400, -222, 375, -223, 377, -222, 376, -222, 379,
-224, 381, -451, 182, -409, 180, -430, 179, -427, 178, -7061, 185, -413, 178, -424, 178, -226, 377, -222, 377, -223, 382, -421, 179, -426, 177, -424, 178, -425, 178, -423, 178, -421, 177, -421, 178, -6930, 194, -400, 195, -398, 196, -212, 388, -197,
397, -221, 374, -418, 177, -422, 178, -421, 177, -422, 176, -419, 176, -420, 176, -420, 176, -6883, 190, -399, 177, -397, 201, -195, 393, -197, 393, -196, 394, -391, 201, -418, 177, -419, 177, -418, 176, -393, 200, -393, 201, -417, 176]
          repeat:
            times: 2
            wait_time: 10ms

So, why did I get so much more data from this sample than the ones I was taking? I am sure it has to do with timing of the RX signal. My understanding is that raw code takes care of the timing by the format of positive and negative numbers?

So, I have all 3 lights working now, the only bummer is there is not a way to tell the state of the lights.

I suspect one may have a way as it returns a few lines of pronto data after changing state. And the index number of the returned data is the same as the index number for the tx data.

  • Illuminance sensor?
  • CT Clamp on the power cable?

jk of couse :slight_smile:

I't's not just a question that you got "more data" , previous data was completely wrong.

Your receiver parameters were all wrong, which I corrected. CC1101 signal is not inverted, filtering out 250us destroys this completely and idle 4ms is not enough to catch the whole signal.

If you look at the signal, you see it's repeated 12 times with 7ms gap between.
If you want to save memory, you can shorten it to:

code: [195, -402, 174, -415, 201, -197, 396, -197, 399, -222, 375, -221, 376, -222, 375, -222, 378, -423, 179, -429, 179, -425, 178, -425, 177, -6953]
repeat:
  times: 12
  wait_time: 0

It doesn't return "pronto data", pronto is for IR, but it decodes almost anything to something. Set your receiver back to raw and see what it really returns if anything.

So, I just tried it with the average of each column and it worked. How did you come up with the numbers you used because they also worked?

I really appreciate your help with this, have learned a bunch already!

It is one of the repeats you posted.
It doesn't matter what you use as long as it is around those pairs and the total duration matches. The signal was coded with either 200 / 400 or 150 / 450 pairs. Quite surely 200 / 400. Variation is just accumulated error on both transmitter and receiver side.

If you have interest in playing with these, give it a try:
[200, -400, 200, -400, 200, -200, 400, -200, 400, -200, 400, -200, 400, -200, 400, -200, 400, -400, 200, -400, 200, -400, 200, -400, 200, -7000]

The signal is short, so it doesn't ask too much memory, but in case you had huge number of buttons on your remote, you could decode it like this
A=200, -200
B=200, -400
C=400, -200
D=400, -400
S= 200, -7000 //synch
And then write a lambda to send it like this:
BBACCCCCDBBBS