Some Fun with Claude

I've had some downtime, recently, courtesy of a couple nasty health issues (no, not cancer).  In order to relieve some of the boredom while recovering, I started sorting through some of the electronic "stuff" I've accumulated for projects which, in turn, never seemed to get done.  I can across a ESP32-S2 feather - the one with the built-in TFT display - and thought it might be fun to turn it into a cw decoder.  (Yes I know such things are no substitute for the ability to copy by ear, but remember, I was bored.)  I'm also not a big fan of "vibe coding" but for this exercise I though it'd be interesting to see what Claude could do.  Some I told it:
 
1. Target device is Adafruit ESP32-S2 TFT Feather board.
2. Will be using the current Arduino IDE for editing, compilation and uploading.
3. Input will be raw audio on analog input A5.
   a. Audio input will be line level (2.00 volts - high impedance).
4. Decoded text will be displayed (in real time) on the integral tft display.
5. Incoming signal will not be perfect
   a. program must deal with "hiss" (high frequency noise) that
      accompanies the desired audio.  May need some sort of low
      pass filtering.  Desired audio will be in the 300 Hz to
      1000 Hz range, typically.
   b. Character/word spacing may be erratic and vary. Program must
      deal with this.
   c. Sending speeds from 5 words/minute (wpm) to 50 wpm must be
      accommodated adaptively.  Would like to have a real-time wpm display.
   d. Signal level can change.  Program must provide some sort
      of AGC to deal with this. Fading could be rapid or slow. 
      Decoder must not lock up on very strong or very weak
      signals. 
   e. Do not use look-up table for decoding.  Suggest binary
      tree algorithm or other more modern approach.  Feel free
      to search on-line for current state of the art.
   f. Must be able to decode letters, numbers, and punctuation.
 
Well it took Clause about 5 minutes to give me a decoder sketch which didn't compile.  After not so politely asking Claude to fix the compile errors, I got a sketch that actually worked pretty well (or as least as well as any software decoder works).   One of the days I'll make a short clip of it decoding a real cw signal (not W1AW code practice, which it gets perfectly).  The sketch as produced by Claude, follows (I claim no credit):
 
You can find it here:   https://github.com/dave-metzler/AI-Morse-Decoder-.git

Comments

Popular posts from this blog

A Half-baked Fix for Si5351 Quadrature Issues

Playing with Phasing - part 1

Revisiting the LT5517