Does anybody know? Manchester encoding help

Alright, I am using manchester code that I will be storing in audio, thus I need to convert it to a sine wave to allow for accurate re-squaring. I have a re-squareing circuit already, but I need to sine wave converter. I do not want to use a tape interface board if possible. I think if I can determine the frequency of the biphase, I can use a few caps to convert it to sine. I will be using 4800 baud and this library: Home - Arduino Manchester Encoding - Mchr3k

Basically, I just want to know what you suggest I do.

Right.

I have re-written my post to try and make some sense of what you are trying to do.

  1. You want to store some binary data on old cassette tape?
  2. Is there a reason you can't use digital cassette tape? Would make life a little easier?

Johnny010:
I think a description of what you want to achieve may be best.

I have written my own Manchester like library for an IR tx and rx...it should be quite easy.

PS: Manchester encoding is what you mean.

I just want a circuit to convert the square biphase to a sine wave. The biphase will be recorded as audio as a square wave, then it will be resquared when played back before it enters the arduino allowing it to decode the biphase and use it. The resquaring portion is done, just not the sine converter.

Johnny010:
Right.

I have re-written my post to try and make some sense of what you are trying to do.

  1. You want to store some binary data on old cassette tape?
  2. Is there a reason you can't use digital cassette tape? Would make life a little easier?

I'm using computer for recording and playback. I cannot believe I forgot to mention that.

You can do what I did in 1983 and build the bit-boffer.
bit-boffer

KeithRB:
You can do what I did in 1983 and build the bit-boffer.
bit-boffer

Do you think 4800 baud would work with that?

pianocorder_man:
Do you think 4800 baud would work with that?

Not likely. The reason people, back in the days of recording on audio tape, worked at lower baud rates is because the limits of the recording media. The second page of KeithRB's link is largely a discussion of the relevant limitations.

While it might be possible to extend the boundaries of tape with current digital signal processing techniques, it's largely pointless given the availability of far superior digital recording technologies. The floppy disk killed audio tape, cdroms killed floppy disks, solid state memory killed cdroms, so even if audio tape weren't dead three times over, one would be hard pressed to find someone with the desire and expertise to wring more performance out of it.

MrMark:
Not likely. The reason people, back in the days of recording on audio tape, worked at lower baud rates is because the limits of the recording media. The second page of KeithRB's link is largely a discussion of the relevant limitations.

While it might be possible to extend the boundaries of tape with current digital signal processing techniques, it's largely pointless given the availability of far superior digital recording technologies. The floppy disk killed audio tape, cdroms killed floppy disks, solid state memory killed cdroms, so even if audio tape weren't dead three times over, one would be hard pressed to find someone with the desire and expertise to wring more performance out of it.

I am not using tape though, I only need a circuit that converts the square to sine for PC recording.

Can't hurt to try, you will not be plagued by dropouts and stretched tape.

pianocorder_man:
I am not using tape though, I only need a circuit that converts the square to sine for PC recording.

I'm not clear on what you're doing. It sounds as if you are taking some digital stream, converting it to an audio signal, and recording via a sound card to the PC. Presumably, playback is the reverse. The direct answer to your question then is you want a low pass filter with a cutoff frequency at least 3 times your 4800 baud rate. If you're using a sound card it may already have an appropriate filter.

Whether or not this works depends upon the characteristics of the sound card (bandwidth) and perhaps the data encoding (uncompressed wav file vs compressed file that may not preserve bandwidth and phase).

With a sufficiently high performance digitizer, I'm sure it will work. Claude Shannon would be rolling over in his grave over this approach but it's your project.

MrMark:
I'm not clear on what you're doing. It sounds as if you are taking some digital stream, converting it to an audio signal, and recording via a sound card to the PC. Presumably, playback is the reverse. The direct answer to your question then is you want a low pass filter with a cutoff frequency at least 3 times your 4800 baud rate. If you're using a sound card it may already have an appropriate filter.

Whether or not this works depends upon the characteristics of the sound card (bandwidth) and perhaps the data encoding (uncompressed wav file vs compressed file that may not preserve bandwidth and phase).

With a sufficiently high performance digitizer, I'm sure it will work. Claude Shannon would be rolling over in his grave over this approach but it's your project.

That's exactly what I need to do.

This system probably won't work with your PC recorder, if you just bump it up from 300 to 4800 bps, the frequency jumps from 2400 to 38400 Hz, which is too high for most recorders. 2400 baud at 19200 Hz might be doable.

MrMark:
I'm not clear on what you're doing. It sounds as if you are taking some digital stream, converting it to an audio signal, and recording via a sound card to the PC. Presumably, playback is the reverse. The direct answer to your question then is you want a low pass filter with a cutoff frequency at least 3 times your 4800 baud rate. If you're using a sound card it may already have an appropriate filter.

Whether or not this works depends upon the characteristics of the sound card (bandwidth) and perhaps the data encoding (uncompressed wav file vs compressed file that may not preserve bandwidth and phase).

