Gadget Renesas

Linking Ideas and Electronics

がじぇるね工房

Using the function on GR-KURUMI, Outside interruption vol.

GR-KURUMIの機能を使う 外部割り込み編

####

Remote control hacking with outside interruption

With terminal 2 or 3, GR-KURUMI is allowed to deal with the change on each terminal as interruption.

Infrared remote control of home appliance transmit signals by modulation method in which it pause or resume ON/OFF signal of infrared LED or carrier wave. The frequency of carrier wave is approximately 38kHz.

Due to digital type, carrier wave is represented as bit stream with 0 or 1. Due to digital type, carrier wave is represented as bit stream with 0 or 1. Each bit consist of “having” or “not having” of carrier wave, if “not having” time is equals with “having” one, 0 shows up, If “not having” time is three times as “having” one, 1 shows up.

image01

As for time T, specified 0.56ms in NEC format, 0.4ms in AEHA format. Get ready receiver IC for infrared remote control instead of judging 0 or 1 sampling of 38kHz career wave by micro controller interruption.
http://akizukidenshi.com/catalog/g/gI-04659/

Resister IC can depict HIGH/LOW only depend on “having” or “not having” period of carrier wave. Based on this HIGH/LOW, bit conversion processing is required.

####

NEC format

There are several schemes for coding of infrared remote control. SONY, NEC, AEHA (Association for Electric Home Appliances) format are typical.
※ Since I don’t have any home appliance with Sony format, we don’t care it this time.
Please refer to below URL for NEC format in details.
http://japan.renesas.com/support/faqs/faq_results/Q1000000-Q9999999/mpumcu/com/remo_012j.jsp

NEC format is user-friendly with the fixed frame-length at 32bit. However, in effect, it can transmit data up to 1byte.
It’s not intended for home appliances use which is requiring complicated operation.

Widely used for the ones with just simple work such as ceiling area lighting.

####

AEHA format

On AEHA format, its frame-length is variable, can transmit data up to 10 byte. However handling is complicated.

Please refer to below URL which Akizuki posted in the public.
http://akizukidenshi.com/download/k4174_format.pdf
Also please refer to chan-san’s site.
http://elm-chan.org/docs/ir_format.html

Widely used for home appliance which is requiring intricate operation such as air conditioner.

####

About remote control code

Though either NEC format or AEHA is standard specification, any home appliance manufacturers doesn’t disclose their remote control code.

There are many users for electronic kit hacking on the infrared remote control. They analyze code by themselves and post it in the public on internet.
http://japan.renesasrulz.com/gr_user_forum_japanese/b/webcompilerupdate/archive/2014/10/24/gr-kurum.aspx
Please refer to above URL for receiving infrared remote control with GR-KURUMI.

Without obtaining the remote control code from manufacturer, matching data pattern receipt with micro controller with the button of remote control, we can handle home appliances in our own way.
Called universal remote. Just memorizing the pattern and sending it out, even custom code can be dealt with a series of data pattern, everything is going well.

※ Cut and try is indispensable?

####

Connection for remote control signal reception

image02 image03

Referring the datasheet for receiver IC, let’s provide it with wiring.
Receiver IC is subject to noise due to dealing with feeble signal. Get ready condenser etc. as specified. IR_RECV is connected with terminal 2 on GR-KURUMI.The oscilloscope shows the waves monitoring IR_RECV. Usage of NEC format.

####

Program for remote control signal reception

image4

The output of receiver IC is connected with terminal 2. Record the every time for interruption happen with handler registered on attachInterrupt, calculate interval of times for interruption, we can see the time for ON or OFF.

The duration time for the leader part may be helpful in the distinction of NEC from AEHA format.
Those are different between two, NEC format is 13.5ms in total for ON/OFF. while AEHA format is 4.8ms.

Next, convert duration time for ON~ON into bit stream, save the data every 8 bit.
The chart is execution result.
NEC format shows LED lighting from IRIS OHYAMA.
AEHA format shows AQUOS, sharp LCD TV.

Here is the sample code.

####

Connection for remote control signal transmission

image05

As for transmission, recommend direct output from port of micro controller since a dedicated IC is not popular.
IR_CONT is connected with terminal 3 on GR-KURUMI.

Using transistor to have several infrared LEDs turn ON/OFF simultaneously.seems no problem to operate a LED with port directly since the terminals on GR-KURUMI allow a larger current to flow than expectation except analog shared port.

The schematics in the chart , turn LED ON when IR_CONT is LOW.

####

Program for remote control signal transmission

Next stage, let’s transmit remote control codes for LED lighting or TV, which have been obtained with receipt program.

The terminal 3 connecting with IR_CONT is capable of PWM output in analogWrite. With PWM outpu, generate carrier wave of 38kHz.
Outputting carrier wave with time, or modulating the bit stream by pause.

Receiver side will accept the carrier wave in the range of 39~40kHz, probably.

The scheme for modulation 1 is as follows.

The scheme for modulation 0 is as follows.

The code sampling with receipt program is as follows.

image06

We can use the sane code to have AQUOS TV power ON/OFF.
Need to modify the code for LED lighting.
Send out this code every 1 bit by above modulation scheme and added stop bit at last.

Here is the sample code.

####

Infrared remote control hacking for realizing IOT

To realizing IOT by yourself, recommended the infrared remote control hacking.
We can expect to maintain high level of security unless we handle power supply of apparatus directly.

※ On the appliance which allow AC input to power on/off automatically or with remote control device, there’s a risk that will come into conflict with the law.

The house ruined by the fire would be too horrible to look at.
Be careful of an accidental fire.

MVP information

@chobichan

General hard engineer.. submitting his writing for technical magazine occasionally.
twitter account:
https://twitter.com/chobichan

Chobichan avatar

Follow him

All articles from @chobichan

share