BBC micro:bit V2を用いたモールス符号トランシーバ

Initial released on QSL.net: 5 Oct. 2021
Republished with revision: 21 June, 2024

 

micro:bitを使ったモールス符号トランシーバです.見通しで140mまでの通達距離があります.発光信号付きでQSK動作です.

デモ動画では3VとPin1に接続した外部電鍵で操作していますが,ボタンAでも操作可能ですので,micro:bit V2だけで動作させることができます.
動画中のモールス符号はCaravanの1971年のアルバム“In the Land of Grey and Pink”に収録されている“Golf Girl”の曲中に入っているものです(あ゛,最後の“S”が脱字になってる orz).
以下,Pythonソースコード(ライセンス:CC BY-NC-SA 4.0 国際)です:

#  Morse Code Transceiver V2, featuring signal lamp and full QSK
#  (c) 2021 by Cosy MUTO, Nagasaki Univ. (aka JH5ESM)
#  Works with the BBC micro:bit V2 only
#  CC BY-NC-SA 4.0 International  https://creativecommons.org/licenses/by-nc-sa/4.0/

from microbit import *
import radio

radio.config(group = 1)
radio.on()

pin_speaker.set_analog_period(1)
mark = Image("09990:" "99999:" "99999:" "99999:" "09990:")
key_old = 0
rx = 0
rx_old = 0

while True:
    key = (pin5.read_digital() ^ 1) | pin1.read_digital()
    radio.send(str(key))
    rbuf = radio.receive()
    
    if rbuf == '0' or rbuf == '1':
        rx = int(rbuf)
    
    if (key_old == 0 and key == 1) or (rx_old == 0 and rx == 1):
        display.show(mark)
        pin_speaker.write_analog(511)
    elif key == 0 and rx == 0:
        display.clear()