Hi,
smooth_jamie wrote:I've finished putting together the tone detector which works fine.
What is the carrier frequency ?
smooth_jamie wrote:Can anyone offer any suggestions as to how I can translate the signal into binary?
You need some creativity here... The easiest is on-off signaling (OOK) - when the bit is 0, you transmit a tone, when bit is 1, you don't transmit anything.
The important thing is bit-time (baudrate). It must be lower than the carrier frequency, a starting point could be something like 1/20 of it. Maybe this number is quite optimistic (limited mainly by tone detector properties and echoes).
So, when you'd like to send a data packet, you need sent a pattern first (like
01010101, to "warm up" the receiver and to synchronize the receiver clock). Then you need a separator (to distinguish sync sequence and actual data, because first bit or two could be lost), then send data and checksum. Acknowledge/Retry mechanism is recommended.
Ok, let's say that you always transmit 3 data bytes (therefore, no need to add length info), and the data to be transmitted is "ABC" (=
01000001 01000010 01000011), you calculate a checksum (depends on selected algorithm, let's say that the checksum is
11001100 11110011. Let's also say that the separator has 4 bits:
0011
So, you'd transmit
0101010100110100000101000010010000111100110011110011
On the receiver side, you wait for the carrier,... you start receiving
0101.. then you wait for
0011, and next 24 bits are data + 16 bits of checksum... verify checksum and send acknowledge (or be silent in case of error). The sender retransmits the packet if acknowledge is not received within predefined interval... and to prevent dead loop, let's repeat retry max 5 times.
The receiver sampling time should be synchronized with occurrence of the tone, then the sampling is performed at 2/3 of bit-time.
Best wishes, Ivan Zilic.