Looking for insights

dabineri

Member
I am working on a project in which I am using a picaxe but need some broader tips that some who visit here may be able to help with.
I have a replaytv 5000 (one of the original dvr's) and am trying to coordinate it with a new directv satellite box. I need to have the replaytv change the channel on the satellite box when it begins recording a program.
The replaytv has an output for an 'ir blaster' which produces an ir signal to trigger the satellite box to the channel that it has been set to record. Also, built in to the replaytv are ir codes for many devices and manufacturers. Since the picaxe is capable of decoding Sony ir signals, I am using it to decode what is coming from the replaytv. As I choose a device to trigger in the replaytv, I can see the Power On signal that it sends as a test but when I look for various channel codes when changing channels, I do not see any.
Once I can see the codes for each channel number I will then use that information to trigger the satellite box to change to the correct channel.
Does anyone have any hints or have some knowledge of the replaytv that might help in this project.
 

dabineri

Member
As I said, I have the picaxe reading the codes coming from the ir blaster but it only sees the test signal (power on) but no channel number codes.
 

eclectic

Moderator
As I said, I have the picaxe reading the codes coming from the ir blaster but it only sees the test signal (power on) but no channel number codes.
I should have worded my question better. :)

You have built a Picaxe/Tsop circuit.
Does it work receiving Sony TV1 codes?
(Man 2 p.115)

e
 

dabineri

Member
What is Tsop?

I used a remote control set to SONY and when I touch the 1 key, the picaxe decodes to 0, when I touch the 2 key, the picaxe decodes it to a 1 etc. This tells me that the picaxe is, at least, reading codes.
So, knowing that the picaxe is doing its job, I am looking for codes from the ir blaster output. I have tested all the half dozen different Sony code sets available in the replaytv but none of them seem to produce anything that the picaxe can decode.
 

hippy

Technical Support
Staff member
It seems to be one of four things -

1) The replaytv not sending channel number codes
2) The channel codes not conforming to IR codes the PICAXE can receive
3) The PICAXE not receiving / detecting the IR codes
4) The PICAXE software not reporting all IR commands received

The challenge now is to work out which it is. The test suggested by eclectic will confirm that the PICAXE is receiving Sony IR from other sources which will help to narrow things down.
 

hippy

Technical Support
Staff member
Thought ... The replaytv controls "satellite receivers" and "cable boxes" rather than "TV" so it could be that the Sony IR codes are not "TV codes" ( not using a 'device identifier' of 1 ) so the PICAXE won't receive them with INFRAIN/IRIN. It may just be luck that an apparant TV code is being sent for Power On, or maybe that is to turn the TV on but not control the channels.

You should be able to receive Sony IR with TV and non-TV identifiers using bit-banged IR recieve. There should be example code on the forum. Which PICAXE are you using ?
 

dabineri

Member
hippy, that makes a great deal of sense, I am not receiving TV control codes!

Unfortunately, I have to specify "satellite" box in order to get the programming I need.

What is the code "1" that you refer to?

Thanks, Dave
 

hippy

Technical Support
Staff member
The Sony IR code is made up of two parts, 'device identifier' and 'command', so the same ON-OFF commands can be sent to a TV or DVD etc and not affect the others. The device identifier for TV has a value of 1, other equipment has different identifiers. INFRAIN and IRIN only accept commands accompanied with a TV device identifier.

This device identifier is the ID0-ID4 bits shown on page 115 of PICAXE Manual 2.
 

eclectic

Moderator
Dave

1. TV1 is found in Man2, p.115 onwards.

2. See p.115, where youmay be able to use a Picaxe for the transmitter
INFRAOUT device,data

3. See post#8 in this thread.
http://www.picaxeforum.co.uk/showthread.php?t=10660&highlight=Hitachi

I don't own a Sony TV or "Box"
just an old HiFi system

Code:
#picaxe 18m2


main:
irin C.1,w0

b1 = w0-11263

Sertxd (#w0,"  ",#b1)

goto main



#rem

GetIR:
IRIN [10000,cfg_loop],cfg_in, w1 'wait 2.5 secs for input
pause 1000
b1 =w1-11263
It gave numbers for the Sony HiFi remote

Might be worth a play?

e
 

dabineri

Member
OK, now another angle.

The replaytv also sends out a signal on a serial port using a null modem cable. I have read the dodes coming from this port during a channel change (9600,8,N,1 by the way) using Visual Basic and the codes are not unique! Same code for channel 5 and 6 for example. Not very useful if these are correct.
Am I likely to see any different codes using a picaxe serin command and is this possible?
 

eclectic

Moderator
OK, now another angle.

The replaytv also sends out a signal on a serial port using a null modem cable. I have read the dodes coming from this port during a channel change (9600,8,N,1 by the way) using Visual Basic and the codes are not unique! Same code for channel 5 and 6 for example. Not very useful if these are correct.
Am I likely to see any different codes using a picaxe serin command and is this possible?
Now three thing to play with. :)

