Show Posts
Pages: 1 2 [3] 4
31  Community / Exhibition / Gallery / Re: XBox Controller: Embedded Arduino and RF/Wireless Mod on: October 29, 2012, 02:06:50 pm


I knew about the USB connection, and was initially looking at the possibility of using a USB host shield to read the data from the controller, but couldn't seem to find any examples or info on whether the Orig. Xbox controllers are supported. The general size of the shields and the extra cost involved were also a factor. 360 controllers seem to be supported, but I'm still unsure about these, so if somebody could clarify, please feel free.
32  Community / Exhibition / Gallery / XBox Controller: Embedded Arduino and RF/Wireless Mod on: October 28, 2012, 04:02:40 am
I have always enjoyed taking apart electronics to salvage components and see what makes em tick, and this is a little mod that let me dig into the guts of a relatively straight-forward device: an XBox controller. I have a bunch of old controllers around, along with some Arduino Nano boards, so decided to join another together with an RF module in order to control various devices wirelessly.  The controller basically consists of a bunch of potentiometers and buttons arranged in an easy-to-operate kind of way, so this build is fairly simple in theory. As such, the wiring is fairly straight forward, there are just a lot of wires to connect to make use all of the inputs. I chose an APC220 radio module due to its ease of use (UART/TTL), range (1Km), and the fact that it allows communication with computers and Arduino based devices. The settings (frequency, data rate, etc) can also be changed on the fly, so it is fairly versatile. Any Arduino compatible RF module could be used in its place. I believe this would work similarly with a 360 controller, but haven't taken one apart... yet.

Before:                 During:                 After:

Details and pictures at
33  Using Arduino / Project Guidance / Re: Direct WAV playback from SD: The Beginnings of a Library... on: October 22, 2012, 01:52:58 am
Been a while, but work on this library has slowed to a crawl since it works fairly well at this point. Thought it would be worth an update:


    PCM/WAV playback direct from SD card to attached speaker/amplifier

    Asynchronous Playback: Completely interrupt driven. Allows main loop to execute instructions while playback occurs.

    Playback uses a single timer (Timer 1)

    Supported formats: WAV files, 8-bit, 8 to 20khz Sample Rate (autodetection), mono

    Supported devices: Arduino Uno, Nano, Mega, etc.

    Files easily converted using iTunes or other software:

    iTunes Conversion:
    Click > Edit > Preferences > Import Settings
    Change the dropdown to WAV Encoder and Setting: Custom > 16.000kHz, 8-bit, Mono
    Right click any file in iTunes, and select "Create WAV Version"
    Copy file to SD card using computer

    Contains optional proof-of-concept add-on library for RF (Wireless) audio streaming using NRF24L01+ radio modules. See readme files for details.

The current version can be found here:

34  Using Arduino / Project Guidance / Re: Help, Advice required on: October 20, 2012, 11:51:00 pm
I would just go with the L298N if not sure of power requirements.

You might be able to go with ULN2003 depending but I can't say without knowing the specifics of the setup.
35  Using Arduino / Project Guidance / Re: Help, Advice required on: October 20, 2012, 04:18:43 pm
Yeah, same programming and connections for the Nano.

The main thing to look at is the chip. Uno and Nano can both use Atmega328 chips, so most things are completely interchangeable. Anything with a different chip will have some differences.
36  Using Arduino / Programming Questions / Re: Getting aiken biphase ( F2F ) signal into binary data on: October 20, 2012, 03:28:14 pm
Not sure of exactly what you are working with (data speeds, etc), but here is a good write up from Atmel that includes examples for decoding Manchester and Biphase signals:

37  Using Arduino / Project Guidance / Re: Arduino Wireless Use on: October 16, 2012, 07:30:08 pm
I have had good luck using NRF24L01+ radio modules. They are pretty fast and you can communicate with multiple devices (Max 7 devices)

I recently ordered a couple interesting devices that apparently allow over-the-air programming of Arduinos along with serial based wireless data transfer/communication, but have not received them yet. If they work as advertised, would probably work here also:
38  Using Arduino / Project Guidance / Re: Silly Project - NoOb needs advice on: October 16, 2012, 07:04:25 pm
 smiley-grin Nice.

Short answer: Yes, USB serial uses pins 1 and 2.

Why can it reprogram if messed up? I assume its because the Arduino is always reset before reprogramming, so it can pretty much always get access to reprogram on boot-up.

You could use the library to communicate using different pins.

Heh, lasers are ALWAYS a good idea.
I could see how motion sensing or tracking might be beneficial here too.
39  Using Arduino / Programming Questions / Re: Timer1 not firing on: September 17, 2012, 06:31:28 pm

You just need to set COM1A0 and COM1B0  (TCCR1A register) to toggle on compare match, instead of 'set on compare match' :


//  controlling pins A=pin9. B=pin10
 pinMode(10, OUTPUT);
 pinMode(9, OUTPUT);
   TCCR1A &= (unsigned char)~0b11110011; // zeros are reserved bits
//  TCCR1A |= 0b00;  // WGM1[1,0] = 0b00, with WGM1[3,2]=01 for CTC; WGM1[3]=0 i/p
  TCCR1A |= 0b01010000;  // COM1A[1,0]= TCCR1A[7.6]=10; COM1B[1,0]= TCCR1A[5,4]=10 ; clear on match
                         // COM1A[1,0]= 1 ; inv-output  // normal DIO

