Close
0%
0%

Simple Universal Modem

Can it save audio? It can save data too!

Similar projects worth following
The Simple Universal Modem let's you convert data to and from audio - no matter if it's a modern PC, an old MP3 player, a cassette player or a 1972 reel-to-reel tape deck!

Video: https://youtu.be/KLn8S8x0VVo

PCBs for sale @ iMania.dk
https://www.imania.dk/index.php?cPath=204&sort=5a&language=en

This little board has everything you need to save data from a retrocomputer, a PC, a microcontroller or just about anything else you can think off. On the other side of things it'll save data to pretty much any media that can record and play audio. 

This relatively tiny board of less than 50x15mm gives you an easy way to put any old audio device to good use, especially for era appropriate retrocomputer data storage or just for the fun of putting data somewhere new and interesting. 

Finally you have a good excuse to save that old cassette player and put it to good use instead! 

And even better: If you have some old tapes lying around with invaluable data from the 70's or 80's, the Simple Universal Modem, will make it super easy to read the data with a modern MCU, Arduino, Raspberry Pi, since it has an encoding agnostic demodulation interface. 

To demonstrate how it can be used with old hardware - on both sides - I have successfully saved and played back 1200bps data, in Kansas City Standard format, using my #ABN6502 SBC R1 microcomputer. 

Technical description

On the technical side of things this board has a simple 5 stage RC filter along with an Emitter Follower buffer transistor used for filtering and modulating a square wave into a sine-like signal, that will record and playback better on tape and other old mediums than a harsh square wave that contains harmonics and other sources of analog trouble. 

The demodulator consists of a LM393 comparator set up as a zero crossing detector, outputting a nice clean square wave for digital circuits to decode.

Since there's a significant lack of standardization for TRRS pinouts, the modem simply takes advantage of that and leaves the pins jumper selectable according to the silkscreen text on the back of the PCB. 

The TRRS jack's poles are meant to be configured using J1-J4 jumpers. An "iPhone" TRRS cable has the pinout right, left, GND, microphone - "Android" TRRS cable usually is right, left, microphone, GND. A standard TRS cable plugged into this would be right, left, GND, GND - for my 1972 tape deck I used a 3.5mm -> RCA/Phono cable and had it configured for ModIn, Modout, GND, GND, and then had it connected to left line out and left AUX in. 

Caveats include that you still have to generate a square wave and not just a serial signal, but the positive side to that is that you are less locked in to a certain baud rate(considering the tx RC filter can also be changed with new values), adding to the universality of the board. 

I/O requirements

TX:
The component values are configured to expect a 1200/2400Hz FSK modulated square wave on the DataOut(DOut on the silkscreen) pin. This signal is band pass filtered to make a 1V peak to peak sine wave that is output on the ModOut pin(Capacitively coupled) - this signal works best with a "line in"/AUX in on the recording device. A microphone input typically has too much amplification but could work if it's turned down sufficiently. 

RX:
The ModIn pin expects an FSK modulated sine wave(Audio). 1V peak to peak recommended input. Output on the DataIn(DIn on the silkscreen) is a 5V square wave that can be used to decode the FSK decoding using an active low interrupt pin. The ModIn pin is not filtered but capacitively coupled using a 100nF cap. It's been tested using computer audio and tape with 1200/2400Hz FSK.

Software suggestions

For my #ABN6502 SBC R1 I simply generate a square wave using Timer 1 and PB7 for TX and count the interval between falling edges using Timer 1 and CA1 interrupts for RX. The source is open for that project too, so check it out. 

If you just need a cheap way to get data to an MCU or retrocomputer, you can use minimodem (available on many linux package managers and homebrew for macOS) to convert a binary to a format of choice for your project. 

For Arduino, etc, using a timer and interrupts should work perfectly fine too - I haven't...

Read more »

IMG_4616.jpeg

High resolution photo

JPEG Image - 16.19 MB - 10/18/2022 at 09:57

Preview
Download

IMG_4663.jpeg

High resolution photo

JPEG Image - 16.78 MB - 10/18/2022 at 09:57

Preview
Download

IMG_4571.jpeg

High resolution photo

JPEG Image - 12.98 MB - 10/18/2022 at 09:57

Preview
Download

IMG_4670.jpeg

High resolution photo

JPEG Image - 11.70 MB - 10/18/2022 at 09:57

Preview
Download

IMG_4686.jpeg

High resolution photo

JPEG Image - 7.13 MB - 10/18/2022 at 09:57

Preview
Download

View all 11 files

  • 1 × LM393 U1 Amplifier and Linear ICs / Comparator ICs
  • 1 × BC547 Q1 Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 5 × 100nF 0603 C1, C2, C8, C9, C10
  • 4 × 470pF 0805 C3, C4, C5, C7
  • 1 × 1nF 0805 C6

