Using a raspberry pi 3 and an infrared reciver. with the help of a library called LIRC I recorded the signal of my android box remote control.
begin remote
name MyRemote
driver devinput
bits 64
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 64
pre_data 0x0
gap 509
toggle_bit_mask 0x0
frequency 38000
begin codes
KEY_1 0x116B000001000268
KEY_2 0x1169000001000267
KEY_3 0x116800000100026E
KEY_4 0x116E00000100025C
KEY_5 0x116C000001000263
KEY_6 0x116800000100024E
KEY_7 0x115D000001000268
KEY_8 0x116E000001000263
KEY_9 0x116B000001000267
KEY_0 0x116F000001000265
KEY_DOWN 0x0360000001000076
KEY_LEFT 0x1167000001000264
KEY_UP 0x117800000100025E
KEY_RIGHT 0x1169000001000266
KEY_BACK 0x1170000001000262
KEY_ENTER 0x1167000001000268
end codes
end remote
The problem is I can not find a library that can help me write code to send the IR signal from my Note3.
There are Lightning, 30Pin, Type-C connectors – this means that the USB key for the Android device for iPhone is no longer suitable. By climbing the catalogs of Chinese online stores, you can find many infrared transmitters. Quite often in the open spaces of the network there are photos of such a positive hardware key.
If your smartphone doesn’t have an infrared port, don’t despair. Available on one of the IR transmitters on the Chinese market. This small device will cost a maximum of 20 USD, and at the same time will be a full-fledged alternative to the gadget’s built-in infrared port.
Most of the mobile phones have their own menu item to activate the infrared port. For example, for a Nokia mobile phone you have to choose Menu -> Infrared. After activating the infrared port, you will see the following symbol at the top left corner on the display of your Nokia mobile phone and you will know that the infrared port is enabled.
The infrared port on your smartphone allows you to remotely control your devices at home. To take advantage of this opportunity, the gadget owner must download and install one of the special applications on the mobile device. The most well-known universal IR program is ZaZaRemote . If your smartphone doesn’t have an infrared port, don’t despair.
I tested ConsumerIrManager on Redmi Note 4, probably it will work on Note3 too.
Add permission to the manifest:
<uses-permission android:name="android.permission.TRANSMIT_IR" />
And in code:
ConsumerIrManager
val irService = getSystemService(Context.CONSUMER_IR_SERVICE) as ConsumerIrManager
irService.hasIrEmitter()
fun isSupportedFrequency(irService: ConsumerIrManager, targetFreq: Int): Boolean {
irService.carrierFrequencies.forEach {
if (it.minFrequency <= targetFreq && targetFreq <= it.maxFrequency) {
return true
}
}
return false
}
irService.transmit(targetFreq, data)
To send 64 bit keys maybe you can split them into two 32 bit keys.
Under the hood ConsumerIrManager
uses ConsumerIrService
, which uses native method private static native int halTransmit(int carrierFrequency, int[] pattern);
, which supports only 32 bit pattern slices. So probably there is no hacky way to send 64 bit slices, if splitting won't help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With