Apple Remote Control *Working Program*

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Apple Remote Control *Working Program*

Post by hyperion007 »

Hi,

Has anyone used a Apple remote control, the aluminum one for example, with Flowcode? I know how to use the RC5 module in FC but as the Apple remote uses a apple version of the NEC protocol, I don't know how to get this working. I would love to be able to use this remote control as it is very nice.

Any help would be great. I found this page: http://hifiduino.wordpress.com/apple-aluminum-remote/

I don't even know what kind of IR receiver I should get.


Thanks
/Daniel
Last edited by hyperion007 on Tue Feb 19, 2013 10:25 pm, edited 1 time in total.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Apple Remote Control?

Post by Enamul »

Enamul
University of Nottingham
enamul4mm@gmail.com

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

Thanks for your reply.

I have found what IR sensor I should use and have gotten one, so I will be experimenting with this as soon as I get my hands on a remote :)

The unilink doesn't work for me though, if you by any chance saved it, could you attach it here?

I'll keep updating this thread as I get on with this project.

Thanks.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

Ok, I have everything connected

I am using a PIC18F2520 and have the output pin from the ID receiver (TSOP34838) connected to RC7

But now I am stomped. I don't know what to do to be able to read the codes that the remote is sending. The carrier frequency is 38Khz and I can see that the receiver is working by connecting a LED on the output and pressing a button on the remote, the LED starts to flicker ever so slightly.

The codes that the remote is sending are:

2011242643 - Play/Pause

2011287699 - Volume Up '+'

2011279507 - Volume Down '-'

2011238547 - Previous

2011291795 - Next

2011250835 - 'Menu'


I have made a macro that is called over and over from the main loop

It is not as simple as to just listening to the input of RC7 and returning its value to a variable that is Long number

I gather that I probably need to use some sort of timer or interrupt but I don't know how.


Anyone knows?

Thanks

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

This can now be moved to the V5 forum (I have registered for the V5 portion of the forum)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

I think the addition of a Apple remote component to use with FC would be great for anyone wanting a simple yet elegant remote control that is also readily available.
It seems very popular with the Arduino crowd.
Last edited by hyperion007 on Wed Feb 06, 2013 2:01 pm, edited 1 time in total.

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: Apple Remote Control?

Post by Sparkoids »

I have the original white remote control from Apple which uses the same keys and agree this is a good idea...

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

I have a white one as well for testing but placed an order for two aluminum ones today.

Do you have any idea on how to make this work? :)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

I have now been able to get TMR0 and INT2 working so that I get a reaction when I press the remote control.

But I cannot seem to get the correct "timing" so that I can determine if there is a zero or a one.

The codes that I posted earlier are 32bit

The timings of the remote control are:
Protocol on (µs) off (µs) total (µs)
leader 9000 4500 13500
0 bit 560 560 1120
1 bit 560 1690 2250
stop 560 N/A 560

I have tried many different prescaler settings on the timer and calculated different Pulsewidth values but the closes I came was a RCpacket01 value of 21845 which is 0101010101010101
Attachments
PIC18F2520_temp.fcf
(51.13 KiB) Downloaded 237 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

I have had some luck with reading out the header.

I think I only need to know the off pulse-width to know if it is a 0 or 1

Also, I only need the third Byte and really only the first 7 bits of it. And the remote sends each byte (4 Bytes in total per button) with LSB

I don't seem to be able to capture all pulses.

I get 175 ticks when testing only the header's off pulse every time I press a button on the remote so that seems accurate, but after that everything goes sour :(

Look at the macro "RC" in this FCF file please and try to figure out what I am doing wrong here.

Feel free to make a new variable to store the captured Byte 3 with LSB first.

If my calculations are correct then:

4500us which is the header off time equals the 175 ticks I have been getting from TMR0 with prescaler 1:128
Then a "0" which has a off time of 560us would equal 20-25 ticks of TMR0
And a "1" with a off time of 1690us would equal 60-70 ticks of TMR0


Thanks for any and all help on this.
Attachments
PIC18F2520_temp.fcf
(77.22 KiB) Downloaded 227 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

Ok,

I have re-written this program, for the PIC18F4550 and only included the RC portion of the program

Maybe now someone wants to have a look at it?

Right now I am getting 0x55 or 01010101 or decimal 85 from the first 8 bits and then I turn the RB2INT off,

I should be getting 0xEE or 11101110 or decimal 238 but that is not the case :(


Please help me with this.
Attachments
PIC18F4550_Apple_RC.fcf
(17.22 KiB) Downloaded 189 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

I am now left with two problems

1. I need to change the order from LSB to MSB on all four bytes

2. I get correct data from the remote on the first button I press after I restart the PIC (but in LSB format instead of MSB). But when I press the next button, the information in all 4 bytes are wrong

On first button press I get:

Byte1: 119 (0111 0111) it should be (1110 1110)
Byte2: 225 (1110 0001) it should be (1000 0111)
Byte3: 160 (1010 0000) it should be (0000 0101)
Byte4: 208 (1101 0000) it should be (0000 1011)

but when I press the same button again, or another button, nothing makes sense.

I should be getting:

Byte1: 119
Byte2: 225
Byte3: should change if another button is pressed
Byte4: 208
Attachments
PIC18F4550_Apple_RC.fcf
(20.81 KiB) Downloaded 157 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Apple Remote Control?

Post by hyperion007 »

Never mind, I got it working. I don't need to convert from LSB to MSB

If anyone want to use an Apple remote they can use this.

Byte3 is the command byte

Here are the codes with my program:
So IF RCbyte3=

Play/Pause: 160
Vol-: 48
Vol+:80
Next:96
Prev:144
Menu: 192
Attachments
PIC18F4550_Apple_RC.fcf
(26.87 KiB) Downloaded 171 times

Post Reply