Posted by c2po |
May 21, 2011 @ 02:22 PM | 7,693 Views
I've got quite a few cheap Nunchuk clones from Ebay, all of them are different, and pretty much all of them work fine, but...
One of the clones had a nice Bosch BMA140 analog accelerometer instead of a usual ADXL335, and looking at the raw data using special Arduino test sketch I like it much better than others.
So after I made MultiWii work directly with ITG3205 gyro from Motion+ I decided to add standalone Nunchuk as accelerometer. As I know this one works fine, so I was kind of surprised when I saw no data in MultiWii GUI after I connected it to the board. I looked at the code, verified connections, tried few options, changed I2C speed back and forth between 100 and 400kHz, even did a voodoo dance and casted some spells - nothing, nada, zip.
Puzzled with that I put in debugging print statement - well, all six bytes of data read as 0xA5, which is actually the Nunchuk read address sent in the previous statement.
Hmm... I know it works, OK? I'm sure the problem is not in the connections or the hardware. This Nunchuk works in test sketch just fine at 400kHz I2C speed.
I started looking at the I2C read and write procedures, and there was something in them that made me suspicious...
Posted by c2po |
May 10, 2011 @ 03:22 PM | 7,032 Views
I thought that blue Wii Motion+ board with ITG3205 gyro on it is too big for me so decided to cut off unneeded parts.
And also mated it with the Sparkfun BMA180 accelerometer breakout board.
Works good and it's really tiny...
Posted by c2po |
May 10, 2011 @ 03:10 PM | 6,718 Views
Finally I was able to tune MultiWiiCopter controller on the Gaui 300X frame more or less to my likings, I will share with my setup so someone might find that helpful.
Everything is stock GAUI 330X (not S version) except the controller.
Frame 330X with motor to motor size ~ 33cm (13in), weight is 400g without the battery, motors and ESC are from Gaui 330X kit, I guess Kv is around 1100, ESCs are probably 6 Amps.
Battery is Turnigy 2S 2200mAh,weight 122g, usually I put ~1200mAh after 10 min flight.
Radio is old 72MHz Futaba 7C, receiver is Berg 4L, hacked into it to get PPM output, using PPM is much simplier in the code and on the wiring.
Controller is based on the Really Bare Bones Board and mounted on a self made board used to connect all the parts together. Nunchuk is there underneath the gyro, but is not used at the moment, so with the I2C speed 400kHz I'm getting cycle time about 1750us. As a gyro I used ITG3205 from a cheap Motion+ clone bought on Ebay, gyro chip is connected to Arduino I2C pins directly, AVR built-in pull-ups are disabled.
I made a lot of changes to the code, mainly removing parts that I don't need, but the change which is relevant to using ITG3205 gyro is that I divide gyro output values by 8, originally it is divided by 20 (/4/5), lines 770-772 in MultiWiiV1_7.pde.
Parameters for PID and other stuff can be seen on the screenshot. They are for 2S setup, you have to reduce PID values for 3S battery.
I guess picture should be pretty much self explanatory.
Just connect four wires to whatever places you prefer, I think golden pads on the back side are the most convenient place for I2C wires (SCL to X2, and SDA to X3), and pins 1 for +3.3V and 6-7 for GND. You can also connect INT to X4 if you intend to use interrupts.
I2C adress of ITG3205 is set to 0x68 (AD0 PIN connected to GND).
All you need to do to isolate ITG3205 from the other chip is to take proper tools and desolder and lift three legs (2, 3, and 4, which are connected accordingly to SCL, SDA, and INT), or just brutally cut or tear out those three legs if you never plan to use WM+ as it was intended.
Don't forget to power the board from +3.3V, and not 5V, otherwise you might get very strange readings.
I connected the SCL and SDA directly to Arduino I2C pins and just disabled AVR built-in pull-ups, no level converter needed, gyro works just fine.
UPDATE (08/25/2011): Since my brief description in the post seems to be confusing sometimes, I'll try to summarize all the needed changes here: