1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

XBOX Remote Control

Discussion in 'Microcontrollers' started by gregmcc, Jul 18, 2006.

  1. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    I've seen a few projects on the interent where using a PIC/Atmel controller you can switch the xbox on/off. Here in SA I cannot get any of the Atmel controllers unless I order in bulk. I also cannot seem to get any of the other PICs to work.

    To cut a long story short I've discovered Nigels tut on using the 16f628 with IR. (http://www.winpicprog.co.uk/pic_tutorial5.htm) - Tut 5.1

    Kinda looks simple enough and I just need to adapt it to work with the xbox RCA procol (http://pablot.com/rca.htm) (Yes, you can buy the already completed project, but I think of this as another learning project :)

    I've started going thru the tut so once I've understood it I can convert it. One thing thats confusing me is on the TryError, TryZero etc routines, where do you get the values from (20,60,112) to decide if its valid.

    Also from looking at the RCA protocol should it be a simple process to detect which key is pressed on the remote using Nigels tut, or am I missing something else?

    Any help/throughts/comments would be appreciated.
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,231
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    I determined them experimentally!.

    It looks a similar system, so should be fairly easy to do.
     
  3. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Thanks for the quick reply. I'll build the circuit tonight with the LCD and see what I can get going.

    I'll let you know when its all working....or when I'm horriblry stuck :)
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,231
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE

    OK, BTW, the way I 'experimentally' decided the values was to display the received number representing the pulse width on an LCD - and used another PIC to generate a pulse of the required length (three different times, for the three pulse widths required). This gave me three values for the length of the pulses, I then simply picked values inbetween them to allow for a wide spread.
     
  6. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Thanks - think I will have to try this well. I tried to guess the value but it looks like its going to be far easier to use another PIC to generate a pulse.
     
  7. MATT! :o)

    MATT! :o) New Member

    Joined:
    Feb 6, 2004
    Messages:
    2
    Likes:
    0
    A friend (David Mills) and I have been working on a 12F675 (or I reckon a 629 would do) version of the x-box IR on/off thing, I supplied a bit of the code to check bit lengths, he has done the rest (i.e. 90%) of the code, I had a bit of a "Can't Be Arsed" moment, he wanted to control his xbox, I found a 3.3V IR detector and some homebrew 628 code for mine ;)

    Ok if I am going a bit fast, it's a device similar to this..... http://www.mod-chip.com/en/ir_mod.php
    But our version basically just turns the xbox on/off with the "Display" button on your xbox IR remote (and no, I don't have anything to do with the mod-chip.com device).

    It's basically a device for lazy people like me to turn on/off thier X-box without getting up, please note that it requires a lot more effort to install this thing, than just simply pressing the "on" button on your X-box.... go figure (as the Americans say)!

    The main problem with the other homebrew pic/atmel circuits is that they require the use of a 3.3V IR module for this reason our design uses a voltage pump to boost the voltage so that common 5V IR modules can be used (I stole my 3.3V detector from my son's Tamagotchi, as he only has 1, I figured he wouldn't need the IR anyway.... hope he doesn't find out!)

    The code is tested and working and we are happy to post the code/pcb layout's as long as it is not used/sold as a comercial product and.... and this is the big 1!..... no-one picks the code to bits and complains "how using this method would have been more effecient" etc, it's an "as is" project, take it mod it, improve it and post it!

    Just in case the "don't complain" message didn't get through, we KNOW the delay routines are.... well to be honest... crap, we KNOW you could replace them with loops, we KNOW there is some software on the net to help you to do this, we just didn't WANT to! I think you get the idea!! So as said, please replace the delay routines, tidy it up, and re-post it!

    I nice feature to add would be to store your own on/off buttons in the eeprom of the 12fxx, please feel free, the other codes for the other buttons are shown at the bottom of the ASM.

    If peeps want this code/(project?) then please post here and I will upload it...... but I will need to know how!!! I have only ever posted messages here not files, yes I know it's sad, but I am 38 now, and getting too old to read ;o)

    Regards

    MATT! :) (and David!)
     
    Last edited: Jul 20, 2006
  8. MATT! :o)

    MATT! :o) New Member

    Joined:
    Feb 6, 2004
    Messages:
    2
    Likes:
    0
    Hmmm, well I thought I had attached the file, I clicked the relevant box, uploaded it... can't see it tho :( So if it isn't there, any ideas to get it there would be appreciated!

    BTW, the files in the RAR are for MPLAB.

    Hope this helps!

    Regards

    MATT! :)
     
  9. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    Thanks fpr the reply.

    I originally started fiddeling with circuit from "Mathieu Mallet" from http://mmallet.ottawaengineers.ca/projects/xboxremote which uses a 12f675

    When I couldn't get that working (it looked like weird timing problems) I had a look around and then thought about adapting or rewriting the code for the 16f628. I'm also just looking for a solution to power on the XBOX using one button. I'm running XBMC so only power it on to steam movies. :)

    I dont see any files attached either :( I'm sure you can attach files here. If not could you please email it to me. (gregmcc@hotmail.com)

    I promise not to poke holes in your code.....besides its probably a lot better than mine. :)
     
  10. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK
    Hello Greg
    I am going to mail the code to you, can you please do me a favour and post it here for me? The forums machine doesn't like me 4 some reason ;)

    As I said most of the code is my mate David's, so he can take the glory/crap for it, lol I have helped him out on some of it and he couldn't be botherd to post it ;) So I thought I would.

    I hope this helps.
     
    Last edited: Jul 20, 2006
  11. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Matt,

    Thanks - got the code. I've redone the file in zip format (I dont think the system likes rar files)

    I've gone through the code but dont see anywhere you detect where the button is pressed or check for timings etc. Is that all the code? (Unless I'm missing something, which is entirely possible)
     
    Last edited: Jul 20, 2006
  12. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK
    Ok, now all the wrong code and attachment "issues" have hopefully corrected themselves, please download the attached zip for the controller code.

    Please note, if you happen to have a 3.3v tolerant IR detector, you don't need to use pin 5 (GP2) C3,D4,D3 or C2, these items make up the "charge pump" to boost the voltage to enable 5V IR detectors to work correctly. If you remove these components, then please connect the +V side of your IR detector and the "top" of R2 to Pin1 of the PIC (supply).

    The LED (D1) and R1 are just for show and flicker in sympathy with the RX'D IR data, this is usefull for setting up, but may be left off if a quick and dirty "solder it to the chip" solution/installation is needed (or desired!), the same goes for C1, but a greater range will propbably be seen with this added!

    I think that's about it! Have fun!
     

    Attached Files:

    Last edited: Jul 20, 2006
  13. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    heheh - I thought I was losing the plot. There must have been some stealth code in there hiding from me :)

    Got the new one - looks a lot better. I'll give it a whirl tonight and let you know.

    Thanks
    Greg
     
  14. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    I can't seem to get this working. Two problems. I've programmed the PIC with the code. When I press the display button the LED flashed but I dont see the GP1 line drop.

    The second problem - more importantly....the code seems to have killed my PIC. :(

    I'm using wisp628 to reflash the chip. I've used it on 12f675 and 16fxxx pics and flashed/erased/reprogrammed 1000's of times.

    I used it to program the 12f675 and wanted to reflash it. The program now reports "target device not identified. device code FFFF, probably connection or power failure)

    I thought it might be that I shorted something out and killed the PIC so I tried another one. Flashed it with the code fine, then tried to erase and reflash. Same error.

    Does anyone know why the code kills the pic? :(
     
  15. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,231
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    If it's enabling the internal oscillator your programmer might be too slow to switch to programing mode? - if the oscillator manages to start running you're then blocked from accessing programming mode. It's essential to have a programmer that switches Vdd, otherwise you're really stuffed after you've programmed it once!.
     
  16. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Nigel - what do you mean by switches Vdd. I've looked at the current programmer and when connected to the PIC, Vdd is permanently connected to 5V. Might it be time to look at another programmer?
     
  17. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,231
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    If Vdd is permanently connected to 5V then you're severely limited, once you've enabled internal oscillator (and MCLR as I/O) you've no way of reprogramming the device anymore.
     
  18. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    That could well explain my problem. Just when I thought I was getting somewhere with pics :) So the device is not trashed though. It can be reprogrammed with another programmer? Can you suggest a good one to build? :)
     
  19. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    Can't seem to edit my post. Just looked on your site. I'll try out the P16PRO40 :)
     
  20. Matt(Pic progger)

    Matt(Pic progger) Member

    Joined:
    Apr 29, 2004
    Messages:
    147
    Likes:
    0
    Location:
    UK
    Ok, whilst on the subject of programmers....... beware using the 12F675/629 with the microchip picstart, it sometimes erases the calibration value stored at 3fff :(

    Make sure that you record the calibration value, and write it on the bottom of the chip, if Picstart does trash the calibration value, it's a bit of a pain to re-program as Mchip in thier wisdom won't let you re-program it!!

    You have to select the chip as a different part (with double the memory) I used a 12f683 if I remeber correctly, edit location 3fff to 34xx were xx is your calibration value, now program your 12675/629 as a 12f683, errors will be reported, but the calibration value should now be back........takes me back to the windowed 508/9 parts ;)

    So to re-cap, if you program a 12f675 or 629 on a Picstart and it does weird things, like not start properly etc, it's likey that Picstart has erased your calibration value :( Oh, and don't listen to Mchip telling you that it can't happen, it does, and not just on my Picstart :(

    OK onto the code not working....... if the led is flickering when you point your remote at it, then the code is running (although it may have the above problem). Sooooo have you tried to pull GP1 low, with the chip removed? The X-box should start when you pull this line low, if it doesn't then you need to sort this first.

    AHHHH HAAAA! I see the problem! When David was developing this code he had the above lost calibration value problem, he simply did a "movlw H'aC'" command and commented out the "Call 0X3ff" (load the chips calibration value into W command).

    I have modified the ASM, re-compiled it, called it XBR_V11 (Xbox remote ver 1.1) and saved all the project files into the attached zip.

    It should all work ok now, sorry for the confusion!

    Please let me know how you get on!
     

    Attached Files:

  21. david_1

    david_1 New Member

    Joined:
    Jul 20, 2006
    Messages:
    8
    Likes:
    0
    looks like Matts got it sorted. I am out tomorow but I will sort out My (our) code tomorow night if Matt has not already done it :)

    hope I added 2 pics


    David
     

    Attached Files:

Share This Page