Has anyone used the MPU-5060 3-axis Gyro? I need help setting up coding for it...

boriz

Senior Member
Welcome. (Really! We could do with more rocket scientist around here.)

To be fair, you have not provided much information about the Picaxe you are using and the hardware you have to play with.

My pseudo code will get you started. It can be easily expanded into Picaxe BASIC. Do you want to do that yourself? I don't have an MPU-5060 to test. (My method is usually - Try something, watch what happens, learn from it, try something else...)

Did you read the Picaxe manual?

P.S.

Coding is easy. It's the hardware that's tricky.
 
Last edited:

rocketdoc

New Member
well, i DO NOT LIKE TO BRAG ABOUT ANYTHING... i AM NOT A PROGRAMMER, BUT, i AM MORE THAN WILLING TO LEARN MORE oops, caps lock, sorry!! lol!!!

I left the docs, for the gyro in a previous post, and I would love to have the the code to work, and I have all of the breadboards and parts, everything up to a picaxe 40.. i was hoping to use a 28x2 for the guidance portion, and then use another to keep up with the commands from the gyro PIC. so that the pic for the gyro has ONLY that to communicate with. the other PIC could be used to translate, and make the servos respond, and complete the other control aspects with other less important PICs in order to keep it as fast as possible. Did I explain that right??? lol!! I am tired. I would really appreciate an help I can get. help me with the code, I will do the bread boarding, and test it, and give you the results of what s happening. we need to keep this under some type of debug, so maybe we could use a SD card to store what is happening, and I can transmit it to you to look at also. I have all of this in my hands. we need to make a data logger for the controlling systems, so that we can see what is doing what, and where we need to go... i know it will make it slow, until we completely get a good run going, but, that is part of developing an idea, right?? I will also provide the schematic I have designed so you can compare and check connections. I have no fear of sharing my discoveries. if someone is going to seal them, they will get them probably other ways. I do not know if I will pursue a commercial setup, it is not my future goal. but, I would like to have the proof of concept work fairly well.

LETS ROLL!!! I would love the help!!

THANKS!!

Kim
 

rossko57

Senior Member
i was hoping to use a 28x2 for the guidance portion, and then use another to keep up with the commands from the gyro PIC. so that the pic for the gyro has ONLY that to communicate with. the other PIC could be used to translate, and make the servos respond, and complete the other control aspects with other less important PICs in order to keep it as fast as possible.
This seems unnecessarily complicated for a school-level demonstrator.
Communication takes time; doing related guidance functions in one box will reduce overhead and should help with your speed. Although it could help to offload the work of maintaining servo signal outputs to a slave.

Why the need for speed for a non-flying demonstrator? Going slow may help the audience see what is happening.

Logging is a good idea; but initially reporting up a serial line to an attached laptop will do - and again may be preferable for a demonstrator. Don't waste effort yet on SD cards etc.

help me with the code
Start developing a block-level outline so you can ask 'smaller' questions. What do you need to happen? e.g.
Some means of setting or loading a desired course.
Some means of detecting deviation.
Some means of applying corrections.
Much of this has been covered already at outline level. Which bits are you stuck on?

One way to make a start might be to select your gyro and the communication method to it (I2C?) and to write code to extract the information you need, process it into the form you want, and simply display/report it. Which is where we came in !
 

g6ejd

Senior Member
My friend, the pseudo code I posted for you will require little if any modification to work on a PICAXE and it will work. You now need to find the code snippets for reading the 5060 and draw out how your going to connect your PICAXE to the 5060 and servos.

I see 2 servos for a bench demo (X and Y), the 5060 and just one PICAXE no more. You also need to decide how your going to get control surface feedback, or you could simply use a variable to do that and assume the servo will track the values.
For example:
roll_value = 50 ;
gosub set_roll_servo_position; assume when commanded to go to 50 that your servo will be at position 50% and so on.

e.g.
set_roll_servo_position
; Now scale the values from 0 to 100 to 75-225
position = roll_value * 150/100 + 75; (result is 150 or 1/2 of the travel)
SERVOPOS pin,position
RETURN
 
Last edited:
Top