![1.jpg]

Figure 1 Overview of the work The tick-tick-tick-tick sound emitted by the radio station in the anti-war and espionage films must have impressed everyone, right? In fact, it is to convert the information into Morse code through some kind of device, and then transmit it through the radio. The devices currently used by military and radio people are shown in Figure 1. The two on the left are military devices. The first one is called a hand key (electric key). It is essentially a switch that manually converts information into Morse code. , has shortcomings such as slow speed, error-prone, uneven dots and strokes, and high professional requirements. The middle one is called an electronic key. It has a built-in microcontroller and is an electronic device. It is a semi-automatic conversion. The shooting speed has been improved and the difficulty of use has been reduced. However, it requires a combination of shooting (each character requires more than 2 keystrokes). Professional training is required, and there are varying degrees of garbled characters, word changes, missing intervals, and crashes. The one on the right is currently used by some radio amateurs and has similar features to the one on the left. Based on the above situation, I decided to create two brand-new Morse code sending equipment (Type A, Type B), which are easy to use, accurate and efficient, stable in operation, without professional restrictions, and have a certain degree of intelligence. , hence the name: Moss Elf. Among them, Moss Elf type A can operate independently, and type B needs to be used in conjunction with the host computer PC software. Type B is the most efficient, the most convenient to use, and has low manufacturing cost. These two devices are currently being trialled within a certain range. Type B has been upgraded based on the trial situation. The project is planned to complete the trial by the end of September and complete the upgrade in October. From a performance perspective and development trend, this equipment is bound to eliminate the current Morse code sending equipment, and is very suitable for military-civilian integration projects. This project has applied for a patent. approximately (Type A is shown in Figure 2, so stay tuned). ![2.jpg]

Figure 2 1. Work details One of the main design principles of Moss Elf B is to minimize the difficulty of operation, so that anyone can work on the machine without professional training, and to provide enough auxiliary functions. ![3.png]

Figure 3 Moss Elf B type consists of two parts: the host computer software (hereinafter referred to as the host computer) and the Elf box (hereinafter referred to as the Elf). The wizard is shown in Figure 3, which mainly completes the function of converting characters into Morse code. The host computer is installed on the computer and mainly completes information input and control functions. Its main interface is shown in Figure 4. ![4.png]

Figure 4 Compared with the independently operating model A, the hardware and embedded programs of the Moss Elf B type are relatively simple. The Arduino Nano development board receives the content of the message from the host computer and temporarily stores it, converts the message into Morse code character by character, and controls the on-off and on-off duration of the analog switch according to the dots and dashes of the Morse code. The analog switch is connected to the CW hole of the radio. Real-life messages contain some special symbols in addition to letters and numbers, so no existing libraries on the network are used. The Genie is equipped with a working indicator light (green LED), which lights up about 2 seconds after connecting to the computer, indicating that it has started normally. The elf is equipped with a buzzer, which simulates the sound when the switch is turned on, and makes a ticking sound when sending. It is used for operators to adjust and identify those who are capable, or for daily message copying and receiving training. The buzzer can be used by the upper Quick tool control of the machine. The Genie is equipped with 2 aviation plugs (more can be expanded), which can connect to 2 radio stations at the same time to meet the actual needs of using multiple radio stations to transmit at different frequencies or directions. The main interface of the host computer is shown in Figure 3. Each area is introduced in detail below. Elf status: When it is green, it means that the computer and the Elf are connected; when it is red, it means that the computer and the Elf are not connected. When not connected, all areas of the software cannot be operated. Transmission speed: The transmission speed range set by the system is 60-200 yards/minute. If it exceeds the range, the system will automatically process it as 60 or 200. Press Enter in the transmission speed input box or leave the cursor in the transmission speed input box. The wizard will send The reporting speed changes. Header button: Click this button to select long or short header. The long header includes number, group number, level, date, time and comments. The short header includes number, time and comments. Digital code pattern: Set whether the numbers in the message area and service contact area are sent as long codes or short codes. Service contact area: Mainly used for service dialogue with the other party. Up to 50 symbols can be input. It supports text input and one-time sending. Header area: Except for notes, all header items are required. To send the header, you can directly click "Send Header" on the shortcut toolbar, or press "ctrl + Enter key combination" with the cursor in the notes area. The number 0 in the header is sent as a short code. If there are letters in the number, only the number 0 in the number is sent as a long code. Numbers can only be entered with numbers, slashes, EX, CCK, and TRS. Message area: There is no limit to the length of the content in the message area. It will automatically wrap or press Enter to wrap. Shortcut toolbar: Clear message means clearing the contents of the message area, Start message means start sending the contents of the message area, Reset wizard means the wizard will stop sending immediately, and the frame numbering is based on the topographic map numbering standard published by the country. The interface of the created gadget is shown in Figure 5. ![5.png]

