Question

I just wanted to know if there is a way to send data through Headphones Jack to a circuit board like arduino or a custom circuit board that handles serial communication or something like that.

Était-ce utile?

La solution

IF?

This is possible, but there are quite a few caveats - all of these grouped around the fact, that audio playback, and by extension the headphone jack are not exclusive resources.

  • The sound to encapsulate the payload must have excellent recognisability
  • The sound must be extremely unlikely to be contained in any "normal" phone sound
  • the receiving board must have good discrimination against "wrong" frequencies
  • The above properties reduce the achievable bandwidth to a few baud

Additionally, sinve the connection is simplex, you should consider idempotency and send every command twice or more to increase reliability.

HOW?

Just play back the correct sounds in the correct sequence to send a command (maybe idempotently repeating), have the receiving board decode the sounds and act accordingly.

We did this successfully with Android, but I don't think there should be any difference with WP, as playing a sound file is a very basic operation.

Four our implementation (On/Off for N devices), there were N+4 different precreated sounds:

  • "start command" - if played, while a command is running, this resets the command logic
  • N times "select device" - to be played after "start command"
  • "on" / "off" - to set the command
  • "execute" - to finalize

All of these can be repeated without side effects.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top