John's Vademecum

Try to learn something about everything, and everything about something -Thomas Huxley “Darwin's bulldog” (1824-1895)

User Tools

Site Tools


public:radio:radio_database:ic-r75

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:radio:radio_database:ic-r75 [12/07/22 21:42 BST] – [4. Further Reading] johnpublic:radio:radio_database:ic-r75 [06/03/25 06:49 GMT] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
  
-====== IC-R75 ======+====== Icom IC-R75 ======
  
-===== Details =====+=====  Details =====
  
  
-===== Repairs / Mods =====+=====  Repairs / Mods =====
  
   * -5V DC/DC converter   * -5V DC/DC converter
-    * capacitor failures+    * various capacitor failures
  
   * "Turn Off" fault - due to overheating of 13V regulator   * "Turn Off" fault - due to overheating of 13V regulator
Line 17: Line 17:
       * Improve heatsinking of regulator IC to chassis       * Improve heatsinking of regulator IC to chassis
  
-===== Remote Control =====+=====  Remote Control ===== 
 + 
 +{{ :public:radio:radio_database:netradio.png?direct&400 |}} 
  
   * connected to ''shack'' server via RS232   * connected to ''shack'' server via RS232
Line 68: Line 71:
 Remote control is achieved via a SSH connection to shack ''laptop'' to run the netradio ''client.py'' and the RX audio can be heard via PicoPhone. Remote control is achieved via a SSH connection to shack ''laptop'' to run the netradio ''client.py'' and the RX audio can be heard via PicoPhone.
  