1. Building a Picaxe sender.
2. The code from two posts ago.
3. Try the serial angle (after carefully checking voltages etc.)
Use a 1k + resistor in series.

e
 

hippy

Technical Support
Staff member
The serial port was a suggestion I was also thinking of. I'd be surprised if the codes weren't unique, perhaps it's more an issue of polarity or baud rate, perhaps not being 'standard serial' or missing and not displaying some of the data sent.

Best approach would be to put a scope on the serial and see what it is, find someone else who's already done it and has code examples, or dig through datasheets and Google.

The serial approach is what I'd probably choose. There's also the question of how you are going to control the receiver; is that via IR ? If so, how are you going to generate it, be able to generate that whilst other serial data may be arriving ? That may be premature; first thing is being able to reliably receive. I'd choose a 20X2 or 28X2 as it has background serial receive but, again, we should perhaps first find out what data is sent and how much.
 

dabineri

Member
Believe me, I've been digging.
I have an extra directv remote that I will use to send the correct channel codes once I find them.

Can you point me to some good sample code to bit-bang in order to try to discover what is coming from the replaytv?

Thanks, Dave
 

hippy

Technical Support
Staff member
To be absolutely honest, there's no substitute for a scope or logic analyser. Bit-banged code really has to be designed to fit what it receives rather than used to determine what's being sent at it.

You should be able to get by with using a 'soundcard scope' with a voltage divider to protect the input for looking at slow speed IR like Sony IR, and some PC IR applications I recall have an ability to sample IR and show bit timings.

I think you'll also need a scope if you mean for serial, and it may be too fast for a 'soundcard scope'.
 

dabineri

Member
I have a scope. Roughly what am I looking for in order to try to decode the signal besides the carrier frequency?

Thanks, Dave
 

eclectic

Moderator
Final try

Code:
; Forum 08 Feb 2011
;AXE091 board

#picaxe 08M
;SENDER
Symbol Sony = 23 ; might be one of several. 

; http://www.rockabilly.net/sony/

;  http://www.rockabilly.net/sony/Sony_idtv.htm


symbol Code = b0
Symbol send10 = b1

main:
for code = 0 to 127

for send10 =1 to 10
infraout Sony, code

pause 45
next

next

#rem
#picaxe 18m2
;Receiver

main:
irin C.1,w0

b3= w0-667  ;play with numbers here
Sertxd ("Raw =",#w0,"  -= ",#b3,cr,lf)

goto main

e (and OE)
 
Last edited:

dabineri

Member
Thanks to all who made suggestions here. I will try to decode this with a scope and let you know how it goes.

Dave
 

dabineri

Member
I am now looking at the output of the TSOP on a scope so I am looking at the signal demodulated I guess. I am seeing groups of well defined pulses but nothing showing on the 08M using infrain at the same time.

Am I correct in thinking that this is probably a 38Khz signal since it seems so cleanly decoded by the TSOP but that the code is not a Sony code?

What is the next step in being able to decode the signal?

Thanks, Dave
 

westaust55

Moderator
The PICAXE INFRAIN/INFRAIN2/IRIN commands are only for use with the Sony SIRC protocol.

Do you know which protocol is being used?
If not, can you capture the data you see on the scope and post some images for various signal codes?
Then, it may be possible to identify the protocol.

You will need to create a bit-bang routine to receive the incoming data stream provided the data rate is not to high and the timing scheme is within the capabilities of the PICAXE chip you are using.
 

dabineri

Member
I am not sure that I need to know what the codes actually are. I am just interested in the 10 channel numbers 0-9 and will have to decode them every time anyway. In other words, when the dvd sends a channel 29 command, I will need to decode this signal, recognize it as a 2 and then a 9 and I will then trigger the remote control for the satellite box to send a 2 and then a 9 so that it tunes to the correct station.

I think I should be able to use pulsin to do this shouldn't I?

I wonder if there is a way to take a non-TV Sony code and insert the correct device code into the pulse stream so that the picaxe will then be able to interpret it for me?

Dave
 

hippy

Technical Support
Staff member
Looking at the IR waveforms is really just to confirm they are as expected, that you have a code set selected which is appropriate for being bit-banged read. You could just add the bit-banged reading code, try Sony code sets until it works, but if it doesn't you're nowhere further than INFRAIN not having worked :)

