Arduino-IRremote / Arduino-IRremote

Infrared remote library for Arduino: send and receive infrared signals with multiple protocols
Other
4.45k stars 1.76k forks source link

Commodore Amiga CD-TV Protocol #407

Closed salocinx closed 7 years ago

salocinx commented 7 years ago

Hi, first of all many thanks for this great library! I am looking for someone that is willing to implement the IR-based "Commodore CDTV Remote Control Protocol". It is a proprietary protocol. I don't have an oscilloscope for analysis and I would not be capable of doing the job even if I would have one. But I could provide a CDTV controller for testing.

I have tested the remote control with this library's the NEC protocol. Button presses are recognized quite well, but there's a problem with the repeat signal, it's somehow not reliably detected by the library (I get the repeat signal only from time to time when holding a button pressed).

Resources I have found so far:

  1. Official Commodore CDTV Manual -> not much Information about the Protocol itself
  2. A Youtube video series from one that implemented the protocol on a PIC16F628A -> Video 2/5
  3. The source code of the protocol implementation on the PIC16F628A

Someone that is willing to implement the CDTV protocol :-) ?

bengtmartensson commented 7 years ago

There is a Lirc file for CDTV. It can be imported in IrScrutinizer, revealing that the commands are using the protocol RCA-38(Old), D=0, varying F. IrScrutinizer can also generate Arduino code directly.

Does this help you?

AnalysIR commented 7 years ago

@salocinx Did you consider just using the RAW format supported by the library? This would be fine if you are just looking to replace the remote. However, if you need to decode signals sent by the remote, then you will need more.

A first step for you to try would be to post the output of a set of signals captured from your remote, using the example sketch IRrecvDumpV2, provided with the library.

PS: It would be unusual to get others to write all the code for you. Typically, users post their own efforts and get assistance/suggestions where needed.

salocinx commented 7 years ago

@bengtmartensson: Wow, thank you a lot for your efforts. Sure, this will help 👍 Your generated code is for sending the button code as raw data, I will need it the other way around, but it's a great starting point.

@AnalysIR: Yes that's correct. I basically want to receive the CDTV signals, not sending them. My goal is to control a Amiga CD-32 with an Amiga CDTV remote.

I meanwhile started two threads, one in the Arduino forum and the other in the Amiga forum. We already collected some useful information about the proprietary CDTV protocol. So basically, the codes are composed of 12-bits and another 12-bits, that are an inverted representation of the first 12-bits, are appended (total of 24-bits). I guess this is a kind of checksum to ensure the first 12-bits have been sent/received correctly. If a button is hold down, a simple 4-bit repeat signal (1 == #FFFFFFFF) is sent as long as the button is held down; or until any other button is pressed simultaneously.

I also analysed the timings of my CDTV remote with the IRrecvDumpV2 sketch, here are the results:

Encoding : UNKNOWN Code : 72A03D6B (32 bits) Timing[51]: +8900, -4450 + 400, -1200 + 350, - 400 + 400, - 400

  • 400, - 400 + 400, -1200 + 400, - 400 + 350, - 450
  • 350, - 400 + 400, - 400 + 400, - 350 + 450, - 400
  • 350, - 450 + 350, - 400 + 400, -1200 + 400, -1200
  • 350, -1200 + 400, - 450 + 350, -1200 + 400, -1200
  • 350, -1200 + 400, -1200 + 350, -1250 + 350, -1200
  • 400, -1200 + 350 unsigned int rawData[51] = {8900,4450, 400,1200, 350,400, 400,400, 400,400, 400,1200, 400,400, 350,450, 350,400, 400,400, 400,350, 450,400, 350,450, 350,400, 400,1200, 400,1200, 350,1200, 400,450, 350,1200, 400,1200, 350,1200, 400,1200, 350,1250, 350,1200, 400,1200, 350}; // UNKNOWN 72A03D6B

Someone from the Amiga forum wrote me some hours ago, that he already has implemented this proprietary Commodore CDTV protocol and managed to add it to the IRreceive library. I will now wait for his code before I dig deeper into this issue (although I am looking forward to do so :) ).

Thanks for your PS, I will keep this in mind when posting here in future.

AnalysIR commented 7 years ago

I have imported you signal into AnalysIR & attached a screenshot.

it looks like a pretty straight forward signal & you could just copy the NEC code from the library and change the NEC timings to match AMIGA (8900/4450/400/1200). Also change the NEC 32 bits to 24 bits. The NEC repeat stuff can be ignored for this signal. As you mentioned it is a 24 bit signal.

amiga 636207805959458639_analysir_screenshot

salocinx commented 7 years ago

Wow great! It now works pretty fine 👍 Thank you! Sometimes I still get some HEX codes I am not sure if they are correct (mainly when pressing multiple buttons together), but I will make some statistics and write all meaningful button combinations down in order to verify.

Why do you think to ignore the repeat signal? Because it should be the same than the NEC one or because I won't need it? I will need the repeat signal to determine if and when the user released a button, this is quite important for a game controller like the CDTV remote.

AnalysIR commented 7 years ago

Great to hear the progress made. Don't forget to submit you code for inclusion in the library, once you are happy with it.

NEC sends a special/shorter repeat signal, which most other protocols don't send. That is why I suggested leaving the 'special NEC' repeat bit out. Of course if you detect a second signal you should process that as normal.

Of course if the AMIGA has a similar repeat signal to NEC then you should include it.

The contacts on a old remote buttons can often be dirty/noisy and may benefit from a bit of 'gentle' internal cleaning.

salocinx commented 7 years ago

@AnalysIR : Thanks for your suggestions. I meanwhile managed to implement the CDTV protocol and it now works flawlessly including checksum validation :-) I never made a "pull-request" so far. Could you please advise me quickly how to do that? Which branch should I take take, etc...? Thanks for your generous support!

AnalysIR commented 7 years ago

@salocinx

..Sorry I am not familiar enough with the process to advise...perhaps @z3t0 can help

z3t0 commented 7 years ago

@salocinx This page from GitHub's help site should be useful

salocinx commented 7 years ago

Pull request initiated. Thank you!

z3t0 commented 7 years ago

Will continue in the PR.