View all 17 components

  • PCBs for sale

    Anders Nielsen01/16/2024 at 19:42 0 comments

    The #Simple Universal Modem got a reasonable Top 50 finish in the 2022 Hackaday Prize but I didn't have a way to sell and ship PCBs.

    Thankfully, now I'm shipping enough #65uino kits that there's no extra hassle with also offering PCBs for the modem.
    Only PCBs available for now (price 2€ + shipping) - I can make full kits available on request. 

    https://www.imania.dk/index.php?cPath=204&sort=5a&language=en

  • PCBs for sale

    Anders Nielsen01/16/2024 at 19:42 0 comments

    The #Simple Universal Modem got a reasonable Top 50 finish in the 2022 Hackaday Prize but I didn't have a way to sell and ship PCBs.

    Thankfully, now I'm shipping enough #65uino kits that there's no extra hassle with also offering PCBs for the modem.
    Only PCBs available for now (price 2€ + shipping) - I can make full kits available on request. 

    https://www.imania.dk/index.php?cPath=204&sort=5a&language=en

  • Been there, done that, T-shirt's on its way!

    Anders Nielsen10/22/2022 at 07:23 0 comments

    It really almost felt like cheating when I heard last week's Hackaday podcast and Elliot chose 300 baud KCS for the "What's that sound?" segment. I already had the equipment to do the decode in hardware on my desk.

    If it wasn't for the fact that my code was still set to 8 bits instead of 11 bits, it would've been too easy but I took it as the final push to get the source code finished. 

    And behold - the message "READ MORE HACKADAY" appeared(plus a few control characters) and to my surprise I also won the segment competition after sending in the answer.. And soon I'll have a Hackaday T-shirt to show for it! 

    If you also want the ability to decode random nerdy messages on podcasts, then you can go right ahead and build this project. 

  • New video posted.. Finally!

    Anders Nielsen10/20/2022 at 20:52 0 comments

    I think it's actually the first time I had a PCB prototype made and nothing needs bodging, but it was certainly the right time for everything to work out. With the competition submission deadline moved up, my other project stealing my attention and... life... it certainly was a welcome surprise that it just worked. 

    The video itself required me to acquire some new skills in Keynote as I struggled to find a good way to express the relationship between the hardware and the waveforms with still photos and video sequences. I'm not sure "skills" is the right word for the results but I hope the general idea of what I tried to accomplish came across. 

    Either way, tell me how you think it went :) 

  • New photos, don't they look nice?

    Anders Nielsen10/18/2022 at 10:17 0 comments

    I finally got around to taking some new photos of the project and I hope they show exactly how tiny the board is compared to my #ABN6502 SBC R1 - actually the whole board is smaller than the 40 pin DIP packages of the 6502 and 6522's.


    I guess it could be even smaller if I'd skipped the configuration jumpers and the extra row of I/O pins - you don't really need the ModIn/ModOut pins or the extra GND/5V pins - but maybe they will be handy some time. You never know when you'll need an extra pair of power lines. 

    The project photos only allow 6 photos < 5MB so I've uploaded all the high resolution photos I have to the project files. 

  • The curious case of the orphan APRS code

    Anders Nielsen10/17/2022 at 09:20 0 comments

    Even though I finally implemented the final piece of the Kansas City Standard code with the start and stop bits, I have to admit I have left in some orphan code in the modem driver. 

    A while back I had to see if there was any way this could be used for the ham operator on a budget’s dream – APRS decoding.
    APRS is a global packet radio service that let’s radio amateurs send small messages, often with location information, and have them relayed to the intended recipient, and as luck would have it the protocol isn’t that far off from KCS at 1200 baud – except that the encoding is NRZ and it uses the improved frequencies of 1200 and 2200, meaning less problems with harmonics. 
    Though the frequencies are different, they’re still close enough that we don’t need new filters for transmission/modulation – and currently the Simple Universal Modem doesn’t rely on any filters on the demodulation side. 

    But that’s awesome, right?
    Well yes, but.. Those filters are missing on the demodulation side because the modem expects a clean audio signal – and certainly not the pile of RF noise goo that comes out of a Baofeng. 
    The issue here is that the modem works by detecting every zero crossing with a certain margin provided by the hysteresis and that amount of margin is easily overcome by only a tiny amount of static noise. 
    Any noise strong enough to cause a zero crossing + hysteresis will garble up the data with no real way of recovery. As far as I can tell this problem is hard to overcome without a signal to noise ration that is far far better than what’s plausible on the RF bands. 

    But what about transmission? That’s not a problem, right?
    Well… It kinda is too. If we open an APRS packet in Audacity you might notice something rather peculiar. To me at least..

    The frequencies change at different phases of the waveform! Remember those “improved” frequencies? Well, it turns out that when your baud rate isn’t a multiple of your frequency, you run into situations like this. There’s simply not enough room in one 1200 baud bit length for two waves of 2200Hz, so the wave changes its frequency at random places. 
    Since we’re using T1 and PB7 to generate the initial square wave, which means we can only change the frequency at a zero crossing, there’s simply no way to replicate this behavior. 
    Maybe the receiving station could still decode the packet if we rounded to the nearest zero crossing but that would, sadly, still be out of spec. On the demodulation side this is also a bit of a problem since the time between zero crossings vary depending on how much of the wave was snipped off – and this propagates until the NRZ encoding does it’s job and limits the amount of marks allowed in a row… But well after the damage has been done to our attempts at frequency detection. I did manage to get around this – rather ungracefully – by compensating, based on the previous bit. Not great, not terrible. 

    So.. I decided to spend my time elsewhere and postpone the pursuit of a super cheap packet radio for another day.
    I might pick it up again but I’m almost hoping someone will pick up the torch and submit a pull request. 

    And that was the story of the orphan APRS code in the Simple Universal Modem repo.

  • Things are going in the right direction!

    Anders Nielsen10/16/2022 at 14:14 0 comments

    This weeks Hackaday podcast inconveniently gave me some extra homework, pretty close to the Hackaday Prize submission deadline. 

    Since the deadline was moved up, I now only have a week to finish up the submission video and make sure I have all the technicalities in order. Last week I got the new PCBs in the mail, together with the boards for my #ABN6502 SBC R1  and magically everything seems to work as I intended. 

    But back to the podcast homework - "What's that sound?" certainly sounded familiar to me so I got a reminder that I hadn't finished the code to send and detect the start and stop bits that I lazily skipped over when getting it running the first time. Whoops!

    I'm not going to spoil the podcast competition but I certainly had a feeling that I would need to finish that piece of code eventually - and at least now it is ready to handle start and stop bits as well. 

    We will see if my guess for this week's sound was correct when the next podcast airs :) 

    Later in the coming week I'll - hopefully - post the required 2-5 minute video about this project, as well as some photos of the finished PCB. 

  • It even works with Microsoft BASIC!

    Anders Nielsen09/21/2022 at 14:53 0 comments

    It's hard to make a big sensation from something that does a seemingly simple thing, but I have to say I'm really happy with it - it does what it does and does it well! 

    However, that does mean you have to give it a great big "think" to improve it. I've had suggestions like changing the resistor values to improve the bias level of the LM393, since the range of the comparator actually isn't GND to VCC like you'd expect but only GND to VCC-1.5V. Luckily that didn't even involve changing the PCB. 

    Hopefully I can at improve it a bit more without adding to the cost - it really is supposed to be as cheap as possible. 

    But speaking of PCB - I haven't even ordered it yet, since I'm hoping to order it together with my new #ABN6502 SBC R1 PCB's(they need a few of the actual R1 features moved to the PCB instead of floating in free air :)) 

    For now I've moved it to a tiny little breadboard and featured it in my new video about running BASIC - the Simply Universal Modem play's a big part as I couldn't save and load without it. And it actually worked perfectly the first time!

    Check it out! :D 

  • Demo video out!

    Anders Nielsen07/21/2022 at 04:51 0 comments

    I'm super happy to say the long-awaited video of my Simple Universal Modem is now out on Youtube. 


    You will see me demonstrate the modem in different ways and talk a bit about how howbrewers started using tape in the 1970's and all the details you'll need to make your own is right here on hackaday.io

  • You can now make your own!

    Anders Nielsen07/16/2022 at 20:50 0 comments

    Kicad files, along with a zip of the gerber files, and schematic as PDF has now been uploaded to Github. 

    I haven't ordered boards yet, but if you want, you now have a chance to beat me to it! (Goes without saying the PCB layout is untested)

    https://github.com/AndersBNielsen/SimpleModem

