Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Translator needed: C++ I2c protocol to arduino on: June 30, 2010, 07:26:57 pm
Hi Charbot,

As you know I have my wireless Chuck working but it is a "Blue Ocean" one which is USB rechargeable and only lasts about 2 hrs.

I have transplanted all internals into the (bigger) shell of a defunct BlazePro wireless chuck and am running it off 3 AAA batteries. Ugly but it works.

I would like to change to a Nyko Kama as then can just use 2 AA batteries and get plenty of endurance plus they are cheap chucks to buy.

I have been working with someone on this. He has taken Ilans code and got it to work on an AVR microcontroller (non-arduino) programmed in C. Furthermore the same software will work with both a standard wired chuck AND a Nyko Kama wireless chuck - ideal therefore as a general purpose remote control system.

He kindly rewrote it for me to try with an Arduino. On my arduino it works fine with a wired chuck but not with the Nyko Kama. As you found, the dongle wont even light up no matter what you try.

Further investigation shows that both he and Ilan are both in US and use a DIFFERENT version of the wireless Nyko Kama to the one available in Europe.

The one they use is wider than a normal chuck, has coloured c/z buttons (red/blue) and the dongle is different: It just has one sync button which then also lights up blue.

Whenever I buy a Nyko Kama here, it looks very similar to the normal Nintendo chuck, and the dongle has both an on/off button and a blue sync button/light.

So, my problem is:
a) Does my Nyko not work because it is slightly different to those in the US that 2 people now DO have working (but not with an arduino board) or
b) Is my Nyko fine (even though it is a bit different) and an error has crept in when their C code was rewritten for the arduino.

My wiring to the arduino must be OK as the wired chuck works fine.

What I need from somewhere is a US Nyko Kama to try (i.e. the wide one with the coloured c/z buttons on it) then I will know that if it still doesn't work it must be a small coding issue. I cannot buy one anywhere in the EU, only from US on ebay with extreme postage charges for some reason.

The reason there are 2 Kama variants is Nintendo sued them and they in the end agreed to "change the shape so it looks less like a Nintendo chuck" maybe this only applies to the US market which is why these US ones are little bit different to the ones I can get hold of.

So, still working on this problem. Tantalisingly close to a solution. I need a US spec Kama!

Best wishes

2  Forum 2005-2010 (read only) / Interfacing / Re: Read wireless Wii Nunchuck with Arduino on: November 28, 2009, 06:31:12 pm
Mike, a quick update:

YESSS it works - at last. I can stop tearing my hair out.

I went back to your original software and noticed that at 3.3V it did not work at all but at 5V it just gave one line of data than locked up.

I read some datasheets and thought maybe I should run the board from a separate power supply instead of just via the USB port as the ideal supply to the board is a little higher, about 7V, so the onboard regulator can stabilise it down to about 5V.

When I did that I got about 4 to 10 lines of data before it locked up. Unreliable, but at least it was sort of working. Therefore the problem must be power related or due to some threshold signal voltage only intermittently being reached or noise corruption or something along those lines.

Did some more reading on I2C. The accepted wisdom with Arduino is that the I2C pins (analog in 4 and 5) do NOT require pull-up resistors as these are built in.
These if you use them are placed between SDA(pin 4) and +5V, and between SCK(pin 5) and +5V. Notwithstanding the above, some people do use them just in case.
Here is just one example:

They certainly seem to do no harm even if not strictly required. What had I got to lose?

I put a 1800 Ohm resistor between SDA and +5V and another one between SCK and +5V.

Guess what? Both versions of your software above work perfectly.

Also, both my wireless Nunchucks work:
The BlazePro is fiddly to initialise and can be a bit temperamental to get working, fine once it is working though. It also runs on AAA batteries.

The other one (with no name) that I bought from a UK supplier is a more recent type. It has an internal battery that charges up via a USB charger. There is an initialisation procedure you carry out the first time you use it. Every time you use it after that you just turn on the receiver (i.e. in this case the Arduino board it is connected to) and press the z button on the wireless chuck - it will instantly connect with no fuss.

I have put a photo of both of them at bottom of this page on my skateboard site:

So in summary:

Either version of this software will work OK with latest Arduinos with the ATmega328 processor and I used Arduino 17 to compile.

Now the pull-up resistors are in, it runs just fine when just powered from the USB cable.

Moral of the tale: This is one situation where external pull-up resistors ARE needed.

I am now converting the wired-nunchuck controlled skateboard to wireless - going to be up very late methinks.

Thanks everyone.

3  Forum 2005-2010 (read only) / Interfacing / Re: Read wireless Wii Nunchuck with Arduino on: November 27, 2009, 08:19:28 pm
Hi Mike,

Compiles fine, loads onto Arduino OK. Still will not read the wireless chuck though!