//  TCCR1B[7,6] : input capture only, noise filter , edge detection. [5] reserved
//                NB only on 16b counter cf force comp on 8b

  TCCR1B &= ~0b11111;
  TCCR1B |=  0b01101; // 01101: WGM2[3,2]=01 + "div 1024" -> 16kHz tick: OCR1A sets count ...
  OCR1A = 16; // set cycle length = 16kHz /16/2 = circa 1/2 kHz
     338:       80 e1           ldi     r24, 0x10       ; 16
     33a:       90 e0           ldi     r25, 0x00       ; 0
     33c:       90 93 89 00     sts     0x0089, r25
     340:       80 93 88 00     sts     0x0088, r24

  TIMSK1 = 0b001; // in CTC, TOV1 triggers at MAX, ie OCR1A match

or how I find it easiest:

  TCCR1A = _BV(COM1A0) | _BV(COM1B0);
  TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10);
  OCR1A = 16;
  TIMSK1 = _BV(TOIE1);
40  Using Arduino / Programming Questions / Re: Read duty cycle of a pwm pin on Arduino Mega... ?! on: September 12, 2012, 01:48:43 pm
I think it should be possible to get the information from the Arduino timer registers directly.

I'm not exactly sure about the details when using analog write, but if you generated your own PWM signal using timer1 for example, with ICR1 or OCRnA for duty cycle, you should be able to query the value of OCRnA or ICRn at any time to find the duty cycle.

My assumption is that analogwrite uses similar timing functions, so you should be able to grab the details from the Arduino registers. Of course, I could be completely wrong...
41  Using Arduino / Programming Questions / Re: Interrupt / Timer advice: Driving LED matrix while reading serial data on: August 23, 2012, 06:48:21 pm
I ran into a similar problem recently, and overcame it using 'nested interrupts'. I don't know if this would be the best method for you, but here it is..
Basically, every time an interrupt is triggered, global interrupts are disabled while it completes, so other interrupts cannot run.

The way I used around that, the main steps would be something like follows:

(I posted some info on my blog too:

a: COMPB interrupt triggered
b: Disable COMPB interrupt from within the COMPB interrupt vector
c: Enable 'Global Interrupts'
d: Let COMPB do its thing, OVF will interrupt it when it needs to read Serial data
e: Last step before COMPB completes is to re-enable itself

It would require two interrupts the way I see it, but the code might be something like this:


 TIMSK1 &= ~_BV(OCIE1B);  //Disable this interupt, otherwise seems like it will try to trigger again next cycle even if not complete
 sei();  //Now enable global interupts before this interrupt is finished
 // take as long as you like to do what you need here, this interrupt will keep trying to complete while other interrupts... interrupt it
 // while(x < yourMom){delay{10)}

  TIMSK1 = ( _BV(OCIE1B) | _BV(TOIE1) ); //Re-enable this interrupt


//check for serial data at a defined rate and have your way with it


Then you just have to work out the timing period and configuration on timer1 that works best with your code. You can also modify the duty cycle on your timer on the fly, which would affect the timing of COMPB and possibly OVF depending on configuration.

Edit to add:  I just remembered this partial implementation of Serial.bufferUntil() I found a while back:  and  this may be closer to what you are looking for

42  Using Arduino / Project Guidance / Re: Why don't Arduinos run on 5V on: August 23, 2012, 06:10:42 pm

I assume it is because the voltage regulation uses up a volt or so as mentioned above.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable.
43  Using Arduino / Project Guidance / Re: NRF24L01 can not be initialized on: August 19, 2012, 03:11:10 pm
Here is my pin configuration, it seems to differ slightly from what you posted initially, so thought it might be worth posting:

48 (CE), 49 (CSN), 50 (MISO), 51 (MOSI), 52 (SCK)

RF24 radio(48,49);


9 (CE), 10 (CSN), 11(MOSI), 12(MISO), 13(SCK)

RF24 radio(9,10);
44  Using Arduino / Project Guidance / Re: NRF24L01 receives Data from nowhere on: August 18, 2012, 01:58:59 pm
Your screenshot seems to indicate the device is not getting detected properly.
It should display the correct addressing on boot:     RX_ADDR_P0-1   = 0xf0f0f0f0d2 0xf0f0f0f0e1

I can recreate your issue by reversing the following line:

RF24 radio(49,48);

My best bet is that you just have a couple wires reversed.
45  Using Arduino / Project Guidance / Re: Problems with code for piezo buzzer & push button on: August 15, 2012, 01:35:37 pm
Something like the following may work for you:

int c = 1915;  //define note C as 1915Hz
int d = 1700;
int e = 1519;

int tune[] = {c,d,d,0,e,c,e,d}; //define the order of notes to play

for(int i = 0; i < sizeof(tune); i++){    // do as many times as the tune[] array is long
  tone(speakerPin, tune[i],200);          // use the Tone() function to make sounds for 200milliseconds
 delay(200);      // wait 200ms before next note

edit: sorry, threw that together on my lunch-hour and was interrupted. this actually compiles now...  
Pages: 1 2 [3] 4