Figure 5 ![6.png]

Figure 6 The host computer sends the message content and control commands to the elf through the USB interface. Ordinary sending function: Click to start the message, enter the content in the message area, and the host computer will send the content to the elf group by group (grouped by space area and carriage return line feed area). The content that has been sent to the elf will be displayed in red font, and It is locked and cannot be modified. Content that has not yet been submitted to the wizard is displayed in black font and can be changed at will. You can pause or stop at any time while sending. The header supports one-click sending. Enter various contents in the header area and click the shortcut tool "Send Header" to automatically format the header content as required and submit it to the wizard. In addition to manually inputting the message content, you can also call files and automatically load the report base. Calling the file means saving the message content in a text file in advance for later use. Calling the report base means that the system has a built-in report generation module, which dynamically generates the report when called. Text, the calling interface is shown in Figure 6. The host computer supports the automatic call function. Enter the content of the automatic call in the service contact area, click the ▼ symbol next to "Called for own use" in the shortcut toolbar, and click the "Start Automatic Call" item in the pop-up menu. The wizard will be controlled by the host computer. The content of the automatic call is sent in the next loop. The special reporting function is not required for civilian use and will not be introduced. The system setup is shown in Figure 7. For detailed usage, please refer to the attached user manual. ![7.png]

Figure 7 2. Challenges faced by the work and problems solved. Message modification function at any time: After the Elf trial in August, users put forward new requirements that messages should be able to be modified at any time before being sent out by the radio. The host computer made major modifications, and the report The text is changed from key trigger to content trigger. The host computer is made using VB6, and the message area has been replaced by a rich text box control from the original text box control. This control provides more editing functions, allowing modification of the fonts and locking functions of some texts, and at the same time, setting the logo has been submitted to The location of the wizard's content can be well adapted to the new needs put forward by users. At the same time, the host computer submits a set of messages to the elf instead of one character each time to reduce the pressure on the microcontroller and ensure the stability of the elf operation. The user also expressed that it is completely acceptable. Elf connection status monitoring: The Elf and the host computer must cooperate closely. It is very important whether the connection between the two is normal. If the connection is suddenly interrupted, it should be discovered in time and remind the user in some way to prevent the user from doing "waste work". When the elf is idle, it reports its own status to the host computer every 500MS (similar to the heartbeat in the Internet of Things). When the elf is not idle, it reports its status to the host computer every time it sends a character. If the host computer does not receive the report from the elf within a certain period of time, Just judge that the elf is offline. At the same time, when the host computer submits a message or issues a command to the elf, if the connection is interrupted, the error processing module will be triggered, and the elf will be found to be offline. When the host computer finds that the elf is offline, the elf status indication on the sending interface changes from a green circle to a red circle, and the sending interface is locked. The user cannot perform any operations until the connection with the elf is restored. Receive buffer overflow: Arduino IDE sets the serial port buffer to 64 bytes by default. When the data exceeds 64 bytes, Arduino will discard the data received subsequently. When the host computer submits the header to the Genie, the maximum content length can be reaches 80, there is a possibility of overflow. Change the serial port receiving buffer to 200 by consulting the information. For specific methods, please refer to: [https://www.arduino.cn/thread-7885-1-1.html](https:/ /www.arduino.cn/thread-7885-1-1.html). 3. Key points involved in the hardware and software parts Radio interface: Because the electrical parameters of the CW interface of different radio stations are different, the two radio interfaces of Elf cannot be simply connected together. The analog switch model used by Elf is ch440g. Contains 4 channels of single-pole double-throw analog switches. The two radio interfaces occupy one channel each. The S2A and S2B pins of the chip must be left floating. If the wizard needs to control more than 2 radio stations, it must be expanded by adding ch440g. Buzzer: The elf's buzzer requires the host computer to control whether it is enabled or not, so it is controlled by 2 signals. The buzzer is driven by two serially connected triodes S9013. One triode is connected to the DC pin of the analog switch chip through a resistor to realize the dot-and-dashes control of Morse code. The other triode is connected to the D4 pin of the microcontroller development board through a resistor. Realize the host computer command to control the switch sound. Indicator light: The Genie sends the dots and dashes of Morse code to the radio station. The light goes out when the time comes, and lights up at other times. This achieves the purpose of indicating the power and transmitting status with one light at the same time. The light is connected to the S2D of the analog switch chip through a current-limiting resistor. pin, the DD pin is grounded, and the S1D pin can be left floating. Dynamic bottom report: In order to make the host computer more compact, the host computer's bottom report is dynamically generated. The method is to flexibly use VB's random function. The relevant code is as follows: Private Function makeNumbers(ByVal fromPage As Long,ByVal groups As Long) Dim msg As String Dim i As Long Rnd (-1) Randomize 1 For i = 0 To fromPage - 1 ) * 100 Rnd Next i For i = 1 To groups msg = msg & Format(Fix(Rnd(1) * 10000), "0000 ") Next i makeNumbers= msg End Sub Elf connection status monitoring: When the host computer finds that the Elf is down Be sure to close the serial port when you are offline, otherwise the serial port will remain occupied and affect the next connection. The relevant code is as follows: 'Elven heartbeatPrivate Sub MSComm1_OnComm() if MSComm1.CommEvent=2 then healthPra=0 End Sub 'Submit errorPrivate Sub bytesToNano(ByRef cmd() As Byte) On Error GoTo errorPro MSComm1.Output = cmd errorPro: If Err.NUMBER = 8018 Then onLineCheck = 250 tmrOnlineCheck_Timer End If End Sub 'Timing check parameter onLineCheck Private Sub tmrOnlineCheck_Timer() onLineCheck = onLineCheck + 1 If onLineCheck >= maxLinkTime Then tmrOnlineCheck.Enabled = False tb1.Enabled = False frameMain.Enabled = False se connectedNano = False shapeState.FillColor = vbRed End If End Sub Automatic connection wizard: After the host computer starts, starting from port 1 to 36, use the method MSComm1.PortOpen = True to try to open the ports in sequence. If it can be opened successfully, send handshake command 231 , wait for the other party to reply 231. If received within 250ms, the connection is successful, otherwise it will try the next port. If none of the 36 ports are successfully connected, reconnect after a period of time. The relevant code is as follows: 'Try to open the serial port Private Sub openPort() On Error Resume Next Dim i As Byte For i = portId To 36 portId = i Err.Clear If MSComm1.PortOpen Then MSComm1.PortOpen = False MSComm1.CommPort = i MSComm1. Settings = "115200,n,8,1" MSComm1.PortOpen = True MSComm1.InBufferCount = 0 MSComm1.OutBufferCount = 0 If Err.NUMBER = 0 And MSComm1.PortOpen = True Then tmrConnect.Enabled = True 'Open successfully, wait for reply Exit Sub End If Next i portId = 1 tmrConnect2.Enabled = True End Sub 'No reply received, try the next portPrivate Sub tmrConnect_Timer() tmrConnect.Enabled = False portId = portId + 1 openPort End Sub 'Reconnect after a period of time Private Sub tmrConnect2_Timer() tmrConnect2.Enabled = False If tmrConnect2.Interval
Moss Elf Type B User Manual_Min.docx
Gerber_morseB_0918.zip
BOM download
Schematic_#The Fourth Lichuang Competition#Mos Elf Type B——A new type of Morse code sending device_2022-10-05.pdf
Sheet_1_2022-10-05.schdoc
PCB_morseB_V1_2022-10-05.pdf
PCB_morseB_V1_2022-10-05.json
morseB_V1_2022-10-05.pcbdoc
Gerber_morseB_V1_2022-10-05.zip
SCH_#The Fourth Lichuang Competition#Mos Elf Type B - a new type of Morse code sending device_2022-10-11.json
58950
electronic