void A2Ddata(unsigned int n) { long tempG = 0, tempX = 0, tempY = 0, tempZ = 0;
for(unsigned int k = 1; k <= n; k++){ tempG += analogRead(gPin); } gRaw = tempG*10/n; ???? }
???? what the value you get ? is it radians/sec or deg/sec ? is tempG given you as raw value of the sensor ? especially i didnt understand the temG*10/n ? what this calc. do?
Uhm... A2Ddata(n) simply averages n readings from the A2D converter. If you take the average of many readings from a noisy sensor, the average will have more resolution than the A2D converter readings, so by using temG*10/n I keep some of the increased resolution. So A2Ddata( takes the average of 8 readings. These are just raw A2D readings.
Code:
rate = (gRaw*Vin/100-gOffset)*0.0150;
gRaw is the raw gyro value*10, Vin/100 is the A2D full scale voltage (322/100) or 3.22V. This voltage is feed to the VRef pin of arduino. gOffset is the voltage from the gyro when it's stationary*10, and 0.0150 finally converts everything into degree/s. I'm assuming my gyro has a response of 150dgr/s/V output, it's pretty close to that.
I didn't really write the code for interfacing with FSX. I took a SimConnect SDK example in Delphi, and modify it to take serial data, that's about it... If that's what you want to look at, I'll post it here...
Here's the code, will need to be modified to suit you own setup. Also, if anyone wants it, I've got a program that interfaces with FSX camera control and serial port, all you need to do is send a comma separated string of pitch, roll yaw and so on. Should make it easy for anyone wanting to control FSX camera from arduino.
I posted it at RC Groups, but a couple of people have asked me for the code, which I thought would be more appropriate to post here. (For more detail, check this thread: http://www.rcgroups.com/forums/showthread.php?t=964184)
But I thought people here might be interested in it, especially the code.
It's a 3 degree of freedom (pitch, roll, yaw) head tracker built from:
A cheap RC heli gyro for ~$15
A cheap 3 axis accelerometer board for ~$16
RBBB for ~$12
The final goal is to fly my FPV plane through VR goggles, but I'm currently testing it with Microsoft FSX, here's a video:
With respect to the PPM noise, maybe you can try to add a limit for a maximum amount an axis can change between PPM frames. Since it is unlikely for any axis to change say >25% in 20ms (unless you have super fast commands).
Real industrial articulated robots use a counter weight or spring on the arm axis to balance the weigh of the arm and end effector, this reduces the load on the motor. Maybe you can try something like that?
I'm using arduino to display low battery voltage warning and ground proximity (with a ultrasonic sensor) in flight. Here's a video: http://www.veoh.com/videos/v8567662mGXeNbNN
OK, pretty simple stuff, I happened to have this video around. I send servo positions (as strings not bytes) from the PC program to the arduino, which runs a PMW to drive the motor controller. I wrote the program originally to test servos. I'm thinking about adding a RPM sensor and eventually measure battery voltage and current and all that, eventually...
Since it's pretty simple to do, and has probably been done hundreds of times before, I'm not going to explain too much here, unless anyone is interested.
Thanks for your help! I tried both commenting out wiring.c and cli(), made no difference. I tried your first code in this thread, commented out the code in wiring.c, and I get a fairly clear image but with noise bands rolling over. Maybe we have different PAL standards? I'm guessing my TV tuner was trying to automatically detect what the input format is, and the improper formating of the signal is making it choose the wrong format. Because if I try to watch TV after I'm done messing with it, I have to reset the signal to PAL-GB, otherwise the picture would be messed up. I'll see if I can test it on someone else's TV.
I'm about to give up, maybe get a dedicated chip or board for this. I love how the German guy's high res test picture says: "Hello World, I'm super good, and test image generator is easy"