OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
648 stars 207 forks source link

Is it possible to use OLA over headphone jack? #1381

Open Nesh108 opened 6 years ago

Nesh108 commented 6 years ago

Hello,

I have just recently got into the idea of connecting my raspberry pi to a set of LED wristbands. I found these: http://www.blink-fx.com/store/p16/DIY_Demo_Bundle_%285_wristbands___smartphone_mini_controller%29.html.

There is a DMX Programmer app on Android which lets you control the lights by simply connecting the controller to the phone via headphone jack.

I was wondering: how can I make my own DMX Programmer which communicates over headphone jack (C++/Python/Java)?

Most of the times USB-to-DMX seems to be mentioned but never AudioJack-to-DMX.

Thanks!

Btw, I will look deeper into the codebase, if I manage to stumble upon my own answer, I'll edit here :)

Cheers,

N.

peternewman commented 6 years ago

Hi @Nesh108 ,

That's an interesting one, it sort of depends on what's going on over the headphone jack, be it a proprietary serial data stream, actual DMX or proprietary audio control.

However looking at this page, from the people who make the IR illuminator it's controlling, which in turn is controlling the wristbands, it would appear it's normal DMX, just on a non-standard connector, given they're plugging it into a normal third party lighting desk: http://www.gantom.com/wiring/

So it would seem you should be able to generate normal DMX output from the Pi and convert it to a minijack connector using any output we currently support (UART direct from the Pi, FTDI, USB dongle etc).

Although if you're also asking if you can use the Pi's audio jack to generate DMX, the answer is probably not easily, it seems most stuff doing this is either modulating the signal (i.e. needs special hardware at the other end to decode it - see https://software.intel.com/en-us/android/articles/using-the-audio-jack-as-data-interface-on-android-systems ), or is possibly connecting a serial port within the phone to the same connection, which the Pi won't have.

So if I were you I'd just go down the adaptor route, unless you really want a challenge!

Nesh108 commented 6 years ago

Hey @peternewman,

Thanks a lot for the prompt and thorough reply. I think I understand but when you say:

Although if you're also asking if you can use the Pi's audio jack to generate DMX, the answer is probably not easily, it seems most stuff doing this is either modulating the signal (i.e. needs special hardware at the other end to decode it [...]

Isn't the Android app just modulating the signal as if it was a normal DMX and the controller/adapter handles the demodulation? Otherwise it wouldn't work, right?

Basically, I would be interested in trying generating some normal DMX and just spitting it out of the audio jack without caring of any demodulation on the receiving end.

Worst case, it would be to reverse-engineer what gets sent over the audio-jack from the Android application. I wouldn't think that they are making use of some feature unique to mobile phones.

And super worst case, I'll just get an adapter to plug in-between. (I'd avoid this unless really needed to keep the cost down.)

What do you think?

peternewman commented 6 years ago

You probably need to get a scope on the output of the headphone socket to find out if it's audio or serial data coming out from the app. Some other interesting links here: https://hackaday.com/2010/02/01/android-audio-serial-connection/ https://electronics.stackexchange.com/questions/12498/what-protocol-does-a-headphone-jack-use

To be honest, using the Pi UART is pretty cheap (especially if you get the chip as a sample :wink: ), so I'd go down that route if I were you: https://github.com/OpenLightingProject/ola/blob/master/plugins/uartdmx/README.md