I have written arduino code to calculate the platform angle and it works perfectly!
This is a graph made in Processing which is taking the angle calculated by the arduino from the serial port. I am oscillating the board quickly.
I am using the complementary filter approach documented by alot of balancing robots. The actual code is something like:
val = ((((analogRead(xPin)-xZero)/148.48)* 180/3.1415926535897932384626433832795))*-1); //accelerometer angle calculation
valG = valG + ((analogRead(gyroPin) - gZero)*4.8099347014925373134328358208962)/200; //integration of gyro and gyro angle calculation
angle = (val * 0.005) + (valG * 0.995); //complementary filter
valG = angle; //drift correction of gyro integration
I can tell it works as intended, because if i rotate the board flat on the table, the gyro senses it, whilst the accelerometer is still flat, so you see it increase and then decay slowly back to zero, rather like a capacitor discharge curve. This shows the accelerometer correcting the gyro's 'drift'.
looks good mark! integrate gps and some sort of autonavigation intelligence so it can drive you home from the pub by itself!
ReplyDeletecan you comment on the specific floats you used in your Val and ValG calculations? what is the dt used in the integration. thanks for the clarification!
ReplyDeleteWhat sensors are you using? Can you post your pde?
ReplyDeletelook at this, for similar code and sensor
ReplyDeletehttp://forums.adafruit.com/viewtopic.php?f=25&t=12352
Nice looking project. I was wondering if you had an idea of the overall cost and the expected speed when its done?
ReplyDeletepanikos
Thanking you for sharing the suberp project,
ReplyDeleteI wonder you could post the arduino and processing code to calculate the platform angle. It looks like that you used the processing to graph the output.
Regards,
Ozhan
Excellent project.
ReplyDeleteWhy do you multiply by 4.8099347014925373134328358208962 and divide by 200?
Where does 4.809 and 200 come from?
Thank you,
Joaquin
Excellent
ReplyDeletebut what are 4.8099... and 200 for the gyro and 148.48 for the acc?
Where does the acceleorometer fit into your code , please help ..
ReplyDeleteLot of money invested
hi,
ReplyDeletehow you have connected the XV3500CB?
have you a wiring diagram?
Do you have the eletric circuit draw?....and the components positions too?...
ReplyDeletegreat thanks for share
ReplyDeleteI thing kalman filer is good for segway
I would like to say thanks for sharing this valuable information.
ReplyDelete2 Wheel Self Balancing Scooter
ReplyDeleteNice looking project. I was wondering if you had an idea of the overall cost and the expected speed when its done?
thanks for sharing information i like your blog i read it but im searching for a Toronto Limousine
ReplyDeleteif you any infornation contact us thanks
Keep sharing more informative posts like this... Segways For Sale UK
ReplyDelete