View all 12 project logs

  • 1
    Send gerber files from Github to your favorite PCB manufacturer

    There's a zip with all the usual layers

  • 2
    Source components

    Hopefully you have most in your junk pile

  • 3
    Solder away!

    ..in a well ventilated area. 

View all 6 instructions

Enjoy this project?

Share

Discussions

Dr PEKER wrote 09/19/2023 at 14:16 point

Where is the schematic?

  Are you sure? yes | no

Anders Nielsen wrote 09/19/2023 at 21:07 point

https://github.com/AndersBNielsen/SimpleModem

  Are you sure? yes | no

Dr PEKER wrote 09/20/2023 at 11:44 point

Could you please PDF schematic share? I cannot view kicad files.

  Are you sure? yes | no

Anders Nielsen wrote 09/26/2023 at 08:17 point

PDF was right there too :)

https://github.com/AndersBNielsen/SimpleModem/blob/main/SimpleModem.pdf

  Are you sure? yes | no

Ale o co chodzi wrote 07/13/2023 at 16:24 point

similar art. https://blog.arduino.cc/2021/07/27/send-text-messages-over-ham-radio-with-the-hammessenger/?que

  Are you sure? yes | no

Anders Nielsen wrote 07/14/2023 at 12:37 point

I tried doing APRS and there's some left over code in the repo - however, since the demodulation part is just a comparator, it's very susceptible to false transitions/noise. I barely managed to decode a 100% clean synthetic signal. 
Also - since APRS per definition changes phase depending on 0/1 bits because the baud rate is identical even though the frequency isn't an even match with it, it's incompatible on the hardware level.
The 2200hz tone means it doesn't change evenly at the zero crossing = sampling at zero crossing gives uneven baud rate lengths.
Either way - that's not what this project is made for. If you have a super clean radio link it'll work - but with noise the reception will fail quickly. 

  Are you sure? yes | no

