Todd Peterson
Published

Morse code over Wifi

From a client on the local network, I can send a message to a PSoC6 BT/WLAN board and the led blinks the message in Morse code.

BeginnerFull instructions provided1 hour260
Morse code over Wifi

Things used in this project

Hardware components

Infineon CY8CPROTO-062-4343W
https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/
×1

Story

Read more

Schematics

Out-of-box CY8CPROTO-062-4343W schematics

I did not have to modify the board in any way.

Board

Code

Morse Code Blinker ModusToolbox Project

C/C++
Used example Infineon Wifi UDP example to do super simple implementation. Change Wifi ssid and password to match your local network. When the code runs on the PSoC, the serial console lets you know the IP address assigned by your local area network DHCP server. Static IP addresses could be used to alleviate this annoying problem.

The output blink rate for dots and dashes may be controlled by the line
#define TIME_UNIT_MS 100
in udp_server.c
No preview (download only).

Client UDP code

Python
Send a message from a remote computer on the same local network to the PSoC to blink the message in Morse code. Change IP address and port to suit what your local network and the PSoC are. Written in Python3, but easy to covert to Python2. Just remove b' on line 8 and the .encode() on line 11.
#!/usr/bin/python3

import socket
import sys

UDP_IP = "192.168.0.174"
UDP_PORT = 57345
MESSAGE = b"sos"

if len(sys.argv) > 1:
    MESSAGE = sys.argv[1].encode()
print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)

sock = socket.socket(socket.AF_INET, # Internet
                     socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

Credits

Todd Peterson

Todd Peterson

8 projects • 5 followers
Specialist in real-time embedded systems hardware, software and systems integration. Well rounded in many engineering disciplines.

Comments