Reputation: 1010
I have a LED stripe with a classic IR controller (image) and asked myself if I could control it with my Samsung Galaxy s21 Ultra which can emit infra-red light for its ToF camera. Now there are two issues.
Upvotes: 0
Views: 1406
Reputation: 11
It is definitely possible! You'll be able to control your LED devices with IRDA receiver (typical LED stripes/lamps from Amazon/Aliexpress/TEMU etc.) with Android, even from scripts or an Android remote SSH terminal (for sure, having the device pointed to its IR beam to a target IR receiver)! I managed to do that. U'll need:
Termux + Termux API
installed from F-Droid (recommended rather than from Google Play) on your Android;Led Lights - Liluco
remote controls, which is a very typical layout for the "noname" LED strips; before export layout code, tick the Export with native codes
LED Lights - Liluco.irplus
) and open with e.g Notepad, you'll see:<irplus>
<device manufacturer="LED Lights" model="Liluco" columns="4" format="WINLIRC_RAW">
<button label="-" labelSize="25.0" labelColor="FF000000" backgroundColor="FFFFFFFF">9022 4498 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 39702 9022 2262 572 95992</button>
<button label="+" labelSize="25.0" labelColor="FF000000" backgroundColor="FFFFFFFF">9022 4498 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 1690 572 1690 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 39702 9022 2262 572 95992</button>
<button label="OFF" labelSize="18.0">9022 4498 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 1690 572 1690 572 572 572 1690 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 39702 9022 2262 572 95992</button>
<button label="ON" labelSize="25.0" backgroundColor="FFED2E33">9022 4498 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 39702 9022 2262 572 95992</button>
...
<button label="SMOOTH" labelSize="18.0">9022 4498 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 1690 572 1690 572 1690 572 1690 572 1690 572 572 572 1690 572 572 572 572 572 572 572 572 572 572 572 572 572 1690 572 572 572 1690 572 1690 572 1690 572 39702 9022 2262 572 95992</button>
</device>
</irplus>
Almost there! This way you'll be able to filter out all the codes needed to form corresponding shell/bash aliases for every control action, including power ON/OFF, Volume Up/Down, etc. Frequency 38000 (38kHz):
alias led-dn='termux-infrared-transmit -f 38000 9022,4498,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,39702,9022,2262,572,95992'
alias led-up='termux-infrared-transmit -f 38000 9022,4498,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,1690,572,1690,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,39702,9022,2262,572,95992'
alias led-off='termux-infrared-transmit -f 38000 9022,4498,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,1690,572,1690,572,572,572,1690,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,39702,9022,2262,572,95992'
alias led-on='termux-infrared-transmit -f 38000 9022,4498,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,39702,9022,2262,572,95992'
...
alias led-smooth='termux-infrared-transmit -f 38000 9022,4498,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,1690,572,1690,572,1690,572,1690,572,1690,572,572,572,1690,572,572,572,572,572,572,572,572,572,572,572,572,572,1690,572,572,572,1690,572,1690,572,1690,572,39702,9022,2262,572,95992'
I believe you can use same approach to control any other device. I'm posting this just for humanity, cause love Termux
a lot, but absolutely NO ANY info anywhere on how to use some of the API methods including IRDA =))) Enjoy!
Upvotes: 1
Reputation: 18137
This is unlikely. The ToF IR pulse has to be very specific in length and shape, and likely controlled at the very low level (possibly by the sensor hardware itself).
So it's not likely that there's a way to customize the pulse shape or duration.
Upvotes: 1
Reputation: 1868
Well, it might be possible to turn the IR emitter on and off via some api (maybe the standard camera2 API or a special Samsung API) but IR transmitters commonly use a transmitting protocol which requires quite fast switching. That might be difficult.
There is some fairly detailed information about some IR Remote control protocols here: Data Formats for IR Remote Control from Vishay Semiconductors
I have seen projects which use the headphone socket of older phones connected to an IR LED to emit RC commands by outputting the signal as Audio.. pretty neat.
Upvotes: 1