does anyone knows how to connect 2 nunchuck controllers to one Arduino?
i was thinking the same thing... i'd try using todbot's library
A Wii Nunchuck is an i2c device, and all Wii Nunchucks leave the factory with the same i2c address. You'd need two separate i2c buses from different Arduino pins to talk to two devices with the same i2c address.
The Arduino only has hardware i2c helper support on Analog Pins 4 and 5. Unless you start to bit-bang things yourself, you're limited to one Wii Nunchuck.
The same goes for the Wii Classic Controller, and I think they're the same address, so you can't even have one of each.
makes sense, but does todbot's blinkms come with a unique i2c id? He was running a whole bunch of them on the same network
(Quick answer after hasty website research. No warranties expressed or implied.)
The first thing you do when you want to integrate a BlinkM into a system of them, is to assign it a new address. You run a separate sketch that commands ALL attached devices, and the BlinkM hears this command and learns a new address. You do this one at a time (unless you want two with the same behavior). Then you have a BlinkM with the address you assigned, and your real project sketch must use that address.
It's kinda like bluetooth "pairing" except the pairing program is usually a whole different sketch, and you have to choose the addresses yourself.
A Wii Nunchuck may or may not be reassignable in that way. To my knowledge, nobody has discovered any address-reassignment commands that are recognized by the Nunchuck.
come halp here plz =P
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231650517/0#5
Does anybody know where to get that nunchuck adapter that is used in the picture in post #3?
That's the "thing M" wiichuck adapter. Google will find it, but I got mine at fungizmos.com for four bucks each. It's handy to have the ready-made PCB, but some folks have made the same thing with some tinfoil and cardboard and a little bit of patience.
Thanks for getting me in the right direction with the little adapter!
The remove button still worked after about half an hour!
Hello halley, I don´t know why I haven´t been notified of your replies!
Thanks a lot for the explanation..
I would love to have 2 nunchucks connected to the same arduino, it would be a very nice remote controller. Must find another solution.. :]
The simplest way of getting two I2C devices with the same address working on the same bus line is to switch them. That is put an analogue multiplexer (or switch) in the data line so you switch which device gets the data. It needs to be an analogue switch to cope with the bi-direction nature of the data. I have used this technique many times.
The clocks can be wired common to both devices. Don't forget the external pull ups, the signals look a mess without them. And put the data one on the Arduino side of the multiplexer.
that seems a good way to go!
but I am a bit noob with I2C and with multiplexing and ...
thanks anyway
I would like to learn more about this.
Could you post some kind of picture/schematic/photo or code snippet?
Or point some documentation/tutorial?
It's quite simple:-
This switches both the clock and data, you might like to have a 4K7 pull up on the other side as well. There is no need to switch the enable line of the multiplexer from the arduino, but you will need to switch one or more of the select lines. With this you can use up to 4 devices with the same address on the same bus.
seems simple, I will do some research
I just got 2 nunchucks to operate with the arduino on the I2C bus. All you need is 2 transistors (basic npn switch transistors), and 2 resistors and the use of 2 more arduino pins.
For the 2 nunchucks, I tied the 2 ground (white) wires, tied the 2 clock (yellow) wires, and tied the 2 power (red) wires. You have to make 2 switches (thus 2 transistors) each of which will disconnect the nunchuck's data (green) wire from the arduino.
Programming Note:
when you start up the 'system' , you'll need to have both nunchuck's data (green) wire connected to the arduino in order to initiate both at the same time. Then you can swap between each nunchuck.
Link on transistor switches:
http://www.kpsec.freeuk.com/trancirc.htm
At first I tried using 1 npn and 1 pnp transistor, but I couldn't get the nunchuck to push its data through a pnp transitor...I'm not so sure why yet...but this would require the use of only 1 extra arduino pin, instead of 2...
let me know if you need help
bd
johnnyonthespot, that sounds really straightforward, but can you draw a schematic?
Since you're using the same kind of switch arrangement on each data line, it sounds like this could be extended to any number, using something like a multiplexer for 2*n* Arduino pins selecting n i2c data lines. Some of the I/O extenders come to mind.
Or even weirder, an i2c I/O extender like the PCF8574. Kinda kinky, making one i2c bus client rearrange the bus itself. That probably won't work due to the i2c library bit-banging that goes on.
I am curious as well to know how data flows both ways through a transistor.
johnnyonthespot! I would love to see how you do it.. if possible post a schematic and code please..
Here you go :0)
(just made this in ms paint)
The way the transistor works: BJT (lamen terms)
a bjt has 3 pins (collector, base, emmitter) for the NPN case, when there is sufficient Voltage applied at the base (the center), a channel ("short") is created between the emmitter and the collector
As long as you use the middle pin of the transistor as the "control" pin, and the other two as the "switch" connection, it will work. But do NOT hook up a transistor's base without the resistor. This will burn it out for sure.
I used 220 OHM resistors between the base and the control pin on the arduino.
Hope this helps