Sunteți pe pagina 1din 6

Xbox 360 RF module + Arduino [dil isi lib]

Page 1 of 6

[DIL ISI LIB]


DIL'S SOMEWHAT POINTLESS BLOG
Subscribe via RSS
HOME

Sub

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

Xbox 360 RF module + Arduino [dil isi lib]

Page 2 of 6

Xbox 360 RF module + Arduino


I was going to make a huge write-up on this, but I can't be bothered right now. I'll probably do something about it later. Until then, have an Arduino sketch. If you don't know what you're doing with it then chances are you don't have an Arduino, in which case the file is useless to you. The sketch:

Site About dil Charity Hacking Xbox 360 RF module + Arduino

Parody /* Arduino code to communicate with xbox 360 RF module. Original work by (yaywoop) / additional ideas from Alexander Martinez A collection of unused modified by dilandou (www.dilandou.com, www.diru.org/wordpress) First sends LED initialisation code followed by LED startup animation code, then sleeps unooses! RF module must be powered with 3.3V, two diodes in series with USB 5v will do. Connect thLook! A big fat fairy! of course, make sure to have a common ground */ Magic profile views tracker chest!! #include <avr/sleep.h> #define sync_pin 2 //power button repurposed for sync button (pin 5 on the module) #define data_pin 3 //data line (pin 6 on the module) #define clock_pin 4 //clock line (pin 7 on module) int led_cmd[10] = {0,0,1,0,0,0,0,1,0,0}; //Activates/initialises the LEDs, leaving the center LED lit. int anim_cmd[10] = {0,0,1,0,0,0,0,1,0,1}; //Makes the startup animation on the ring of light. int sync_cmd[10] = {0,0,0,0,0,0,0,1,0,0}; //Initiates the sync process. volatile boolean sync_enable = 0; void sendData(int cmd_do[]) { pinMode(data_pin, OUTPUT); digitalWrite(data_pin, LOW); int prev = 1; for(int i = 0; i < 10; i++){ Play Pissass-AnnoyingFarmvizombimafipirate wars! Vegetable patch needs watering!

Archives December 2011 May 2011

//start sending data. April 2011 March 2011

while (prev == digitalRead(clock_pin)){} //detects change in clock prev = digitalRead(clock_pin); // should be after downward edge of clock, so send bit of data now digitalWrite(data_pin, cmd_do[i]); while (prev == digitalRead(clock_pin)){} //detects upward edge of clock prev = digitalRead(clock_pin); } digitalWrite(data_pin, HIGH); pinMode(data_pin, INPUT); }

February 2011 January 2011 December 2010 November 2010 October 2010 September 2010

void initLEDs(){ sendData(led_cmd); delay(50); sendData(anim_cmd); delay(50); } void wakeUp(){ sync_enable = 1; } void sleepNow() { set_sleep_mode(SLEEP_MODE_PWR_DOWN); // set sleep mode sleep_enable(); //enable sleep bit attachInterrupt(0, wakeUp, LOW); sleep_mode(); sleep_disable(); //disable sleep bit detachInterrupt(0); // disables interrupt 0 on pin 2 } void setup() { Serial.begin(9600); pinMode(sync_pin, INPUT); digitalWrite(sync_pin,HIGH); pinMode(data_pin, INPUT); pinMode(clock_pin, INPUT); delay(2000); initLEDs(); sendData(sync_cmd);

December 2009

Categories 3d Charity Electronics Learning Life Productivity Rants Social Travel

Meta Log in Entries RSS Comments RSS WordPress.org

// }

void loop(){ Serial.println("Sleeping."); sleepNow(); delay(200); if(sync_enable==1) {

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

Xbox 360 RF module + Arduino [dil isi lib]

Page 3 of 6

Serial.println("Syncing."); sendData(sync_cmd); sync_enable = 0; } }

Comments (16)

Trackbacks (0)

( subscribe to comments on this post )

iScypek
August 3rd, 2011 - 14:07

I have ATMEGA8 uC, could you send me hex file for arduino with this uC? I triet to compile it on arduino, but i have only project file and i dont know the path of hex files.
( REPLY )

dilandou
August 3rd, 2011 - 19:47

In the Arduino IDE, hold Shift while clicking the Upload button. This triggers verbose mode, and will show where the hex file is temporarily held. The hex files are deleted as soon as you close the IDE.
( REPLY )

Goddard
August 5th, 2011 - 09:47

cool.. appreciate the work you have put in.


( REPLY )

Adil
October 30th, 2011 - 18:02

wer do we type these??????


( REPLY )

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

Xbox 360 RF module + Arduino [dil isi lib]

Page 4 of 6

dilandou
October 30th, 2011 - 18:25 ( REPLY )

This is code for the Arduino. Its pasted into the Arduino IDE.

Michael Rogers
December 29th, 2011 - 14:26

This controls the sync process and state of the leds. Am I correct in assuming that the state of the controller buttons are not accessible to the arduino, but over usb only?
( REPLY )

dilandou
December 29th, 2011 - 17:09

To be honest, I havent dug that far into it. I was planning on a little experimentation, but never got around to it. What I do know is that when you send certain commands to the RF unit, it will send data back over the same line. I think, however, its mostly things like I have X controllers connected or This controller is controller X etc. Useful for fine tuning the lights, if you wanted to be more fancy, but not much else.
( REPLY )

Timinator01
January 16th, 2012 - 21:01

my controller wont sync the module does the sync light animation and so does the controller but they wont do it at the same time. when both are syncing it automatically starts all leds flashing and then the module stops and the controller just keeps flashing instead of a player # light turning on like with a real xbox. any ideas on how to fix this? the xbox rf module is x802779-010 rev:A-1-1 and the controllers are x809478-001 and x817145-006 (i think these are the model numbers)
( REPLY )

dilandou
January 16th, 2012 - 21:32

Sounds like a bit of a dumb question, and I apologise for asking it, but when you say the sync animation, you mean after youve pressed the center button and not the animation when its first powered on, correct? Also, the module itself wont have an LED lit to show it has a controller connected. Unfortunately it would require figuring out the data sequence it replies with to say what number controller is connected, then telling it to light whichever LED. Extra effort for an entirely cosmetic feature. :P It would seem that theres a rev B hardware now with different pinouts. Its easily identified with the RF02 moniker. The main differences seem to be DATA on pin 7, and CLK on pin 9 (at 130hz).
( REPLY )

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

Xbox 360 RF module + Arduino [dil isi lib]

Page 5 of 6

phrost
January 20th, 2012 - 16:07 ( REPLY )

Is it possible to use this to control servos without needing a pc to send the data over serial?

dilandou
January 20th, 2012 - 16:41

There are people asking a similar thing here: http://forums.xboxexperts.com/viewtopic.php?t=4029&p=26982 Personally Ive not gone that deep into it as Im not confident enough to start reverse engineering protocols. From the seems of it, though, the general idea is that you could either set a uC up as a USB host and decode whatever data is sent over USB, or directly hook into the logic going between the RF chip and the USB chip and use the raw data from there. If you have a logic analyser or oscilloscope give it a try. Id be curious to know the results myself.
( REPLY )

Chris
January 27th, 2012 - 18:56

Hi there, I was wondering if I could get a quick schematic that corresponds with the code posted here. I have only worked with Motorola chips and assembly in the past and dont have much experience with the arduino, its libraries, and much c. Ive gone ahead and made sense of the code (save a few lines) and I would like to confirm a few speculations based on the arduinos pinout and a schematic. Sorry for the trouble.
( REPLY )

dilandou
January 27th, 2012 - 22:49

Ive added a schematic to the bottom of the post. Its pretty simple so far as things go. If youre paranoid about the logic being above the 3.3V supply for the board, you can either ignore it, or stick some voltage dividers in there, but considering the logic only happens for -very- short times, its mostly unnecessary. If you wanted a more permanent and less wire hogging solution, you could always power the Arduino from the usb supply powering the RF module. Essentially the only need for the Arduino to have a USB connection is for the serial debugging (which you can safely remove from the code). Personally Ive moved the whole thing over to an ATTINY45 soldered directly onto the board. Using an Arduino permanently is a wee bit overkill, afterall.
( REPLY )

Brawrf
February 3rd, 2012 - 17:35

I miss data on how the Arduino is powered here. Id also like to know the current draw of the module, because it might be possible to pair everything up in a nice looking setup.
( REPLY )

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

Xbox 360 RF module + Arduino [dil isi lib]

Page 6 of 6

dilandou
February 3rd, 2012 - 17:39

Two choices for power, really. Either plug the arduino in separately when its needed for syncing, or tie it in to the USB cable before the diodes. As for current draw, device manager is reporting 260mA. Im not going to argue with it.
( REPLY )

Robin Chan
February 4th, 2012 - 19:49

personally i dont think your going to be able to use it to be able to sniff buttons using only commands. I think its a pretty simple USB HID interface? Arduinos can host these. Im sure Ive even heard of some people bit banging HID hosts. try setting an arduino up in HID host mode and implementing a simple joypad sketch.
( REPLY )

Leave a comment
Name (required) Email (required) Website

Type the two words:

Submit

Copyright 2012 [dil isi lib] Powered by WordPress Lightword Theme by Andrei Luca

Go to top

http://diru.org/wordpress/hacking/xbox-360-rf-module-arduino/

2/6/2012

S-ar putea să vă placă și