Skip to content

Commit

Permalink
[FSK] Add Lilygo Heltec environment with FSK modulation
Browse files Browse the repository at this point in the history
Enable RTL_433 frequency and active receiver change with WebUI
Add FSK environment for Heltec and Lilygo
  • Loading branch information
1technophile committed Dec 1, 2023
1 parent eb5b8fa commit 90c2895
Show file tree
Hide file tree
Showing 15 changed files with 698 additions and 510 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ jobs:
- "esp32dev-rtl_433"
- "esp32doitv1-aithinker-r01-sx1278"
- "heltec-rtl_433"
- "heltec-rtl_433-fsk"
- "heltec-ble"
- "lilygo-rtl_433"
- "lilygo-rtl_433-fsk"
- "lilygo-ble"
- "esp32dev-multi_receiver"
- "esp32dev-multi_receiver-pilight"
Expand Down
40 changes: 13 additions & 27 deletions docs/use/rf.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ Registering protocol [102] "X10 Security"

### Change receive frequency

Default receive frequency of the module is 433.92 Mhz, and this can be can changed by sending a message with the frequency. Parameter is `mhz` and valid values are 300-348 Mhz, 387-464Mhz and 779-928Mhz. Actual frequency support will depend on your board
The frequency can be can changed by sending an MQTT message or through the WebUI. Parameter is `frequency` and valid values are 300-348 Mhz, 387-464Mhz and 779-928Mhz. Actual frequency support will depend on your board

`home/OpenMQTTGateway/commands/MQTTtoRTL_433 {"mhz":315.026}`
`home/OpenMQTTGateway/commands/MQTTtoRF/config {"frequency":315.026}`

### Change Signal RSSI Threshold Delta

Delta applied to RSSI floor noise level to determine start and end of signal, defaults to 9db.

`home/OpenMQTTGateway/commands/MQTTtoRTL_433 {"rssi": 9}`
`home/OpenMQTTGateway/commands/MQTTtoRF/config {"rssiThreshold": 9}`

### Retrieve current status of receiver

`home/OpenMQTTGateway/commands/MQTTtoRTL_433 {"status":1}`
`home/OpenMQTTGateway/commands/MQTTtoRF/config {"status":1}`

```
{"model":"status",
Expand All @@ -159,41 +159,27 @@ Delta applied to RSSI floor noise level to determine start and end of signal, de
"freeMem":112880} - ESP32 memory available
```


## Changing Active Receiver Modules

### Switching Active Receiver Module

Switching of the active transceiver (RTL_433 receiver only) module is available between the RF, RF2, RTL_433 and Pilight gateway modules, allowing for changing of signal decoders without redeploying the openMQTTGateway package. Sending a JSON message to the command topic of the desired receiver will change the active transceiver module.
Switching of the active transceiver (RTL_433 receiver only) module is available between the RF, RF2, and (RTL_433 or Pilight) gateway modules, allowing for changing of signal decoders without redeploying the OpenMQTTGateway package. Sending a JSON message to the command topic will change the active transceiver module.

To enable the RF gateway module send a json message to the RF gateway module command subject with the key being 'active', and any value. The value at this time is ignored.

Example:
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTto433" -m '{"active":true}'`

To enable the PiLight gateway module send a json message to the PiLight gateway module command subject with the key being 'active', and any value. The value at this time is ignored.

Example:
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoPilight" -m '{"active":true}'`

To enable the RF2 gateway module send a json message to the RF2 gateway module command subject with the key being 'active', and any value. The value at this time is ignored.

Example:
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoRF2" -m '{"active":true}'`
1 - PiLight
2 - RF
3 - RTL_433
4 - RF2

To enable the RTL_433 gateway module send a json message to the RTL_433 gateway module command subject with the key being 'active', and any value. The value at this time is ignored.
Example to receive from the RF gateway:
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoRF/config" -m '{"active":2}'`

Example:
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoRTL_433" -m '{"active":true}'`
The active receiver can also be changed with the WebUI.

### Status Messages

The openMQTTGateway status message contains a key `actRec` which is the current active receiver module.

1 - PiLight
2 - RF
3 - RTL_433
4 - RF2
The OpenMQTTGateway RFtoMQTT status message contains a key `active` which is the current active receiver module.

## RCSwitch based gateway

Expand Down
70 changes: 69 additions & 1 deletion environments.ini
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp32.lib_deps}
${libraries.rtl_433_ESP}
${libraries.smartrc-cc1101-driver-lib}
build_flags =
${com-esp32.build_flags}
; *** OpenMQTTGateway Config ***
Expand Down Expand Up @@ -787,6 +788,40 @@ build_flags =
; '-DDISPLAY_BRIGHTNESS=80'
; '-DDISPLAY_METRIC=false'
custom_description = Gateway using RTL_433_ESP and RadioLib
custom_hardware = ESP32 HELTEC LORA32 V2

