Basic RS232 Communication (#780)

* Added ZGateway RS232
This commit is contained in:
DieKatzchen authored and GitHub committed 2020-10-19 13:48:58 -05:00
1 parent 546b27773f
commit 3df16d2d52
11 files changed
+242

No files matched your search

+2
View File
@@ -53,6 +53,7 @@ module.exports = {
'setitup/ir',
'setitup/lora',
'setitup/gsm',
'setitup/rs232',
'setitup/sensors',
'setitup/actuators'
]
@@ -78,6 +79,7 @@ module.exports = {
'use/ir',
'use/lora',
'use/gsm',
'use/rs232',
'use/rfm69',
'use/sensors',
'use/actuators',
Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

+29
View File
@@ -0,0 +1,29 @@
# RS232 gateway
## Compatible parts
|Module|Purpose|Where to Buy|
|-|-|-|
|TTL to RS232 module|Transcieving|-|
Any module using a MAX232 chip will work. Don't pay extra to get all the signals, we're only using RX and TX.
## Pinout
|Board| Receiver Pin| Emitter Pin|
|-|:-:|:-:|
|Arduino UNO|D2|D9|
|ESP8266|D2|D4|
|ESP32|27/**26**|14|
Connect VCC on the module to 5V of your board, and the ground on the module to the ground of your board. your Transmit pin goes to TX and your Receive pin goes to RX. This may seem backwards, but the module is labeled as where it will be connected on the RS232 side of the module.
## Arduino Hardware setup
![RS232](../img/OpenMQTTgateway_Arduino_Addon_RS232.png)
## ESP8266 Hardware setup
![RS232](../img/OpenMQTTgateway_ESP8266_Addon_RS232.png)
## ESP32 Hardware setup
![RS232](../img/OpenMQTTgateway_ESP32_Addon_RS232.png)
## Credits
RS232 Gateway Developed by DieKatzchen
+23
View File
@@ -0,0 +1,23 @@
# RS232 gateway
## Sending an RS232 message
Simply publish the message you wish to transmit, minus the prefix and postfix. For example, to send the "Turn On" signal for a Mitsubishi XD221U projector, the code is simply '!' so you would use the command
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoRS232 -m '{"value": "!"}'`
It will automatically add the prefix and postfix you set in [config_RS232.h](https://github.com/1technophile/OpenMQTTGateway/blob/master/main/config_RS232.h).
## Receiving an RS232 message
To receive a message, subscribe to all with `mosquitto_sub -t +/# -v`
and perform an action that should get a response from the device. For example, If I were to send the "Turn On" signal from earlier, I would receive back
```json
home/OpenMQTTGateway/RS232toMQTT {"value":"1"}
```
Because this projector echoes back a received command to acknowledge. Some devices will send a NACK, or Negative Acknowledge, to confirm that they received your message but could not comply. That would look like
```json
home/OpenMQTTGateway/RStoMQTT {"value":"!:N"}
```