-===== Further Reading =====+ 
 +===== Documentation ===== 
 + 
 +  * {{ :public:radio:radio_database:icr75_instructionmanual.pdf |}} 
 +  * {{ :public:radio:radio_database:icom_ic_r75_service_manual.pdf |}} 
 + 
 + 
 + 
 +=====  Further Reading =====
  
   * Python code for the remote control at ''github'' [[https://github.com/gm4slv/netradio]]   * Python code for the remote control at ''github'' [[https://github.com/gm4slv/netradio]]
  
-  * server.py+==== server.py ==== 
 + 
 +++++ Code.... |
  
 <code python> <code python>
Line 286: Line 299:
 </code> </code>
  
-  * ''icom.py''+++++ 
 +==== icom.py ==== 
 + 
 +++++ Code ... |
  
 <code python> <code python>
Line 295: Line 311:
 #sport = "COM1" #sport = "COM1"
 sport = "/dev/ttyS0" sport = "/dev/ttyS0"
-sbaud = 19200+sbaud = 9600
  
 lock = threading.Lock() lock = threading.Lock()
Line 638: Line 654:
  
  </code>  </code>
 +
 +++++
 +
 +==== conf.py ====
 +
 +++++ Code .... |
 +
 +<code python>
 +# header
 +preamble = "\xfe"
 +controller = "\xe0"
 +
 +# commands/requests
 +set_freq_cmd = "\x05"
 +set_mode_cmd = "\x06"
 +get_freq_cmd = "\x03"
 +get_mode_cmd = "\x04"
 +get_smeter_cmd = "\x15" + "\x02"
 +get_swr_cmd = "\x15" + "\x12"
 +digi_off_cmd = "\x1a" + "\x04" + "\x00" + "\x00"
 +
 +set_pre_cmd = "\x16" + "\x02"
 +
 +set_pre_off = "\x00"
 +set_pre_on = "\x01"
 +
 +set_att_cmd = "\x11"
 +set_att_on = "\x20"
 +set_att_off = "\x00"
 +
 +ptt_on_cmd = "\x1c" + "\x00" + "\x01"
 +ptt_off_cmd = "\x1c" + "\x00" + "\x00"
 +
 +pwr_cmd = "\x14" + "\x0a"
 +
 +# end of message
 +eom = "\xfd"
 +
 +# controller responses
 +ack = "\xfb"
 +nak = "\xfa"
 +
 +a1 = "\x5A"
 +n1 = "IC-R75"
 +cal1 = ( 25, 1, 36, 47, 31, 18, 34, 35 )
 +
 +a2 = "\x5e"
 +# a2 = "\x01"
 +n2 = "IC-718"
 +cal2 = ( 27, 28, 58, 10, 14, 14, 35, 42 )
 +
 +n3 = "AR7030"
 +
 +n4 = "IC-M710"
 +</code>
 +
 +++++
 +
 +
 +==== client.py ====
 +
 +++++ Code .... |
 +
 +<code python>
 +__author__ = 'gm4slv'
 +# client to work with server_oo.py
 +
 +
 +# # v0.1
 +
 +import socket
 +
 +try:
 +    import readline
 +except ImportError:
 +    pass
 +
 +import threading
 +import time
 +
 +
 +HOST, PORT = "shack", 9999
 +
 +smlog = "pymon.txt"
 +log_active = []
 +
 +
 +def make_con():
 +    global sock
 +    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 +    sock.connect((HOST, PORT))
 +
 +
 +def get_rnum():
 +    global num
 +    global radios
 +
 +    names = connect("listradios")
 +
 +    radios = names.split()
 +    num = len(radios)
 +    return num
 +
 +
 +def get_rname(i):
 +    r = radios[i]
 +    return r
 +
 +
 +def list_radios():
 +    num = get_rnum()
 +    global radio
 +    print "\r\nThere are currently %d radios connected." % num
 +    for i in range(0, num):
 +        r = get_rname(i)
 +        print "Radio %d is %s" % (i + 1, r)
 +
 +
 +def get_lradio():
 +    num = get_rnum()
 +
 +    lradio = raw_input("Select radio to log: ").strip()
 +
 +    if not lradio:
 +        print "Please select a radio"
 +        return False
 +    elif int(lradio) > num:
 +        print "Selected radio not recognized"
 +        return False
 +
 +    else:
 +
 +        return lradio
 +
 +
 +def set_radio():
 +    num = get_rnum()
 +    # global radio
 +    global radio_num
 +    global rname
 +    print "There are currently %d radios connected." % num
 +    for i in range(0, num):
 +        r = get_rname(i)
 +        print "Radio %d is %s" % (i + 1, r)
 +
 +    radio = raw_input("Choose a radio number from the list : ").strip()
 +    try:
 +        if not radio:
 +            print "Please select a radio"
 +            return False, False
 +
 +        elif int(radio) > num:
 +            print "Selected radio not recognized"
 +            return False, False
 +    except ValueError:
 +        print "Please enter a number"
 +        return False, False
 +
 +    else:
 +        radio_num = "".join(("r", radio))
 +        rname = get_rname(int(radio) - 1)
 +        return radio_num, rname
 +
 +
 +def prompt():
 +    print ""
 +    print "The available commands are:"
 +    print "lr   : List Radios"
 +    print "sr   : Select the Radio to control"
 +    print "gr   : Get currently selected Radio name"
 +    print "gm   : Get Mode"
 +    print "sm   : Set Mode"
 +    print "gf   : Get Freq"
 +    print "sf   : Set Freq"
 +    print "gs   : Get S-meter"
 +    print "gp   : Get Pre-amp"
 +    print "pon  : Set Pre-amp On"
 +    print "poff : Set Pre-amp Off"
 +    print "gatt : Get Attn"
 +    print "aton : Set Attn On"
 +    print "atoff: Set Attn Off"
 +    print "ga   : Get All (status of all radios)"
 +    print "sync : Sync freq/mode on two radios"
 +    print "log  : Setup background logging to file"
 +    print "   : Help (show this command list)"
 +    print "   : quit"
 +    print ""
 +
 +
 +def start():
 +    global radio_num
 +    global rname
 +    global sock
 +
 +    data = raw_input(rname + " > ").lower().strip()
 +    if len(data.split()) > 1:
 +        print "only one command at a time please"
 +        start()
 +
 +    elif data == "lr":
 +        list_radios()
 +        start()
 +    elif data == "sr":
 +
 +        radio_num, rname = set_radio()
 +
 +        while not radio_num:
 +            radio_num, rname = set_radio()
 +
 +        start()
 +
 +    elif data == "gr":
 +        print "Radio selected is %s" % rname
 +        start()
 +
 +    elif data == "gm":
 +        mode = connect("getmode" + " " + radio_num)
 +        print "%s replied: %s" % (rname, mode)
 +        start()
 +
 +    elif data == "sm":
 +        smode = raw_input("Enter mode: ")
 +        mode = connect("setmode" + " " + smode + " " + radio_num)
 +        print "%s replied: %s" % (rname, mode)
 +        start()
 +
 +    elif data == "gf":
 +        freq = connect("getfreq" + " " + radio_num)
 +        print "%s replied: %s kHz" % (rname, freq)
 +        start()
 +
 +    elif data == "sf":
 +        sfreq = raw_input("Enter freq (kHz): ")
 +        freq = connect("setfreq" + " " + sfreq + " " + radio_num)
 +        print "%s replied: %s" % (rname, freq)
 +        start()
 +
 +    elif data == "gs":
 +        smeter = connect("getsmeter" + " " + radio_num)
 +        print "%s replied: %sdBm" % (rname, smeter)
 +        start()
 +
 +    elif data == "gp":
 +        preamp = connect("getpreamp" + " " + radio_num)
 +        print "%s replied: %s" % (rname, preamp)
 +        start()
 +
 +    elif data == "pon":
 +        preamp = connect("preampon" + " " + radio_num)
 +        print "%s replied: %s" % (rname, preamp)
 +        start()
 +
 +    elif data == "poff":
 +        preamp = connect("preampoff" + " " + radio_num)
 +        print "%s replied: %s" % (rname, preamp)
 +        start()
 +
 +    elif data == "gatt":
 +        preamp = connect("getatt" + " " + radio_num)
 +        print "%s replied: %s" % (rname, preamp)
 +        start()
 +
 +    elif data == "aton":
 +        att = connect("atton" + " " + radio_num)
 +        print "%s replied: %s" % (rname, att)
 +        start()
 +
 +    elif data == "atoff":
 +        att = connect("attoff" + " " + radio_num)
 +        print "%s replied: %s" % (rname, att)
 +        start()
 +
 +    elif data == "ga":
 +        get_all()
 +        start()
 +
 +
 +    elif data == "log":
 +        fname = raw_input("Enter a filename (or \"Return\" for default) :")
 +        if fname == "":
 +            fname = smlog
 +        # check file is valid
 +        try:
 +            f = open(fname, 'a+')
 +            f.close()
 +        except IOError:
 +            print "File/path not valid"
 +            start()
 +
 +        list_radios()
 +
 +        lradio = get_lradio()
 +
 +        while not lradio:
 +            lradio = get_lradio()
 +
 +        rname = get_rname(int(lradio) - 1)
 +        if lradio in log_active:
 +            print "Logging already active on " + rname
 +        else:
 +            tlog = int(raw_input("Enter a polling interval (seconds) :"))
 +            p = threading.Thread(target=log, args=(lradio, tlog, fname))
 +            p.setDaemon(True)
 +            p.start()
 +            log_active.append(lradio)
 +        start()
 +
 +    elif data == "sync":
 +        sync_result = sync()
 +        print sync_result
 +        start()
 +
 +
 +    elif data == "h" or data == "help":
 +        prompt()
 +        start()
 +
 +
 +    elif data == "q" or data == "quit":
 +        rx = connect("quit")
 +        print "Server says: %s " % rx
 +
 +    else:
 +        prompt()
 +        start()
 +
 +
 +def get_all():
 +    num = get_rnum()
 +    global radio
 +    print "There are currently %d radios connected." % num
 +    print "=" * 33
 +    for i in range(0, num):
 +        r = get_rname(i)
 +        n = "".join(("r", str(i + 1)))
 +        freq = connect("getfreq" + " " + n)
 +        mode = connect("getmode" + " " + str(n))
 +        smeter = connect("getsmeter" + " " + str(n))
 +        preamp = connect("getpreamp" + " " + str(n))
 +        att = connect("getatt" + " " + str(n))
 +
 +        print "Status of Radio %d (%s) \r\n" % (i + 1, r)
 +        print "Frequency : %s kHz" % freq
 +        print "Mode: %s" % mode
 +        print "S-Meter: %sdBm" % smeter
 +        print "%s : %s " % (preamp, att)
 +        print "=" * 33
 +
 +    print ""
 +
 +
 +def log(p, t, f):
 +    print "\n\n"
 +    tlog = t
 +    sradio = get_rname(int(p) - 1)
 +
 +    sr = "".join(("r", str(p)))
 +    while True:
 +        try:
 +            frequency = connect("getfreq" + " " + sr + "\n")
 +            smeter = connect("getsmeter" + " " + sr + "\n")
 +            mode = connect("getmode" + " " + sr + "\n")
 +            write_file(f, sradio, mode, frequency, smeter)
 +            time.sleep(tlog)
 +        finally:
 +            pass
 +
 +
 +def get_mradio():
 +    num = get_rnum()
 +
 +    mradio = raw_input("Choose Master radio number from the list: ").strip()
 +
 +    if not mradio:
 +        print "Please select a radio"
 +        return False
 +    elif int(mradio) > num:
 +        print "Selected radio not recognized"
 +        return False
 +
 +    else:
 +
 +        return mradio
 +
 +
 +def get_sradio():
 +    num = get_rnum()
 +    sradio = raw_input("Choose Slave radio number from the list: ").strip()
 +
 +    if not sradio:
 +        print "Please select a radio"
 +        return False
 +    elif int(sradio) > num:
 +        print "Selected radio not recognized"
 +        return False
 +
 +    else:
 +
 +        return sradio
 +
 +
 +def sync():
 +    num = get_rnum()
 +    print ""
 +    print "Set SLAVE to the same Frequency and Mode as MASTER.\r\n"
 +    print "Currently connected radios are:"
 +    for i in range(0, num):
 +        r = get_rname(i)
 +        print "%d is %s" % (i + 1, r)
 +
 +    mradio = get_mradio()
 +    while not mradio:
 +        mradio = get_mradio()
 +
 +    sradio = get_sradio()
 +    while not sradio:
 +        sradio = get_sradio()
 +    sr = "".join(("r", sradio))
 +    mr = "".join(("r", mradio))
 +    mfreq = connect("getfreq" + " " + mr)
 +    mmode = connect("getmode" + " " + mr)
 +
 +    sfreq = connect("setfreq" + " " + mfreq + " " + sr)
 +    smode = connect("setmode" + " " + mmode + " " + sr)
 +
 +    return (sfreq + "\r\n" + smode + "\r\n")
 +
 +
 +# Try to send and receive in one-go, to prevent the logging thread and the main prog
 +# getting the wrong receive data
 +
 +def connect(data):
 +    try:
 +        lock.acquire()
 +        global sock
 +        sock.sendall(data + "\n")
 +        received = sock.recv(2048)
 +    finally:
 +        lock.release()
 +
 +    return received
 +
 +
 +def write_file(fname, rname, mode, freq, smeter):
 +    filename = fname
 +    f = open(filename, 'a+')
 +    timenow = time.strftime("%d/%m/%Y %H:%M:%S", time.gmtime(time.time()))
 +    log = " ".join((timenow, rname, mode, freq, smeter, "\r\n"))
 +    f.write(log)
 +    f.close()
 +
 +
 +make_con()
 +
 +lock = threading.Lock()
 +get_all()
 +print "Please choose a radio\r\n"
 +radio_num, rname = set_radio()
 +while not radio_num:
 +    radio_num, rname = set_radio()
 +
 +prompt()
 +start()
 +
 +</code>
 +
 +++++
 +
 ==== Page Info ==== ==== Page Info ====
  
Line 646: Line 1130:
  
  
-{{tag>radio}}+{{tag>radio icr75}}
  
  
public/radio/radio_database/ic-r75.1657658556.txt.gz · Last modified: 06/03/25 06:49 GMT (external edit)