These are brief notes on an IR test transmitter designed for use in my To the Birdhouse geocache1.
Desiderata
This emitter has to flash an infra-red LED at 40kHz modulated with both a 800Hz tone, and the dit-dah patterns of Morse Code.
We need a push button to select different Morse messages.
It will typically run on someone’s desk, so USB power is convenient.
Beyond this, it should be cheap and simple for me to build.
Hardware
At the time I designed it, it was cheaper to buy Blue Pill STM32 dev boards than the bare processors, so I designed a daughter board with a couple of LEDs (one IR, one visible), a current limiting resistor, and a push button.
The daughter board fits over the progamming header on the Blue Pill. A little finesse is needed to avoid blocking the header.
Schematic
As you'll see the schematic is almost trivial:
PCB
The PCB is simple too. The two unplated holes allow the user to see the status LEDs on the Blue Pill.
Firmware
The STM32F103 on the Blue Pill is perfectly fast enough to drive the LED with simple bit-banging. There is nothing clever about the code.
All of the action happens during the
sys_tick
interrupt which is called every 12.5μs.The data for the Morse messages is defined in
morseout.c
which is generated by morsetool5. Morsetool lets you defined multiple messages, and the push button cycles through them.libopencm36 is used to initialize some of the hardware; the source is laid out in the libopencm3 way.
Design Files
The firmware and PCB design can be downloaded from GitHub7. The electronics was designed with KiCad, the firmware is written in C and uses libopencm38. Random bits of Haskell and python were used too.
References
- 1. https://coord.info/GC86BQY
- 2. em-bp.jpg
- 3. em-bp-schem.svg
- 4. em-bp-3d.png
- 5. https://github.com/mjoldfield/morsetool
- 6. http://libopencm3.org/docs/latest/html/index.html
- 7. https://github.com/mjoldfield/ir-morse-toys/tree/main/tx-bluepill
- 8. https://libopencm3.org