With a sufficiently high performance digitizer, I'm sure it will work. Claude Shannon would be rolling over in his grave over this approach but it's your project.

MrMark:
I'm not clear on what you're doing. It sounds as if you are taking some digital stream, converting it to an audio signal, and recording via a sound card to the PC. Presumably, playback is the reverse. The direct answer to your question then is you want a low pass filter with a cutoff frequency at least 3 times your 4800 baud rate. If you're using a sound card it may already have an appropriate filter.

Whether or not this works depends upon the characteristics of the sound card (bandwidth) and perhaps the data encoding (uncompressed wav file vs compressed file that may not preserve bandwidth and phase).

With a sufficiently high performance digitizer, I'm sure it will work. Claude Shannon would be rolling over in his grave over this approach but it's your project.

Is there a way to find the frequency without an oscilloscoe?

KeithRB:
This system probably won't work with your PC recorder, if you just bump it up from 300 to 4800 bps, the frequency jumps from 2400 to 38400 Hz, which is too high for most recorders. 2400 baud at 19200 Hz might be doable.

I find that very unusual. There's a unit called the pianocorder that used a baud rate of 4800 and has clearly audible signals and is definitely manchester biphase. I'm thinking that maybe the way you are thinking of encoding it has ICs thaf change the signal drastically from the digital biphase whereas the way the pianocorder does it (and the way I want to do it) simply smooths the square biphase into a sine wave form. Really not sure though.

Have you done any lab testing at all? For example, did you try recording the raw digital Manchester signal and feeding it back to the demod?

You seem to labouring under an idée fixe.

aarg:
Have you done any lab testing at all? For example, did you try recording the raw digital Manchester signal and feeding it back to the demod?

You seem to labouring under an idée fixe.

No, only because I don't want to spend too much money on something thats not going to work; plus, a lot of the parts of the re-squaring circuit are uncommon parts.

Is it worth looking at LTC hardware and software methods as it is just recorded as an audio track on tape.

Alright, so after much work, I've written this code; and it doesn't even work.

#include <Manchester.h>
#define RX_PIN 9
unsigned long bits_in = man.getMessage();
void setup()
{
  man.setupReceive(RX_PIN, MAN_4800);
  man.beginReceive();
}



void loop() {
if (man.receiveComplete()) {
  if (1 == (bitRead(bits_in, 0))); {
     (0 == (bitRead(bits_in, 1)));{
     (0 == (bitRead(bits_in, 2)));{
     (1 == (bitRead(bits_in, 3)));{
     (1 == (bitRead(bits_in, 4)));{
     (1 == (bitRead(bits_in, 5)));{
     (0 == (bitRead(bits_in, 6)));{
     (1 == (bitRead(bits_in, 7)));{
     (1 == (bitRead(bits_in, 24)));{
     (1 == (bitRead(bits_in, 25)));{
     (1 == (bitRead(bits_in, 26)));{
     (1 == (bitRead(bits_in, 27)));{
     (1 == (bitRead(bits_in, 28)));{
     (1 == (bitRead(bits_in, 29)));{
     (0 == (bitRead(bits_in, 30)));{
     (1 == (bitRead(bits_in, 31)));{
     {
  
  man.beginReceive(); //start listening for next message right after you retrieve the message

if (1 == (bitRead(bits_in, 8)));{
  digitalWrite(2, HIGH);
if (1 == (bitRead(bits_in, 9)));{
  digitalWrite(4, HIGH);
  if (1 == (bitRead(bits_in, 10)));{
    digitalWrite(8, HIGH);
    if (1 == (bitRead(bits_in, 11)));{
      digitalWrite(12, HIGH);
    }
  }
}
}
}
}
}
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }
     }

On the transmitting side, I've got this code:

#include <Manchester.h>
#define TX_PIN 9
void setup() {
  // put your setup code here, to run once:
man.setupTransmit(TX_PIN, MAN_4800);
}

void loop() {
  // put your main code here, to run repeatedly:
man.transmit (1001110111111111111111111111111111111101);
}

The receiver does not work properly and turns everything on even if the data feed is not connected. Keep in mind, I'm connecting the two arduinos directly together. If I deleted all the code and set the receiver to do nothing but serially print the received data, I get zeros no matter what. Anybody have any suggestions?

pianocorder_man:
No, only because I don't want to spend too much money on something thats not going to work; plus, a lot of the parts of the re-squaring circuit are uncommon parts.

What money? You can't afford to buy two resistors to make a voltage divider? What re-squaring circuit? You should share that with us so we know what you're up against (actually, you should have at the outset). I'm 100% certain that the fine people here can suggest common circuits that would do exactly the same thing.

What you're doing isn't new, and it isn't rocket science either. Even the original IBM PC had a cassette tape interface. :slight_smile:

man.transmit (1001110111111111111111111111111111111101);

You realize that is a decimal number, right? :wink: