Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Audio Transfer Through Lasers

I'm currently working on a project that has been relatively easy, up until now. The underlying project is to transmit data/messages over lasers using audio transformation. In a nutshell the process is currently like this

  1. The user enters a message
  2. Message is turned into binary
  3. For each 1 and 0 in the binary message, it plays a corresponding tone to signal which is which, in my case 250hz for a 1 and 450 hz for a 0.
  4. The outgoing tone is sent over a stereo cable to an audio transformer rigged to a laser
  5. A solar panel acts as a microphone and records the incoming "sound" as a file
  6. It them plays the file back and reads off the tones and tries to match each 250 and 450 hz to a 1 or 0 (which is where my issue lies).

Up until the actual processing of the sound is fine, my current issue is the following.

I play the tones each for x time, on the receiving end it is recorded for y time, y time is cut sampled many times and then analyzed sample by sample which then logs each frequency. This is inefficient and inaccurate. I have had many issues regardless of the time I play the tones for it often hears a tone twice or doesn't hear it at all, which completely throws off whole messages.
I have tried to match the rate at which it samples with the time each tone plays, but unless aligned accordingly it does not work. I've only had a few successful tests for messages like 'test' and 'hi'. I have already looked into bpsk and fsk, but I feel as if I'm already doing something like it but that I have a bad receiving end to decipher it all.

This is all written in Python and I'd be very grateful for any tips, suggestions, or possible implementations that you can provide. Also for tone emission I'm using pyaudiere and for recording I'm using pyaudio.

Thanks!

-Steve

like image 643
sbrichards Avatar asked Oct 10 '22 21:10

sbrichards


1 Answers

This sounds like a hardware problem. I'm pretty sure it is a job for FSK. Most modern FSK-type systems use PLLs (Phase-Locking Loop chips) for the actual detection. Frequency-to-Voltage or Frequency-to-current circuits are also usable.

I've seen practical circuits in dozens of hobbyist books and in data sheets and on websites. Here are a few:

Circuit for demodulating an FSK signal

PLL Tutorial

I hope this isn't just another trip down the rabbit hole for you -- good luck!

like image 151
Dogmug Avatar answered Oct 13 '22 11:10

Dogmug