DIGITAL LOSS BER TESTER a tester is the device for removal, accumulation and information display about passings of a signal in radio amateur networks DMR, YSF, D-Star at observance of a condition that the radio station of the user carries out data exchange with network by means of the MMDVM device under control of the Pi-Star program.
The device consists of the client and server parts executed on microcontrollers of ESP-32, ESP-8266 series. The server addresses the Dashboard page of the Pi-star program, reads out indications of the last connection with an interval 5-10 with, transfers them to the server (IoT) ThingSpeak. A client part with an interval 10 with reads out data with ThingSpeak and brings them to the OLED monitor. A set of indications represents the sequence of the following attributes: call sign, connection time, BER value, Loss value. The platform of programming of ESP-32 and ESP-8266 is MicroPython.
When developing and debugging the author applied the following ready payments:
1. TTGO New WiFi Bluetooth Module 18650 Battery holder ESP32 4 MB SPI Flash 4 MB Psram 2A fuse
2. 868 мГц-915 мГц SX1276 ESP32 Lora 0.96 OLED Bluetooth WI-FI Lora
3. D1 mini - Mini NodeMcu 4M bytes Lua WIFI Internet of Things development board based ESP8266 by WeMos
All three payments are stitched under programming on MicroPython since payments come stitched under Arduino. The author used the EsPy.exe program.
The technique is in detail described here:
https://github.com/jungervin/EsPy
Posledniyeversiya of firmwares of MicroPython are downloaded from here:
http://micropython.org/download
On sale there are payments with hardwired Micropython, but the author did not test them.
The payment of SX1276 ESP32 Lora of 0.96 inches the blue OLED display is applied to a client part and it is required to write in it the Client.py file. Technique here: https://github.com/jungervin/EsPy.
Server part gathers according to the scheme:
Listing for each payment:
Client.py
Code: Untitled.txt Select all
#ESP-32 Lora -
#sapmple for RC7LL
#
Coll='RC7LL' # sample
GET="https://api.thingspeak.com/channels/631265/fields/1.json?api_key=****************&results=1"
import time
import network
import machine
import ssd1306 # ssd1396
from machine import Pin,I2C
save_entities=False
p16 = Pin(16, Pin.OUT)
p16.value(1)
i2c = machine.I2C(-1, machine.Pin(15), machine.Pin(4))
oled = ssd1306.SSD1306_I2C(128, 32, i2c)
oled.fill(0)
oled.text('Tester DMR', 0, 0)
oled.show()
j=7 # количество WIFI точек
# массив с именами и паролями точек WIFI
ssid = [['WIFI1','WIFI2','WIFI3','WIFI4', 'WIFI5','WIFI6','WIFI7'], ['pass1','pass2','pass3','pass4', 'pass5', 'pass6','pass7']]
wifi = network.WLAN(network.STA_IF)
time.sleep(2)
wifi.active(True)
time.sleep(2)
i=0
for i in range (j):
wifi.connect(ssid[0][i], ssid[1][i])
time.sleep(5)
con=wifi.isconnected()
if con:
ssid[0][i]
con
oled.fill(0)
oled.text(ssid[0][i], 0, 00)
oled.text('True', 0, 10)
oled.show()
break
else:
ssid[0][i]
con
oled.fill(0)
oled.text(ssid[0][i], 0, 00)
oled.text('False', 0, 10)
oled.show()
continue
import urequests
s=1
while s ==1:
time.sleep(5)
if wifi.isconnected():
ss=urequests.get(GET)
i=ss.text.find(Coll)-9
if i > 0:
col=''
while ss.text[i]!='"':
col=col+ss.text[i]
i=i+1
oled.fill(0)
oled.text(col, 0, 00)
loss=''
j=col.find("|")+1
if j>0:
while col[j]!='|':
loss=loss+col[j]
j=j+1
loss_="loss="+loss+"%"
oled.text(loss_, 0, 10)
ber=''
j=j+1
col=col+" "
while col[j]!='|':
ber=ber+col[j]
j=j+1
ber_="ber ="+ber+"%"
oled.text(ber_, 0, 20)
oled.show()
oled.fill(0)
oled.text(col, 0, 00)
oled.text(loss_, 0, 10)
oled.text("S T O P Tester", 0, 20)
oled.show()Code: Untitled.txt Select all
#ESP32 Connect
#
# https://github.com/LilyGO/TTGO-T8-ESP32 #
ip="http://192.168.8.104/"
passw='**********'
ssid= '**********'
Coll_1='RN6LJK '
GET_1="https://api.thingspeak.com/update?api_key=****************&field1="
Coll_2='RC7LL '
GET_2="https://api.thingspeak.com/update?api_key=****************&field1="
Coll_3='RA3AET '
GET_3="https://api.thingspeak.com/update?api_key=****************&field1="
import time
import network
import machine
import urequests
from machine import Pin,I2C
save_entities=False
p12 = Pin(12, Pin.OUT) #12
p12.value(1)
sta_if = network.WLAN(network.STA_IF)
time.sleep(2)
sta_if.active(True)
time.sleep(2)
sta_if.connect(ssid,passw)
time.sleep(5)
sta_if.isconnected()
t0=1 # 0 pin12
tt=4 #
d1=21 # d1, d2 "<tr><td align="
d2=29
t_o=7 # thingspeak.com
f1_old='00:00:00'
while True:
p12.value(1)
if sta_if.isconnected():
r=[0]
r = urequests.get(ip)
time.sleep(tt)
c=r.text.find(">TX</td><td></") #
if c>6500: #
c=-10
if c <0:
c=r.text.find("<tr><td align=") #
f1=r.text[c+d1:c+d2] #
ber='' # BER
c=r.text.find("%</td></tr>")
i=c+1
while r.text[i]!=">":
i=i-1
j=i+1
while r.text[j]!="%":
ber=ber+r.text[j]
j=j+1
ber="|"+ber+"|"
f4=ber
c=r.text.find("%</td><td")
loss='' # LOSS
i=c+1
while r.text[i]!=">":
i=i-1
j=i+1
while r.text[j]!="%":
loss=loss+r.text[j]
j=j+1
loss="|"+loss
f3=loss
col='' #
i=r.text.find('</a></td><td align="left">TG')
while r.text[i]!=">":
i=i-1
i=i+1
while r.text[i]!='<':
col=col+r.text[i]
i=i+1
f2=col+" "
if ((f2==Coll_1) and (f1 != f1_old)): #RN6LJK
f1_old=f1
f1_old
f2
ss=[0]
ss=urequests.get(GET_1+f1+" "+f2+f3+f4)
time.sleep(t_o)
print(ss.text)
if ((f2==Coll_2) and (f1 != f1_old)): #RC7LL
f1_old=f1
f1_old
f2
ss=[0]
ss=urequests.get(GET_2+f1+" "+f2+" "+f3+f4)
time.sleep(t_o)
print(ss.text)
if ((f2==Coll_3) and (f1 != f1_old)): #RA3AET
f1_old=f1
f1_old
f2
ss=[0]
ss=urequests.get(GET_3+f1+" "+f2+f3+f4)
time.sleep(t_o)
print(ss.text)
p12.value(0)
time.sleep(t0)
continue
p12.value(0)
time.sleep(t0)
continue
continue
Code: Untitled.txt Select all
import time
import machine
from machine import Pin
save_entities=False
p16 = Pin(16, Pin.IN) #D0 # Connect - р12
p14 = Pin(14, Pin.OUT) #D5 # Connect - RST
p2 = Pin(2, Pin.OUT) #
p14.value(1)
tz=5 #
tp=3 #
time.sleep(tz)
t10=time.time()
t00=time.time()
while True :
pp=p16.value()
if pp ==1:
p2.value(0)
t11=time.time()
tt1=t11-t10
t00=time.time()
if tt1>tp:
print('tt1zzz=')
tt1 #
p13.value(0)
p13.value(1)
time.sleep(tz)
p14.value(0)
p14.value(1)
time.sleep(tz)
t10=time.time()
t00=time.time()
if pp ==0:
p2.value(1)
t01=time.time()
tt0=t01-t00
if tt0>tp:
print('tt0zzz=') #
tt0
p13.value(1)
p13.value(0)
time.sleep(tz)
p14.value(0)
p14.value(1)
time.sleep(tz)
t10=time.time()
t00=time.time()
t10=time.time()RN6LJK@MAIL.RU