SCM/SCM+ on ESP32 - RTLAMR

I’m looking to replace my RTL SDR dongle with a ESP32 CC1101 solution to read my utility meters (rtlamr). I have a CC1101 from Rabbit Labs (tuned to the 900mhz range) that is wired into an Olimex ESP32 PoE board. I’d like to have this work fully over PoE/Ethernet. My current SDR dongle (looking to replace) is connected to rtlamr2mqtt and received into Home Assistant.

I have OMG 1.8.1 downloaded and am attempting to flash the RTL_433 options to my ESP.

I’ve modified the Olimex settings in the environments.ini file to the following:

[env:esp32-olimex-gtw-ble-poe]
platform = ${com.esp32_platform}
board = esp32-poe
extra_scripts = ${com-esp32.extra_scripts}
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp32.lib_deps}
  ${libraries.decoder}
  ${libraries.rtl_433_ESP}
  ${libraries.smartrc-cc1101-driver-lib}
build_flags =
  ${com-esp32.build_flags}
  '-DESP32_ETHERNET=true'
  '-DGateway_Name="OMG_ESP32_OLM_POE"'
  '-DvalueAsATopic=true'       ; MQTT topic includes model and device
  '-DLOG_LEVEL=LOG_LEVEL_TRACE'
  '-DZgatewayRTL_433="rtl_433"'
  '-DZradioCC1101="CC1101"'
  '-DRF_FREQUENCY=912.600'
  '-DRAW_SIGNAL_DEBUG=true'   ; display raw received messages
  '-DDEMOD_DEBUG=true'         ; display signal debug info
  '-DPUBLISH_UNPARSED=true'    ; publish unparsed signal details
  '-DSIGNAL_RSSI=true'         ; Display during signal receive
  '-DNO_DEAF_WORKAROUND=true'
  '-DRF_CC1101="CC1101"'       ; CC1101 Transceiver Module
  '-DRF_MODULE_CS=14'          ; pin to be used as chip select
  '-DRF_MODULE_GDO0=4'        ; CC1101 pin GDO0
  '-DRF_MODULE_GDO2=16'        ; CC1101 pin GDO2
  '-DRF_MODULE_MOSI=33'
  '-DRF_MODULE_MISO=32'
  '-DRF_MODULE_SCK=13'

This matches the pinout that I’ve confirmed works (had it at least pulling data from the receiver in ESPHome). When I push this down, I see that the Ethernet connects, grabs an IP (DHCP on that VLAN with assignments) and then it starts to try to attempt to connect to WiFi? Ethernet / the cc1101 module with these pins in use did work properly in ESPHome.