[env:heltec-rtl_433-fsk]
platform = ${com.esp32_platform}
board = heltec_wifi_lora_32_V2
; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp32.lib_deps}
${libraries.ssd1306}
${libraries.rtl_433_ESP}
build_flags =
${com-esp32.build_flags}
; *** OpenMQTTGateway Config ***
;'-UZmqttDiscovery' ; disables MQTT Discovery
'-DvalueAsATopic=true' ; MQTT topic includes model and device
'-DGateway_Name="OMG_heltec_rtl_433_ESP"'
'-DOOK_MODULATION=false' ; FSK modulation activated
'-DRF_FREQUENCY=915'
;-DRF_FREQUENCY=868.300'
;-DRF_FREQUENCY=433.9'
; *** OpenMQTTGateway Modules ***
'-DZgatewayRTL_433="rtl_433"'
'-DZradioSX127x="SX127x"'
; *** ssd1306 Display Options ***
'-DZdisplaySSD1306="HELTEC_SSD1306"'
; '-DLOG_TO_OLED=false' ; Enable log to OLED
; '-DJSON_TO_OLED=true'
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
; '-DDISPLAY_IDLE_LOGO=false'
; '-DDISPLAY_BRIGHTNESS=80'
; '-DDISPLAY_METRIC=false'
custom_description = Gateway using RTL_433_ESP and RadioLib
custom_hardware = ESP32 HELTEC LORA32 V2

[env:heltec-ble]
platform = ${com.esp32_platform}
Expand All @@ -810,6 +845,7 @@ build_flags =
; '-DDISPLAY_BRIGHTNESS=80'
; '-DDISPLAY_METRIC=false'
custom_description = Heltec BLE gateway with adaptive scanning activated, automatically adapts the scan parameters depending on your devices
custom_hardware = ESP32 HELTEC LORA32 V2

[env:lilygo-rtl_433]
platform = ${com.esp32_platform}
Expand Down Expand Up @@ -840,6 +876,39 @@ build_flags =
custom_description = For ESP32, Gateway using RTL_433_ESP and RadioLib
custom_hardware = ESP32 LILYGO LoRa32 V2.1

[env:lilygo-rtl_433-fsk]
platform = ${com.esp32_platform}
board = ttgo-lora32-v21
; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp32.lib_deps}
${libraries.ssd1306}
${libraries.rtl_433_ESP}
build_flags =
${com-esp32.build_flags}
; *** OpenMQTTGateway Config ***
;'-UZmqttDiscovery' ; disables MQTT Discovery
'-DvalueAsATopic=true' ; MQTT topic includes model and device
'-DGateway_Name="OMG_lilygo_rtl_433_ESP"'
'-DOOK_MODULATION=false' ; FSK modulation activated
'-DRF_FREQUENCY=915'
;-DRF_FREQUENCY=868.300'
;-DRF_FREQUENCY=433.9'
; *** OpenMQTTGateway Modules ***
'-DZgatewayRTL_433="rtl_433"'
'-DZradioSX127x="SX127x"'
; *** ssd1306 Display Options ***
'-DZdisplaySSD1306="LilyGo_SSD1306"'
; '-DLOG_TO_OLED=true' ; Enable log to OLED
; '-DJSON_TO_OLED=true'
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
; '-DDISPLAY_IDLE_LOGO=false'
; '-DDISPLAY_BRIGHTNESS=80'
; '-DDISPLAY_METRIC=false'
custom_description = For ESP32, Gateway using RTL_433_ESP and RadioLib with FSK modulation (beta)
custom_hardware = ESP32 LILYGO LoRa32 V2.1

[env:lilygo-ble]
platform = ${com.esp32_platform}
board = ttgo-lora32-v21
Expand Down Expand Up @@ -920,7 +989,6 @@ build_flags =
; '-DRF_MODULE_INIT_STATUS=true' ; Display transceiver config during startup
custom_description = Multi RF library with the possibility to switch between ESPilight, NewRemoteSwitch and RCSwitch, need CC1101


[env:tinypico-ble]
platform = ${com.esp32_platform}
board = tinypico
Expand Down
9 changes: 2 additions & 7 deletions main/ZactuatorSomfy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
# endif

void setupSomfy() {
# ifdef ZradioCC1101 //using with CC1101
ELECHOUSE_cc1101.Init();
# endif
pinMode(RF_EMITTER_GPIO, OUTPUT);
digitalWrite(RF_EMITTER_GPIO, LOW);

Expand All @@ -55,7 +52,7 @@ void setupSomfy() {
void MQTTtoSomfy(char* topicOri, JsonObject& jsonData) {
if (cmpToMainTopic(topicOri, subjectMQTTtoSomfy)) {
# ifdef ZradioCC1101
ELECHOUSE_cc1101.SetTx(CC1101_FREQUENCY_SOMFY);
ELECHOUSE_cc1101.SetTx(RF_FREQUENCY_SOMFY);
# endif
Log.trace(F("MQTTtoSomfy json data analysis" CR));

Expand All @@ -72,9 +69,7 @@ void MQTTtoSomfy(char* topicOri, JsonObject& jsonData) {
EEPROMRollingCodeStorage rollingCodeStorage(EEPROM_ADDRESS_START + remoteIndex * 2);
SomfyRemote somfyRemote(RF_EMITTER_GPIO, somfyRemotes[remoteIndex], &rollingCodeStorage);
somfyRemote.sendCommand(command, repeat);
# ifdef ZradioCC1101
ELECHOUSE_cc1101.SetRx(receiveMhz); // set Receive on
# endif
initCC1101();
}
}
# endif
Expand Down
Loading

0 comments on commit 90c2895

Please sign in to comment.