Home Creators Posts Import Register Favorites Logout

Content

Hi folks!

It seems that, what with Midjourney, Dall-E and, most recently, ChatGPT, everyone is getting very excited about A.I. at the moment. So, I thought I'd jump on the boat....

But, rather than looking at the high-end distributed supercomputer-powered awesomeness of those content generation engines, I've been focussed on something a little closer to home - whether A.I. can be used to interpret player inputs in an escape room puzzle controller. So, I picked an example of a classic Morse code puzzle, where players need to tap out the sequence of dots and dashes to convey a particular message. Rather than hard-code any rules about the precise length of pauses or durations of those elements, I decided to use machine-learning to train a model that would learn the Morse code alphabet by itself. 

Sure - there are example Arduino Morse code decoders already available on the internet but all those I found were very rigid. They needed to be explicitly told the pattern of dots and dashes for every letter, and only worked when supplied with very clean input that adhered to a near-perfect Morse code standard, or required some degree of manual tuning to distinguish between the length of dots and dashes. But, by using machine learning to train an A.I. based on real-world player input instead, my hope is to have a decoder that is not restricted by such arbitrary, rigid interpretation or "correct" input. It classifies data based on rules that have been created based on actual input, on actual hardware, of actual players, and therefore is less likely to incur player frustration. And, even though I've only conducted limited tests so far, I'm really encouraged by how it's performed so far - and it can be run on a single ESP32!

I've made the code available in my GitHub repository, which you can find here: https://github.com/playfultechnology/esp32-morse-decoder 

It makes use of two Python libraries:

SciKit-Learn  (https://scikit-learn.org), which trains the machine learning model

MicroMLGen (https://pypi.org/project/micromlgen/), which converts the output from SciKit-Learn into a C header file that can be imported into a regular Arduino/ESP32 sketch

I'm really excited that there are loads of possible uses for this beyond this fairly trivial example - if you have any questions or comments of how you'd like to see this tested, please let me know - and do try it yourself!

And, as it's now mid-December, may I take this opportunity to wish you a very Happy Christmas, and may it be peaceful and full of joy, wherever you may be in the world. 

x

Files

maxresdefault.jpg

There's a massive buzz about A.I.-generated content at the moment - both the incredibly convincing quality of the content itself (and associated ethical questions about deep-fakes etc.), and also the sheer technical complexity of models like ChatGPT, Midjourney, Dall-E, which have made advanced machine-learning models available to anyone, requiring only a simple phrase or word in your browser as a prompt. But there's many more uses for artificial intelligence than just churning out blog content and superimposing celebrities' faces on dodgy videos... and, in this tutorial, I'm going to demonstrate just one practical example: a classifier function that I'm going to train to decode Morse code. And, rather than require distributed server clusters with petaflops of processing power, I'll be running the whole thing on a humble ESP32 processor.... simpler models could even be run on an Arduino Nano! I'll be using the SciKit-Learn Python library (https://scikit-learn.org) and a set of training data of button presses gathered from the Arduino IDE serial monitor. I'll then use MicroMLGen (https://pypi.org/project/micromlgen/) to convert that into a C header file that can be imported back into an Arduino sketch, and, in just a few lines of code, can be used to classify any new input of dots and dashes into a letter - without ever having been explicitly told the Morse code alphabet! The use-case I demonstrate is for a Morse code puzzle in an escape room, but this obviously has many more potential applications - let me know if you have any suggestions in the comments ;) 00:00:00 - 00:01:06 Introduction 00:01:07 - 00:03:11 The problem:- decoding Morse code 00:03:12 - 00:04:24 Gathering training data 00:04:25 - 00:07:47 Creating the model 00:07:48 - 00:09:06 Using the classifier in an Arduino sketch 00:09:07 - 00:10:43 Demonstration 00:10:44 - 00:12:29 Wrapup You can download all the code used in this tutorial from my GitHub repository at https://github.com/playfultechnology/esp32-morse-decoder If you enjoyed this video or found it helpful, please like and subscribe to this channel. And, if you'd like to download the resources used in all the escape room projects shown on this channel (and support me to continue making more tutorials in the future!), please check out my Patreon at https://www.patreon.com/playfultech

Comments

george halbart

Morse code is a great example of a structured communication system that works well for pattern recognition. It’s interesting to see machine learning being applied to signal decoding.

Miguel Angel Lozano

And how can I add a little display to show what letter or number has been translated instead of the serial monitor. To bring it into the game as a kind of translator.