Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Sound Decoder - serial communication through audio or infra-red
C
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
avr
CMakeLists.txt
README.md
gen.c
sodec.c

README.md

Sodec - sound decoder

A test-project for making a 1-pin serial connection from my AVR to my PC using a simple Manchester Encoded signal variant. The setup involves signal from a digital-out AVR-pin into a sound-card's line-in.

Since it's 1-pin, it is also possible to transmit the signal wirelessly using IR diodes or by using a speaker and a mic.

Building

$ cmake .
$ make

The Signal

gen will encode each byte from stdin into a sequence of bits where # is on and . is off, one byte per line. The clock is encoded in the signal (as always with Manchester encoding). Synchronization occurs at the start of each byte. Three subsequent #'s, which the input data-stream cannot produce, indicate the start of a byte and sets the clock freqnezy.

$ echo -n hello world | ./gen
.###..##.#..##..#.#.#
.###..##.#..#.##..##.
.###..##.#..##.#..#.#
.###..##.#..##.#..#.#
.###..##.#..##.#.#.#.
.###..#.##..#.#.#.#.#
.###..##.#.#..##.#.#.
.###..##.#..##.#.#.#.
.###..##.#.#..#.##..#
.###..##.#..##.#..#.#
.###..##.#..#.##..#.#

gen can be configured to output sinus waves (AUDIO_OUTPUT) which can be piped to aplay, for example.

You can generate the same signal from the project in the avr subfolder. Then, once your AVR output pin is connected to your sound-card's line-in, you can do:

$ arecord -f u8 -r 44100 | ./sodec | dd bs=1
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 44100 Hz, Mono
Hello World from AVR!
Counter: 1
Counter: 2
Counter: 3
Count^C
51+0 records in
51+0 records out
51 bytes (51 B) copied, 6.94628 s, 0.0 kB/s

The bandwidth seems to be too slow for dd to pick up, which ends up at a staggering 60 bps.

Something went wrong with that request. Please try again.