If I go back to earlier software and wired chuck that works OK so electrical connections and board probably are OK. Have tried 5V and 3.3V. Have changed the I2C wires around just in case they were back to front (they weren't).

I am going to stop now until my Arduino168 arrives and my chuck extender cable then I will have good connections and an exact replica of your hardware setup.

I will let you know how I get on when I do next experiment.

Best wishes

4  Forum 2005-2010 (read only) / Interfacing / Re: Read wireless Wii Nunchuck with Arduino on: November 26, 2009, 06:32:17 pm
Hi Mike,

Thanks again.

I have nothing else attached to the board.

I look forward to the new code with eager anticipation. I am sure many others would be interested in this also.

Meanwhile I have an Arduino with a 168 processor on the way - someone still sells them, and a chuck extension cable (plug one end, socket on the other) I can cut and solder to the board to totally eliminate any "connections" issues.

Best wishes

5  Forum 2005-2010 (read only) / Interfacing / Re: Read wireless Wii Nunchuck with Arduino on: November 26, 2009, 08:21:30 am
Dear Mike,

Thanks very much for trying to help me:

Slight progress, sort of....
The problem seems to be with:
void send_zero

Wherever I put this in the void_loop, it stops the program sending anything more to serial view window at that point.

In your original code on windmeadow, the first time send_zero ();  appeared was at the end of the void loop ()

Therefore after setup, the very first time the void loop runs no send_zero command is sent to nunchuck and you do get one row of good data as in your example. However everything then stops.

In your latest code example you have just sent, the send_zero (); has been moved to the beginning of the void loop() and when I run this it is actually worse, I get as far as "Finished Setup", then not even one row of data - it just stops.

If I move send_zero back to the end of the void loop and instead of making it send zero 3 times, I change it back to one time, I do then get a series of rows of data down the serial window, i.e. the void loop is now at least running without locking up.
The problem now though is that only the very first row of data means anything, the subsequent rows are all rubbish data  (0, 255 or 1023).

During all these variations the Nunchuck connects quite easily.
My other wireless nunchuck performs exactly the same way incidentally.

The only thing left I can change so my setup is exactly as you have is to not use an Arduino with ATmega328 but use one with an ATmega168 processor as your Arduino BT has a 168 processor. At least it is good to know that it works with you with Arduino 17.

In summary:

A) send_zero() at start of the void loop:
Ident      0      A4      20      0      0
Finished setup

STOPS at this point

B) send_zero (X3) at end of void loop:
Ident      0      A4      20      0      0
Finished setup
avail=0      cnt=6
128      127      707      515      568      1      1

STOPS at this point

C) send_zero (sent just once, not 3 times) at end of void loop:
Ident      0      A4      20      0      0
Finished setup
avail=0      cnt=6
128      127      707      515      568      1      1
After first line of good data it then continues as...
avail=0      cnt=6
255      255      1023      1023      1023      1      1
avail=0      cnt=6
255      255      1023      1023      1023      1      1
And so on, at least it keeps going.

The only other person with code that works with a wireless chuck (based on your post) is B Giessler and his code is here:

This is to control his R2D2 robot however. He seems to have written his own libraries as well for many other functions of the robot, so to be honest I find his code and all the libraries it needs to work even more confusing. It might just contain some clues however that a better programmer than I might just understand.

Is there any way some of the setup routine could go into the void loop so in effect the connection is repeatedly reset to get the initial one line of "good" data each time the void loop cycles? This would avoid "send zero" altogether - unpleasant but maybe that might work?

Thanks for your help so far,

6  Forum 2005-2010 (read only) / Interfacing / Read wireless Wii Nunchuck with Arduino on: November 24, 2009, 02:37:06 pm
I am trying to use an Arduino to read a wireless Wii Nunchuck.

I have already used the code at the top of this page....
(As this is my first post I am not allowed embed links so Google “read wireless nunchuck into arduino” and it is the first hit)

..... to read a WIRED Nunchuck, which I am using as a hand-controller for my self-balancing skateboard.
(again, Google “one wheeled self balancing skateboard project” and I am the second hit)

Clearly it would be excellent if I could make this wireless.
Some have used a pair of Arduinos with Xbee transmitters to create the wireless link. This seems clumsy when there is at least one person out there who has interfaced the receiver of a wireless Nunchuck to the Arduino directly.

I have been using the code version of Michael Dreher (see his code halfway down the first webpage I mentioned above) with a wireless Nunchuck and Arduino17 with ATMega328 based board. He seems to be only person on net who has made this work.

When I power up the board I get one set of good readings and then everything stops. If I move the chuck and reset the Arduino board I get another set of different and believable data then it stops again after one line of data.

This is very frustrating as obviously this is very nearly working. I know others have described this problem, has anyone ever figured out how to fix it?

I have even bought a Blazepro wireless Nunchuck from Hong Kong as this was the exact model Michael Dreher got to work (there are several manufacturers – none are made by Nintendo). This has exactly the same problem, one data set in serial view window then it stops. Incidentally it works like this whether you set TWI speed to 100K, 200K or the recommended 400K. I note that MD was using an older Arduino board and older version of software.

Can anyone help?
I would have thought a cheap stylish ergonomic short range wireless hand controller like this would be so great for many Arduino projects apart from mine.

7  Forum 2005-2010 (read only) / Exhibition / Self balancing vehicle lowcost Arduino based on: March 23, 2010, 02:30:15 pm
Hi everyone,

I have been building self balancing vehicles for a couple of years now. These are like a Segway but designed to be ridden like a skateboard.
These had AVR based robot microcontroller boards until recently when I taught myself the basics of Arduino. This would have saved me a lot of time if I had done it earlier.
I took a board to a maker faire in the UK recently and was inundated with interest.
As a result I have designed a self balancing platform powerful enough to carry weight of a human that could be used as the basis of a Segway project a skateboard project or maybe a robot.
I have ruthlessly cut the cost to the minimum needed to make it work, and, it is now Arduino based!
Build instructions here:

People are asking me for the code so I have put it here:

Be warned, such a device if it suddenly stops can throw you off. I cannot be responsible for any inuries. On the other hand if you keep the speed below about 10mph you can jump off at a run and be fine.

Best wishes
8  Forum 2005-2010 (read only) / Exhibition / Wireless Wii controlled self balancing skateboard on: February 04, 2010, 07:09:17 pm
This is a self balancing skateboard that self balances using an AVR microcontroller and an accelerometer / gyro combination.

After starting a discussion on the forum concerning how to hack a wireless wii nunchuck using an Arduino I am now using this hack to steer the board and also to fine tune the balance point.
It is steered by either moving the joystick left or right or by tilting the chuck left or right.


Pages: [1]