I have DIY one Android remote - all open source
1. Trial
Remember Song Baohua in the "device-driven development specific explanation" put forward a theory "software and hardware infiltrate each other's territory", this proves to be true, the use of the upper-level APP software with simple and simpler hardware design can complete a remote control.
Have developed the application of Internet users e-mail asked how the DIY Infrared remote control is how to work. Check it out. There are two ways to do this, one based on USB and one based on the headphone hole. A simple reply to a message.
That is to convert the audio signal /USB signal to an infrared signal.
Afterwards oneself all thought a bit perfunctory, fortunately own hardware to understand some. Software will also be developed. Just combine them.
Trial times, and now the development of the law is more clear. It is generally the first trial to understand the approximate function. The trial of the secondary hop is to buy a headphone jack type of remote control transmitter such as the following internal diagram (ignore the line, the line is I measured the welding).
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2fuz2vhcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
Mobile phone software using the "Remote Control Genie" (2.9.3 version number), around the test apparatus is Skyworth TV.
The design of the software is relatively good to use. Trial success, no other obstacles.
2.DIY Hardware
The second step isDIYup. Googleout[DIY] cheap and easy to use - IR remote controller using an ear hole (suitable for multicast . WAV player) text graph more Andmobile phone remote control , 3.5mm Headphone Interface Infrared Remote control transformation Analysis Two articles and one article of principleRemote Control Principle.combined with the oscilloscope test button is the headphone hole output waveform, presumably understand the principle andDIYthe required components.
DIY Required components:1.3.5 Headphone plug 2. Infrared emitter Tube (in fact this name is also strange, in strict sense it belongs to the light emitting diode and a kind.) But to the e-shop to say before the "infrared Emitter Tube")
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2fuz2vhcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
The next hardware-related experiment is a partial replacement, with the software using the "Remote Wizard" on the appropriate configuration, and then the welded "remote control" connected. For testing. For the first time, the two diodes are connected to the left and right channels of the headphone plug by positive and negative connections to the first cited article for example:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2fuz2vhcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
Experimental results: Success is correct.
The second experiment was based on the second citation article only welded to a transmitter tube, the experimental result: success is correct.
The third experiment is to reverse the positive and negative polarity test again, the results of the same test: success is correct.
From the above three experiments. Clear a lot of concepts, but also bring a very confused, the article said to the 19kHz to 38kHz so that two of the transmitter tube plus or minus connected. But in the second experiment, it was possible to emit a signal without being connected. The positive and negative interchange in the third experiment did not affect the normal transmission and reception of the signal. This is also a point.
3rd, there is no transistor to enlarge, the same can be used. Let's put the theoretical discussion here temporarily. Continue with the new experiment.
The software experiment is to finally realize the development of an APP to launch data.
The first step is to record the audio output from the Remote Control Wizard. The hardware connection is to record the key waveform output by the remote control genie using a grandfather's headphone plug.
Put it in your phone to play audio to send an infrared signal to the TV. Validation passed.
2.DIY Software
After the general principle of the broad-spread plan, the use of writing a "Remote Control Wizard" Open source version, that is, the use of code to achieve the live waveform.
The various parameters of the signal can be adjusted so that different types of devices can be controlled.
According to the principle of remote control to know 38kHz sine wave signal required. the method of how to generate sine waves is found in Playing an arbitrary tone with Android .
The test found that it could not output 38kHz, the maximum is only 20KHz. In turn, test "remote control Genie" Output frequency is also 20KHz, then use 20KHz signal for the moment. Make a slight modification so that it outputs A single-channel sine signal of 20KHz.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2fuz2vhcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
The same according to the principle of the remote control of the waveform specified in the length of the code, only the paragraph (3) is required to ignore. The following methods are implemented:getleadercode, Getusercodetowave, Getdatacodetowave, getstopbit respectively get waveforms of each stage.
Combine it with the 0.1 version number to be released. The source code is located at:https://code.csdn.net/kangear/sinewave.
A Skyworth TV that can control the test now.
:
There are many more flaws to be intact:
1. The error rate is still higher and4 times successful.
2. Now just implement a key that can be changed by code usercode and datacode.
3. Based on mono-channel waveforms, only one and ground on the left and right channels can be connected on the hardware. The software is a hardware connection that allows for a random combination of the right and left sides.
20140924 MORE:
The reason for the high error rate has been found, many times the key will occasionally cause the waveform only the second half of the remaining part. Because this problem is more vague, do not know what is the reason, observed the software waveform. It adds a filter waveform of (Low) + (1.69) + 0.56 (low) +.
This waveform has three of real data before and after it.
After implementation in the code, the effect is significantly improved, the previous waveform truncation, although still there, but the truncation is not the real signal.
The code is further intact and can be easily repaired by user code and data code.
public void OnClick (View v) {
Switch (V.getid ()) {
Case R.id.volume_add_button:
Mwaveservice.sendsignal (short) 0x00ff, (byte) 0x28);
Break
Case R.id.volume_sub_button:
Mwaveservice.sendsignal (short) 0x00ff, (byte) 0x01);
Break
}
}
Mono for wav is not optimized yet. Only mono-channel hardware connections can be used right now.
There is also an effect on the accuracy of the hardware, assuming that the headset is directly connected to the socket. The level does not reach the maximum of the IR emitter. It will cause enough power.
Using an APP you've developed with an infrared emitter that's been purchased online has been very good.
About Repeat Code, the real remote control is to send a Repeat Code every 110ms when the button is pressed .
Through this realization "press not release the connection transmit signal function", for example, press the sound + key does not release can achieve continuous volume.
Just "Remote control Genie" also did not realize, this meaning how big temporary still unclear.
Questions and Answers
(20150127) People who have recently paid attention to this article have started to get up, I also opened the article " Ask and Answer " it.
The 1.c language generates a Wava file and you convert it using a sine wave. Put in an array how do I generate a wave file?
A: Is the first need to achieve, understand the need for infrared emitter waveform: 38kHz square wave.
Again to see the ability of mobile phones, because of the properties of the phone, generally the audio limit for the ear hearing range 20~20khz, which is obviously not enough, how to do? No, just give it a try. How about playing the highest 20KHZ? Test results are feasible. (This means you can't completely register or do it yourself.)
The goal is to play 20KHZ music, generate waveforms, but the API is generated by default sine wave, if you want to use software to achieve then need to go through Fourier transform to square wave . seemed rather troublesome. So how did the other people achieve it? Look at a finished software, measured the output waveform is also a sine wave , then I was relieved to use the sine wave.
On how to play, suppose you understand Android development. You will definitely not need to generate WAV files. Generating and playing directly in memory is also a way to play audio. Of course the audio file is the way I tried it. is also feasible. Do not believe in the authority of the brave attempt, everything is more clear than the book to the deeper.
2. If you want to change the launch code is only the Usercode and Datacode, I look at the infrared remote control principle when I see the user anti-code + user code + data code + data anti-code?
A: This is even easier, I encapsulated it. When providing user code, how to convert its inverse code, the same data. Let's say you look at the code. There will be no doubt about it. )
(20150426)
What is the frequency of 3.44.1Khz?
Answer: 44.1KHZ is the sample frequency of audio signal, see: Http://en.wikipedia.org/wiki/44,100_Hz.
What is the meaning of the samplerate/freqoftone in the 4.sin function? Why are the two dividing , (private final double freqoftone = 200000; Hz 200000=>20khz (50US) Max This inside 20KHz is not more than a dozen of a 0).
A: The original code is not so easy to understand, has been updated and added to the code gaze.
is actually a process of evaluation. The formula is existing: Y (t) = A * sin (2πft +φ), in which:
* A: Amplitude, here is 1;
* F: Frequency. Here for Freqoftone;
* t: Time, here for (i/samplerate);
*φ: initial phase, here is 0;
The code is actually written according to this formula, which is introduced in this formula: Http://en.wikipedia.org/wiki/Sine_wave
So a good understanding of the wording is this: sample[i] = Math.sin (2 * Math.PI * Freqoftone * (i/samplerate));
About whether to play a 0 more, I think it should be yes.
5. Carrier frequency 38KHz (that is, the landlord used 20KHz) refers to what, not every jump is 1/38khz.
As the landlord writes, it seems that every bit of the array is 1/44.1khz.
A: The carrier frequency is the sine wave frequency, the period is 1/38khz. A detailed description of the formula has been explained in the previous question.
6.(20150616) Q: I now want to do a control of the air conditioning function, from the Internet to find my air conditioning infrared signal is according to the following provisions:
The 0 level width is: 600μs low level +600μs high level
The 1 level width is: 600μs low level +1600μs high level
Start code s level width: 9000us low +4500us high
Connection code C-level width: 600us low-level +20000US high
Suppose I want to implement 01SC these four words, in your encapsulated function is able to call directly? Still need to change the number of parameters.
In addition, I used two male lines recorded the other finished software control my air conditioning recording, with Cooledit open to see the seemingly also sine wave
A: From the signal width and the timing diagram in my article almost identical, should be a standard. I re-organized the code and put the number of time series together into constants so that I can change some of the parameters to be very good. Also added the gaze to facilitate comprehension.
You need to combine the timing diagram and gaze on the diagram to find your signal width accordingly: (In fact, you have mentioned in the search for these parameters and in the documentation of the references.) Infrared signal protocol generally does not distinguish between device types: TV, air conditioning, projector. As for how to adapt to you, you have to figure it out for yourself.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2fuz2vhcg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
About Sine wave. Temporarily also found can output sine wave of the app, the ability of the phone to explain these, but does not affect the use.
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
I have DIY one Android remote-all open source