One of the Sony code sets should however work, so it may be easier and quicker to try it and see.

You could try other code sets to see if INRAIN reads any of them but trying to insert bits into codes is likely to be much more complicated than using bit-banged read code.
 

hippy

Technical Support
Staff member
I suggest you take a look at this handy program. I found it invaluable trying to design a PICAXE circuit that sends/receive IR codes:

http://www.ostan.cz/IR_protocol_analyzer/
That looks very useful. I wonder if it's possible to convert it so it can read a demodulated signal from a TSOP18 rather than photo-transistor ... ? Of course, it's not that hard to simply get a photo-transistor!

The new 20X2 has multiple hardware timers with gating on-chip so it should be possible to measure TSOP18 high and low bit times very accurately and do almost the same on a PICAXE. Not excessively complicated for someone used to poking with SFR but not a five minute job either.
 

dabineri

Member
One site I just looked at shows the 12 bit Sony code having the device code at the end of the pulse train. It would seem that this would make it much easier just to strip what is there and add the 10000 to make it a TV code. Has this been tried?

Thanks, Dave
 

hippy

Technical Support
Staff member
That's a good point and does make it easier. In principle it's just a question of delaying from start of IR, swap from IR input to whatever fakes the TV identifier. You'd have to cater for tolerances of the IR stream but shouldn't be too hard, might not even be an issue.

It could be done with a separate PICAXE and bit-banged output is easier than bit-banged input. I don't know if anyone's done that but I wouldn't have thought so.

It's probably still easier though to bit-bang. Here's code which should work at 4MHz, double the times for 8MHz. Credit goes to Bernard Grabowski and Peter Dixon.

Code:
Deleted : See Post #37
I take it you got nowhere with the serial port ?
 
Last edited:

inglewoodpete

Senior Member
32-bit IR code receiver

No-one has mentioned my 32-bit NEC format "Universal" code receiver documented in User Projects - Communication.

All you need is a TSOPxx or similar receiver/demodulator, a PICAXE 20x2 and a couple of R's and C's (as per the circuit diagram under the "IrIn" command in the command manual). Connect the output of the TSOP to the appropriate pin on the PICAXE 20x2 as per my post.

Load the code and try it. If your box is outputting 32-bit code (almost certain), my code should work for you.

I've included a lot of comments in the code and detailed how the protocol works. And, I'm around here most times if you have questions.

Peter
 
Last edited:

vttom

Senior Member
That looks very useful. I wonder if it's possible to convert it so it can read a demodulated signal from a TSOP18 rather than photo-transistor ... ? Of course, it's not that hard to simply get a photo-transistor!
Actually, I found it works just fine with a photo-detector or with the output of a demodulator. The only requirement is that the output of the demod needs to be high (or open collector) when idle and pulls low when it detects an IR burst.
 
Last edited:

hippy

Technical Support
Staff member
Excellent news and it works well. Good find and thanks for pointing it out.

I ran a TSOP18 from 5V and simply took the open-collector output / 0V to the Mic input; doesn't seem to matter if Left or Right. First sample it identified as "Sony", but all since as "Unknown", but the timing trace is all there.

Works with all remotes I have. Only one caused issues; that sends a code then a short 'repeat code' and the recorder shows the repeat code if you hold the key too long or press the same key in succession.

TSOP18 viewed from top, legs pointing away from viewer ...

Code:
   _    .------------------(
  | |---'              .---(
 (| |---.    -.- +5V   |
  |_|---|-----'        |
       _|_ 0V         _|_ 0V
 

hippy

Technical Support
Staff member
And while browsing around disk I've just re-found this ... my own sound card scope in VB6. Showing the TSOP18 output. So that's another project on the list to finish and I can do my own IR decoder if I want to.
 

Attachments

hippy

Technical Support
Staff member
Wanting to use IR from a Sony DVD remote to control my own PICAXE+MP3 player I need to do something similar to what you want.

I rewrote the bit-banging code which is tested and works on a 20X2 ( and 28X2, plus 18M2 after changes ) giving both device identifier (b1) and command code (b0).

It's not ultra-robust and can be improved but should work okay. At least good enough to detect if you are getting expected codes out of the replaytv.
 

Attachments

Top