sup wrote 07/14/2023 at 13:46 point

tell me if you have considered what will happen to the cassette after a long time, when the signal strength may be different and the amount of interference greater.
Will your equipment be immune to the effects of time?

  Are you sure? yes | no

Anders Nielsen wrote 07/14/2023 at 14:08 point

@sup Indeed - tape degradation is one of the main reasons we're doing 1200/2400hz. Those frequencies are what audio tape is made to reproduce best, so they also degrade the least. 

Degradation to the amount of the worst tapes I have from the '60s will be fine - worst case, turn up the volume - the SNR is still great compared to RF. 

  Are you sure? yes | no

Ale o co chodzi wrote 07/08/2023 at 17:53 point

is possible send data trought walkie talkie radio similar https://play.google.com/store/apps/details?id=com.aicodix.rattlegram 

or add any usb <--> irda dongle?

  Are you sure? yes | no

Anders Nielsen wrote 07/08/2023 at 18:01 point

Well, probably you can send the modulated audio data over RF - if your SNR is good enough. However, if there's a lot of noise it'll make reception harder since the demodulator is just looking for zero crossings.
So possible - maybe - but it is intended for a clean noiseless medium like tape, digital recording, etc.

  Are you sure? yes | no

Ale o co chodzi wrote 07/08/2023 at 18:04 point

but problem is only with softweare? and xor , redundation data, no hardware?

this same question is with irda transmision?

  Are you sure? yes | no

Anders Nielsen wrote 07/10/2023 at 10:21 point

The issue is the hardware demodulation happens using zero crossing detection - if the background noise is higher than the hysteresis of the comparator it'll corrupt data. 
I don't see how this audio modem relates to the IrDA protocols

  Are you sure? yes | no

qtron wrote 04/19/2023 at 17:54 point

um, ok, i ihave to rethink this. Thanks ;)

  Are you sure? yes | no

Anders Nielsen wrote 04/21/2023 at 06:13 point

Thanks for liking and following!
You might get an idea from the longer video about this project: https://youtu.be/k8hlYr6N3Ls

  Are you sure? yes | no

qtron wrote 04/19/2023 at 17:06 point

Anders! WOW - i have a project that will be rescued by this concept.. I could save my data into a EEPROM, but it was getting way too hairy!

Am sure that if i could write code then use an MCU with very large memory capacity i could be more 'conventional'.

so this is fantastic -potentially i could use a crappy "Oppo" phone to record & play back, only problem is i would need an android app to do so. .. any chance?
My only concern is i have some very slow Square waves to save, 20 Hz

  Are you sure? yes | no

Anders Nielsen wrote 04/19/2023 at 17:35 point

Happy you like it :)

Remember the filtering on the output is only suitable for turning 1200/2400hz square waves into “sine-ish” waves and the input only turns clean sine waves into square waves. For that you can certainly use a phone. 

  Are you sure? yes | no

teraz wrote 10/14/2022 at 20:13 point

is possible create compatible with this? https://github.com/romanz/amodem

or with old telix?

  Are you sure? yes | no

Anders Nielsen wrote 10/16/2022 at 14:19 point

It looks like amodem doesn't need this modem - as it does it all in software. Haven't looked into "telix"

  Are you sure? yes | no

Ale o co chodzi wrote 07/12/2023 at 19:21 point

https://en.wikipedia.org/wiki/Telix

second program for transfer data http://www.whence.com/minimodem/

  Are you sure? yes | no

Mitsuru Yamada wrote 07/28/2022 at 03:46 point

It's wonderful. I used to use 2-pass assembler in the 1970s on a Hitachi HR68/TR computer with Kansas City standard 300 bps tape recorder interface. I miss the sound.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates