Configurare SA818
Instalare pip
sudo apt install python3-pip
Instalare serial:
$ sudo pip3 install pyserial
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyserial
Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
100% |████████████████████████████████| 194kB 1.5MB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.4
Exemple programare
Standard Uart interface is used to configure the parameter of SA818 Walkie Talkie. The format of UART is 9600, 8, N, 1, which means: Baud = 9600, data bit = 8bit, Parity = None, Stop bit = 1 bit. The interface is TTL or CMOS @3.3V. The parameters which can be configured are: Bandwidth, Tx-frequency, Rx-frequency, SQ, Tx_SubAudio(Tx_CTCSS/ Tx-CDCSS), Rx_SubAudio (Rx_CTCSS/Rx-CDCSS), Volume, Scan frequency, Audio filter, etc. When commands received, the module will verify and reply acknowledge message; User should wait enough time to send the next command until received the acknowledge signal.
AT+DMOCONNECT
AT+DMOSETGROUP=GBW,TFV, RFV,Tx_CTCSS,SQ,Rx_CTCSS
. GBW: Channels space. 0.12.5k; 1.25k . TFV: Transmit frequency. Range: 134.0000~174.0000MHz . RFV: Receive frequency. Range: 134.0000~174.0000MHz. The frequency should be the times of 12.5KHz or 25KHz. . Tx_CTCSS: CTCSS value in transmit PL103.5 = 13, PL123 = 18 . SQ: Squelch level (0~8). 0. monitor mode which can.t be used in scanning mode. . Rx_CTCSS: CTCSS value in receive PL103.5 = 13, PL123 = 18 . x: Configuration result. 0. succeeded; 1. data out of range.
De exemplu:
AT+DMOSETGROUP=0,152.1250,152.1250,0012,4,0003<CR><LF>
Sau:
AT+DMOSETGROUP=0,152.1250,152.1250,754N,4,445I<CR><LF>
Răspuns:
+DMOSETGROUP:0<CR><LF> OK
Exemple:
AT+DMOSETGROUP=1,432.7750,432.7750,0018,8,0013
AT+DMOSETGROUP=1,432.5000,432.5000,0013,8,0013
AT+DMOSETGROUP=1,432.5000,432.5000,0025,8,0025
AT+DMOSETGROUP=1,432.5000,432.5000,0000,8,0000
AT+DMOSETGROUP=1,432.7750,432.7750,0000,8,0000
Configurarea volumului:
Forma:
AT+DMOSETVOLUME=X
Nivelul volumului este în intervalul 1--8
AT+DMOSETVOLUME=3
Filtre
AT+SETFILTER=PRE/DE-EMPH, HIGHPASS, LOWPASS
PRE/DE-EMPH: 1: emphasis bypass 0: emphasis normal
HIGHPASS: 1: voice_highpass_filter_bypass 0: voice_highpass_filter normal
LOWPASS: 1: voice_lowpass_filter_bypass 0: voice_lowpass_filter normal
AT+SETFILTER=0,0,0
Configurarea tonului de închidere
Format:
AT+SETTAIL=TAIL
TAIL: 1: open tail tone 0: close tail tone
RSSI
Format:
RSSI?
Valorile RSSI sunt de la 0 la 255, unitate de 1dB
Versiunea modulului
Format:
AT+VERSION
Erori comunicare serială
>> AT+DMOCONNECT
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 537, in write
n = os.write(self.fd, d)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tom/scripts/orangeserial.py", line 33, in <module>
ser.write((rinput + '\r\n').encode('utf-8'))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 571, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
By default Raspbian configures the Raspberry Pi serial port (GPIO14-GPIO15) to provide boot-up information. It also allows you to login via a connected device. If you need to use the Pi’s serial port for something else (i.e. a specific add-on board) you will need to disable this default functionality.
Comenzi
Coduri CTCSS
| NS | PL | Hz |
|---|---|---|
| 1 | XZ | 67.0 |
| 39 | WZ | 69.3 |
| 2 | XA | 71.9 |
| 3 | WA | 74.4 |
| 4 | XB | 77.0 |
| 5 | WB | 79.7 |
| 6 | YZ | 82.5 |
| 7 | YA | 85.4 |
| 8 | YB | 88.5 |
| 9 | ZZ | 91.5 |
| 10 | ZA | 94.8 |
| 11 | ZB | 97.4 |
| 12 | 1Z | 100.0 |
| 13 | 1A | 103.5 |
| 14 | 1B | 107.2 |
| 15 | 2Z | 110.9 |
| 16 | 2A | 114.8 |
| 17 | 2B | 118.8 |
| NS | PL | Hz |
|---|---|---|
| 18 | 3Z | 123.0 |
| 19 | 3A | 127.3 |
| 20 | 3B | 131.8 |
| 21 | 4Z | 136.5 |
| 22 | 4A | 141.3 |
| 23 | 4B | 146.2 |
| NATO | 150.0 | |
| 24 | 5Z | 151.4 |
| 25 | 5A | 156.7 |
| 40 | 159.8 | |
| 26 | 5B | 162.2 |
| 41 | 165.5 | |
| 27 | 6Z | 167.9 |
| 42 | 171.3 | |
| 28 | 6A | 173.8 |
| 43 | 177.3 | |
| 29 | 6B | 179.9 |
| 44 | 183.5 |
| NS | PL | Hz |
|---|---|---|
| 30 | 7Z | 186.2 |
| 45 | 189.9 | |
| 31 | 7A | 192.8 |
| 46 | 196.6 | |
| 47 | 199.5 | |
| 32 | M1 | 203.5 |
| 48 | 8Z | 206.5 |
| 33 | M2 | 210.7 |
| 34 | M3 | 218.1 |
| 35 | M4 | 225.7 |
| 49 | 9Z | 229.1 |
| 36 | M5 | 233.6 |
| 37 | M6 | 241.8 |
| 38 | M7 | 250.3 |
| 50 | 0Z | 254.1 |