Two Nunchucks and one Arduino ?

hi !
I succesfully managed to hack a nunchuck,
but now I'd like TWO on the same arduino.

is that possible ?
if I use 2 nunchuck on the same I2C bus, since they have the same adress it won't work..
so is it possible to implement a second I2C bus on the arduino ?

thanks

Olivar

You could switch between them...let's see, 2 nunchucks, 1 Arduino. You could use something called a multiplexer (the logic symbol looks like a cup on its side) to dump the communication from one nunchuck to the Arduino, then let the Arduino slowly process the data, switch to the second nunchuck and allow the data from it to flow into the Arduino for more processing. Swap back and forth between the nunchucks receiving data dumps as necessary.

since the nunchuck communicates using i2c (i believe it does) then it should just be a matter of using the Wiring library and hooking the arduino to both at the same time, which you can do since i2c is a multiplexing scheme (that allows 1128 devices per bus)

hi !
if I use 2 nunchuck on the same I2C bus, since they have the same adress it won't work..
so is it possible to implement a second I2C bus on the arduino ?

Implementing a second the I2C-Bus in software should be possible, but a lot of work.
What about using 2 ATMegas168, one for each nunchuck over I2C and let them talk using the SoftwareSerial-Lib which already exists? (I guess you would want to buy/build a programmer for the ATmegas, since buying 2 Arduinos for this project will make it too expensive?)

BTW:
Does it have to be the NunChuck-Hardware? If you only need the accelerator-values it might be even cheaper to buy 2 of these and use the analog-pins for reading the data.
Eberhard

Hi,

since the nunchuck communicates using i2c (i believe it does) then it should just be a matter of using the Wiring library and hooking the arduino to both at the same time, which you can do since i2c is a multiplexing scheme (that allows 1128 devices per bus)

No, sorry does not work that way!
Every device on the bus (Wire supports 127 of them + the GeneralCall address) needs its own dedicated Address.

The NunChuck has a fixed address which cannot be changed, so the Wire-Lib would talk to both of them at the same time, and they both would answer at the same time, wrecking the data and the timing on the bus.
Eberhard

Stupid question maybe, but can't you make a device which will act as a frontend for each nunchuk, relaying I2C data in both ways, but just providing a different address ? You can use very basic microcontrollers for this.

It's basically the same idea as using two Arduinos, but I think it may be "cleaner", and it will make them easier to reuse in other projects.

maybe an I2C multiplexer would solve it. I think you can poll the nunchucks iteratively.

being a total noob here though... just ordered my first arduino.

maybe an I2C multiplexer would solve it.

It is much simpler than this. Simply wire the I2C clock signal to both devices. Then wire the data line to a 4066 analogue switch and arrange the control lines to switch the data line to one or the other numchuck. This is a technique that is used all the time at my works. Don't forget to include a pull up on each device.

yes that will be the one !

I just saw some thing like this on an app note on MAXIM website.

thank you very much

I'll keep you informed when I finished the two arduino project.