Using MPU6050 SparkFun breakout to keep HS-45HB servo level
hello,
my name roman. i've joined arduino forum , seeking guidance on senior project have in nyit mechanical engineering student. rather new electrical engineering although have general knowledge , experience in it, programming seems im in on head short amount of time have left before semester ends. if has pointers , guidance on in regards project, please let me know.
i have seen done on youtube , on professional gp motorcycles. want "reproduce" camera mount tilt motorcycle leaning turn, making camera parallel horizon on 1 dof axis (pendulum-like, side-to-side motion).
i have been talking , forth sparkfun.com , have received advice on hardware need.
here list of things have purchased based on suggestions:
-mpu6050, http://www.sparkfun.com/products/11028
-arduino uno, http://www.sparkfun.com/products/11021
-arduino mini pro (5v), http://www.sparkfun.com/products/11113
-ftdi basic breakout (5v), http://www.sparkfun.com/products/9716
-hitec hs-45hb servo, http://www.hitecrcd.com/products/analog/micro-mini/hs-45hb.html
as can see intending make mount rather small. @ first have been fiddling uno, servo, , mpu only. not able connect mpu. had wiring setup correctly , able test servo adxl345 today great success twitchy. have received great jeff roweberg in regards mpu6050 code provides online and, after calling sparkfun, found out unfortunately mpu6050 have received seems faulty sending receive one.
since cannot test until new mpu, wanted know if can point me towards sources of adding servo mpu code can hw while mpu on way.
i played around servo , sweep example provided arduino software. have encountered problem range of motion servo; when returning 0 degrees, try , go past rotational limit. got same thing adxl345 connected (code: http://maxim.wf/arduino_code/adxl345_accelerometer.pde ). can solve when programming mpu code? called when servo tries that?
heres example found online , modified range of motion like/need servo 1590 being center experimenting it, don't know how works when servo centered:
if has advice appreciated.thank you!
roman
my name roman. i've joined arduino forum , seeking guidance on senior project have in nyit mechanical engineering student. rather new electrical engineering although have general knowledge , experience in it, programming seems im in on head short amount of time have left before semester ends. if has pointers , guidance on in regards project, please let me know.
i have seen done on youtube , on professional gp motorcycles. want "reproduce" camera mount tilt motorcycle leaning turn, making camera parallel horizon on 1 dof axis (pendulum-like, side-to-side motion).
i have been talking , forth sparkfun.com , have received advice on hardware need.
here list of things have purchased based on suggestions:
-mpu6050, http://www.sparkfun.com/products/11028
-arduino uno, http://www.sparkfun.com/products/11021
-arduino mini pro (5v), http://www.sparkfun.com/products/11113
-ftdi basic breakout (5v), http://www.sparkfun.com/products/9716
-hitec hs-45hb servo, http://www.hitecrcd.com/products/analog/micro-mini/hs-45hb.html
as can see intending make mount rather small. @ first have been fiddling uno, servo, , mpu only. not able connect mpu. had wiring setup correctly , able test servo adxl345 today great success twitchy. have received great jeff roweberg in regards mpu6050 code provides online and, after calling sparkfun, found out unfortunately mpu6050 have received seems faulty sending receive one.
since cannot test until new mpu, wanted know if can point me towards sources of adding servo mpu code can hw while mpu on way.
i played around servo , sweep example provided arduino software. have encountered problem range of motion servo; when returning 0 degrees, try , go past rotational limit. got same thing adxl345 connected (code: http://maxim.wf/arduino_code/adxl345_accelerometer.pde ). can solve when programming mpu code? called when servo tries that?
heres example found online , modified range of motion like/need servo 1590 being center experimenting it, don't know how works when servo centered:
code: [select]
// sweep
// barragan <http://barraganstudio.com>
// example code in public domain.
#include <servo.h>
servo myservo; // create servo object control servo
// maximum of 8 servo objects can created
int pos = 0; // variable store servo position
void setup()
{
myservo.attach(2); // attaches servo on pin 2 servo object
}
void loop()
{
for(pos = 1590; pos < 2360; pos += 10) // goes 90 degrees 170 degrees
{ // in steps of 10 degree
myservo.write(pos); // tell servo go position in variable 'pos'
delay(15); // waits 15ms servo reach position
}
for(pos = 2360; pos >= 1590; pos-= 10) // goes 170 degrees 90 degrees
{
myservo.write(pos); // tell servo go position in variable 'pos'
delay(15); // waits 15ms servo reach position
}
{
myservo.write(pos); // stops servo @ 90 degrees 1.5 sec
delay(1500);
}
for(pos = 1590; pos >= 780; pos -= 10) // goes 90 degrees 0 degrees
{ // in steps of 10 degree
myservo.write(pos); // tell servo go position in variable 'pos'
delay(15); // waits 15ms servo reach position
}
for(pos = 780; pos < 1590; pos += 10) // goes 0 degrees 90 degrees
{ // in steps of 10 degree
myservo.write(pos); // tell servo go position in variable 'pos'
delay(15); // waits 15ms servo reach position
}
{
myservo.write(pos); // stops servo @ 90 degrees 1.5 sec
delay(1500);
}
}
if has advice appreciated.thank you!
roman
quote
if can point me towards sources of adding servo mpu code can hw while mpu on way.
i think trying attach servo wrong thing. there no code on mpu, , can't see how can attach servo code anyway.
quote
i have encountered problem range of motion servo; when returning 0 degrees, try , go past rotational limit.
then, it's lower limit not 0 degrees. don't try go beyond it's lower limit.
quote
i got same thing adxl345 connected it
how adding more hardware mix solve anything? you've got 1 piece not operating expected. solution not throw more hardware mix. understand going on code , hardware have!
quote
can solve when programming mpu code?
not until begin understand programming. hint: isn't mpu or servo or camera.
quote
what called when servo tries that?
unrealistic expectations on part.
quote
i don't know how works
why not? there 3 statements in whole mess of code. loop, servo.write() statement, , delay() call.
first thing should figure out of curly braces needed, optional, , plain silly. rid of sill ones.
quote
as programming seems im in on head short amount of time have left before semester ends.
good thing didn't wait until last minute, then.
Arduino Forum > Using Arduino > Programming Questions > Using MPU6050 SparkFun breakout to keep HS-45HB servo level
arduino
Comments
Post a Comment