14M Infrain2 problems

boriz

Senior Member
I’m not getting anything from INFRAIN2 when using my Hitachi remote handset. ‘Scope says there is a good clean code-signal on the pin (14M Physical Pin4). I know the RX module and my TX handset both work. Hitachi is prolly using an unsupported protocol. I have tried the routines published on Hippy’s site (thanks Hippy). No luck though.

I tried a Sony remote and managed to get some limited success. Out of over 40 buttons on the handset, INFAIN2 will only recognise 4, ‘TV on/off’ , ‘Input select’ , ‘Vol up’ , ‘Vol dn’, (codes: 21, 37, 18, 19). Something wrong with my AXE?

Here is the simple test code that only responds to 4 buttons on the Sony:
Code:
setfreq m4
do
	infrain2
	sertxd (#infra,32)
	high 0
	pause 50
	low 0
loop
Output zero is just a confirmation LED. The INFRAIN2 command remains stalled for any other button than the 4 described above. The Sony remote TX works fine for it’s intended equipment and all the buttons produce a clean code-signal on physical Pin4.

I really would rather use the Hitachi remote TX though, instead of adding another handset to the collection. Anyone tried to get a Hitachi remote working with PICAXE? Anyone have any links/info on the Hitachi protocols?

My intention is to have a button on the Hitachi (TV) remote turn the main overhead lighting on/off.
 

mikie_121

Member
What IR receiver are you using?

I used a TSOP 1738 and my sony remotes worked for all of their buttons. I had an LCD displaying the received number.

Is there any way to read in ANY remote code (through bit banging or whatever)?
 

mikie_121

Member
The receiver looks like it should work.

I had problems with an IR receiver from Jaycar that was designed for my application so I tried another (equivalent) one and everything worked perfectly. So it seems that not all IR receivers are equal, even though they are apparently the same.

Try a different receiver if you can. It might be the problem
 

eclectic

Moderator
Boriz.
I'm using the same Rapid-sourced receiver and a 14M.

Tried your program, using

a. RevEd transmitter: all 17 key-codes OK.
b. A Sony System Audio remote. Program only accepted the CD/MD/Tuner.
No reception on Clock/Cursor/Function keys.

It seems certain that our handsets are transmitting codes other than the
TV / Device 1 set.

It might be an interesting experiment to build a simple Infraout
transmitter, and loop through the Non-TV device codes,
shown in Manual 2 pages 83-87.
Then, see if your Sony system responds.

e.
 
Last edited:

hippy

Technical Support
Staff member
It's probably more to do with what the remote puts out than anything else.
 

boriz

Senior Member
I read someplace that some IR receivers have inverted outputs, so I used a simple transistor inverter. Getting a nice code-signal at the AXE pin, but no response at all from the AXE, not even to the Sony, so that’s a bust.

I have two oscilloscopes but neither are storage scopes. I’m gonna use a digital camera to get an image of the code (need a storage scope really), and maybe I can use a PULSIN strategy similar to Hippy’s.

Any info on Hitachi protocols would be cool.

Thanks all.
 

BCJKiwi

Senior Member
The original Sony remote has been superseded (at least twice) by newer models that use much longer data strings on each output.

Have one of those 'universal" preprogrammed remotes and when set on Sony mode, find I have to deduct 11263 of the data read in for the number to be correct!
Code:
GetIR:
IRIN [10000,cfg_loop],cfg_in, w1 'wait 2.5 secs for input
pause 1000
b1 =w1-11263
 

boriz

Senior Member
Thanks all.

I have just been plugging away all day and I think I’ve cracked it. Unfortunately it uses ALL available variable space, but that’s ok for my application. Here is the code that works with my Hitachi TV remote:
Code:
'''PICAXE 14M Hitachi TV remote control receiver/decoder
symbol t=100  '''threshold for bit timing
do
	'''wait for valid code start
	do
		do:loop until pin3=0
		pulsin 3,1,w0
	loop until w0>300
	'''valid code begun
	high 0  '''illuminate 'signal recieving' LED
	'''waste first 5 pulses (prolly just sync)
	for b0=0 to 4:pulsin 3,1,b1:next b0
	'''read bit pattern
	pulsin 3,1,b0
	pulsin 3,1,b1
	pulsin 3,1,b2
	pulsin 3,1,b3
	pulsin 3,1,b4
	pulsin 3,1,b5
	pulsin 3,1,b6
	pulsin 3,1,b7
	pulsin 3,1,b8
	pulsin 3,1,b9
	pulsin 3,1,b10
	pulsin 3,1,b11
	low 0  '''extinguish 'signal receiving' LED
	'''work out the code from the bit pattern
	w6=0
	if b11>t then:w6=w6 or 1:endif
	if b10>t then:w6=w6 or 2:endif
	if b9>t then:w6=w6 or 4:endif
	if b8>t then:w6=w6 or 8:endif
	if b7>t then:w6=w6 or 16:endif
	if b6>t then:w6=w6 or 32:endif
	if b5>t then:w6=w6 or 64:endif
	if b4>t then:w6=w6 or 128:endif
	if b3>t then:w6=w6 or 256:endif
	if b2>t then:w6=w6 or 512:endif
	if b1>t then:w6=w6 or 1024:endif
	if b0>t then:w6=w6 or 2048:endif
	sertxd(#w6,32)
loop
Not very elegant, but it seems to work consistently and all the buttons produce unique codes. I never found any protocol info. I just used lot’s of guesswork, brute force and oscilloscope squinting.

Thanks Hippy for the brute force idea.
 

boriz

Senior Member
Well. I was flummoxed for a few days, but FINALLY I figured it out. When I was just testing the IR receiver routine, I was getting good, consistent results. But when I added the rest of the program, I was getting consistent codes (same code for each press of same button) only about 80-90% of the time. I tried all sorts, but the reason was fairly obvious once I found it. It’s all working fine now. Time to start soldering.

The complete program has SERVO commands, for actuating the physical light switch. Unfortunately, once a SERVO command has been issued, the relevant output has a continuous oscillating signal on it, and that was somehow interfering with the PULSIN commands.

I fixed it by setting the SERVO pin high after the servo has had time to move to it’s final position. In this case 600mS after the SERVO command.

The servos have extended ‘fingers’ about 5cm long that swing from the rest position to the light switch and back again upon receiving the correct IR remote code. One finger flips the light switch up, the other down. I wanted to avoid the whole interfacing-with-the-mains issue, and I like the ‘robotness’ of this solution.

Anyway. Just FYI. SERVO commands can interfere with PULSIN commands.

Here’s the complete program:
Code:
symbol t=100
do
	do
		do:loop until pin3=0
		pulsin 3,1,w1
	loop until w1>400
	high 0
	for b0=0 to 4:pulsin 3,1,b1:next b0
	pulsin 3,1,b0
	pulsin 3,1,b1
	pulsin 3,1,b2
	pulsin 3,1,b3
	pulsin 3,1,b4
	pulsin 3,1,b5
	pulsin 3,1,b6
	pulsin 3,1,b7
	pulsin 3,1,b8
	pulsin 3,1,b9
	pulsin 3,1,b10
	pulsin 3,1,b11
	low 0
	tune 2, 1,($00,$C1)
	w6=0
	if b11>t then:w6=w6 or 1:endif
	if b10>t then:w6=w6 or 2:endif
	if b9>t then:w6=w6 or 4:endif
	if b8>t then:w6=w6 or 8:endif
	if b7>t then:w6=w6 or 16:endif
	if b6>t then:w6=w6 or 32:endif
	if b5>t then:w6=w6 or 64:endif
	if b4>t then:w6=w6 or 128:endif
	if b3>t then:w6=w6 or 256:endif
	if b2>t then:w6=w6 or 512:endif
	if b1>t then:w6=w6 or 1024:endif
	if b0>t then:w6=w6 or 2048:endif
	if w6=2512 then
		gosub trig1
	elseif w6=2448 then
		gosub trig2
	endif
	do:pulsin 3,1,w1:loop until w1=0
loop

trig1:
servo 5,200
pause 600
servo 5,100
pause 600
high 5
return

trig2:
servo 4,100
pause 600
servo 4,200
pause 600
high 4
return
 

boriz

Senior Member
It works!

It’s not pretty, and I had to fudge a few things, but I now have on/off control of living room overhead lighting by spare buttons on the TV remote without interfacing to any mains wiring. If I get bored with it, I’ll just dismantle it. If I get used to it, I’ll rebuild it in a prettier, more permanent package.



A - Wall mounting brackets.
B – Small transparent plastic ‘extender’ glued to the switch. Solved several issues. Will find a way to do without it eventually.
C – ‘Fingers’ glued to the servo outputs. They swing to the switch then return. One button operates the upper servo, another button, the lower servo.
D – IR receiver module.
E – 8 pin IC socket for 08M PICAXE (Missing!). I can’t order one by Paypal. RAGE!
F – 14M temporarily standing in until I can get an 08M.
G – 4xAA batteries. I estimate good for about 2 months.

In this image, the fingers are protruding about 90 degrees out from the wall, but the normal rest position is to the right, flat against the wall, out of the way.

I wonder what the missus will say in the morning when she first sees it. :)
 
Top