
Show HN: Canny the Robot – Programming a device with headphones - akumpf
http://research.kumpf.cc/2015-ProgrammingWithHeadphones/?canny
======
akumpf
Direct link to video here:

[https://www.youtube.com/watch?v=780A0cv1qgA](https://www.youtube.com/watch?v=780A0cv1qgA)

Any comments or questions about how the robot/audio programming works are more
than welcome :)

~~~
hellbanner
Yes, is it binary.. ?

~~~
akumpf
The audio used to program the robot is analog (tones in the form of sine
waves), but the data itself modulating the tone is binary.

More specifically, it's AFSK. See the diagram/info on the Wikipedia page about
for a more detailed explanation.

[https://en.wikipedia.org/wiki/Frequency-
shift_keying#Audio_F...](https://en.wikipedia.org/wiki/Frequency-
shift_keying#Audio_FSK)

------
akumpf
Another interesting write-up about Canny on IEEE Spectrum:

[http://spectrum.ieee.org/automaton/robotics/diy/canny-
robot-...](http://spectrum.ieee.org/automaton/robotics/diy/canny-robot-rocks-
out-to-audio-programming)

Would love to hear thoughts from other engineers and designers oabout where
you think a programming interface like this could lead.

------
sprobertson
Could you go into more detail about how the main decoding circuit works? How
does it turn an audio signal into UART?

~~~
akumpf
Serial/UART is just a simple way of organizing how 1s and 0s are sent (start
bit, data bits, optional parity, and stop bit, all at an agreed upon baud
rate).

To send data to the robot, the transmitter (computer + headphones) encodes 1s
as tone (9876Hz) and 0s at another frequency (12345Hz).

So for the decoding circuit all you really need are 3 stages: a microphone, an
amplifier (opamp chip), and something that can very tightly look to see if the
0s frequency (12345Hz) is present since UART rests high when idle. A phase
locked loop (PLL) is excellent for frequency locking, but can be a little
hairy to use. The LM567 tone decoder chip however has a PLL inside but is a
simple chip to work with.

A little variable resistor next to the tone decoder is used to precisely dial
in the frequency. Lots of other resistors and capacitors in there to hook
everything together, but that's essentially it. Does that make sense? Happy to
answer more questions if you have any :)

Circuit schematic for reference here:
[http://research.kumpf.cc/2015-ProgrammingWithHeadphones/imgs...](http://research.kumpf.cc/2015-ProgrammingWithHeadphones/imgs/CannyCircuit.png)

~~~
sprobertson
Ah that does make sense! On first read I thought there was some other level of
processing, like converting specific tones into bytes (9520Hz -> 0x42). You're
translating the pulses directly to and from bits, which seems more sane.