T: Ethernet Started
N: Ethernet started
N: .
N: .
N: .
N: Ethernet Connected
N: OpenMQTTGateway Ethernet MAC: 08:B6:1F:7E:A7:AB
N: OpenMQTTGateway Ethernet IP: 192.168.35.148    
N: OpenMQTTGateway Ethernet link speed: 100 Mbps
N: .
N: No config in flash, launching wifi manager
T: mounted file system
N: Attempting Wifi connection with saved AP: 0
[  6429][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
N: Attempting Wifi connection with saved AP: 1
[  7437][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
N: Attempting Wifi connection with saved AP: 2
[  8444][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
N: Attempting Wifi connection with saved AP: 3
[  9451][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
N: Attempting Wifi connection with saved AP: 4
[ 10457][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
N: Connect your phone to WIFI AP: OMG_ESP32_OLM_POE with PWD: 
*wm:AutoConnect
*wm:No wifi saved, skipping
*wm:AutoConnect: FAILED
*wm:StartAP with SSID:  OMG_ESP32_OLM_POE
*wm:AP IP address: 192.168.4.1
*wm:Starting Web Portal
*wm:config portal has timed out 
*wm:config portal exiting 
W: failed to connect and hit timeout
T: OpenMQTTGateway mac: 08:B6:1F:7E:A7:A8
T: OpenMQTTGateway ip: 0.0.0.0
T: OpenMQTTGateway index 0
T: OpenMQTTGateway mqtt topic: home/
T: OpenMQTTGateway mqtt discovery prefix: homeassistant
T: OpenMQTTGateway gateway name: OMG_ESP32_OLM_POE
T: OpenMQTTGateway mqtt server: 192.168.1.17
T: OpenMQTTGateway mqtt port: 1883
T: OpenMQTTGateway mqtt user: your_username
T: OpenMQTTGateway secure connection: false
T: OpenMQTTGateway validate cert: false
[255551][E][Preferences.cpp:50] begin(): nvs_open failed: NOT_FOUND
N: No WebUI config to load
T: [WebUI] displayMetric true
T: [WebUI] WebUI Secure true
N: OpenMQTTGateway URL: http://0.0.0.0/
N: ZwebUI setup done
[257068][E][Preferences.cpp:50] begin(): nvs_open failed: NOT_FOUND
N: RF Config not found using default
T: enableActiveReceiver: 3
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
E: C1101 spi Connection Error
N: Enable RTL_433 Receiver: 912.60Mhz
rtl_433_ESP(6): CC1101 gpio receive pin: 4
rtl_433_ESP(6): CC1101 receive frequency: 912.599976
rtl_433_ESP(6): # of device(s) configured 157
rtl_433_ESP(6): ssizeof(r_device): 112
rtl_433_ESP(6): cfg->devices size: 17584
T: ZgatewayRTL_433 command topic: home/OMG_ESP32_OLM_POE/commands/MQTTtoRF/config
N: ZgatewayRTL_433 setup done

I do then start to see rtl_433 messages

rtl_433_ESP(6): Ignored Signal length: 10000, Time since last bit length: 1407, Gap length: 2838253, Signal RSSI: -80, Current RSSI: -82, pulses: 9, noise count: 18
rtl_433_ESP(6): Ignored Signal length: 28000, Time since last bit length: 1315, Gap length: 1685134, Signal RSSI: -77, Current RSSI: -82, pulses: 3, noise count: 19
rtl_433_ESP(6): Ignored Signal length: 9590, Time since last bit length: 1314, Gap length: 3629644, Signal RSSI: -78, Current RSSI: -82, pulses: 2, noise count: 81
rtl_433_ESP(6): Ignored Signal length: 46000, Time since last bit length: 40315, Gap length: 2787318, Signal RSSI: -58, Current RSSI: -91, pulses: 0, noise count: 0

This makes me think the receiver is wired in correctly.

I think there are a few problems that I’m trying to solve:

  1. The ethernet shows as connected, but then still tries to connect to a WiFi network, errors out, and spawns up the AP. If I disable the rtl_433 package, the ethernet works properly. It also works properly if I just have the Ethernet module and BLE module selected, so this is something to do with the rtl_433 package. I’ve tried screwing around with the code (commenting in, adding sleeps/loops/checks) and I just cant get it stable. GPIO conflict somewhere?

  2. The SCM protocols use the Manchester encoding, and I see that the RTL_433_ESP code has support for Manchester encodings. I can’t figure out how to trigger it from my environments.ini file though. Any idea on the command line arg (if it exists) to trigger this? Then I’m looking for a raw data dump.

  3. After I figure out #2, I’m guessing that this will give me a binary string that I should then be checking for the SCM preables, and decoding from there? Though this is probably more focused for the rtl_433_esp crowd than the OMG crowd?

I know this is probably a large project. I have some C++ experience and am willing to dig deep into this to get it working.

I’m not an expert… but in User_config.h you can set a fixed IP, GW etc. under
#define NetworkAdvancedSetup true

I’m sure there was a place to set your network and password for the WiFi so it didn’t drop back to WiFiManager, found it under
#if defined(ESPWifiManualSetup)

Dave

My goal is to not have to use WiFi though, with this having a built in PoE jack.

With ethernet hooked up, it pulls the proper DHCP lease (and even displays it in the logs), but then tries to connect to WiFi (of which I have not supplied any details for), fails, and starts up the AP. This is all when I can still ping its ethernet interface.

This isn’t the same behavior if I have rtl_433 disabled (works properly), so maybe this is more of a bug/issue for the Github.

Matty, try adding a line
'-DESP32_WIFI=false'
under the ETHRNET=true line
Dave

Thanks for the suggestion.

I tried that, and it didn’t produce a different result. I did a search on the libraries with the ESP32_WIFI and don’t see any ifdef’s existing anywhere? I’m on v1.8.1, does that exist in a different branch?

Matty, it was a bit of a guess. I don’t have the olimex hardware to try, but it compiled OK so I ‘assumed’ that it had some effect.
Dave