Newbie to programming here, I wanted to ask some questions

 

I hope I'm posting in the right place, I assume beginners would be the place for me.

There are a couple things I would like to know if are possible.

I would like to manipulate a ring with a motor. But I would like the ring to move to a specific position dictated by a joystick. In short, the marked forward position of the ring would be pointing the same direction as the joystick is pointing.

The joystick could be rotated in circles and the ring would follow the direction. I could read the position of the ring with a rotary encoder.

 

I had an idea how to lay out a program but have no idea how to implement this inside PicAxe for example.

 

First the program reads the direction of the joystick. By using some sort of information from the two pots.

 Second, the program would read where the ring is located currently, from the rotary encoder.

After that, the program would ask where it needs to be, and which direction is the shortest to get there,

The motor would then move the ring until the values are the same.

 

It would do this multiple times a second, possibly with some constraints to minimize jittering.

 

At least I hope…

Someone set me straight, or let me elaborate if my ramblings are too ignorant/vague.

-Dan

 

I am going to try to break down what I understand.

A motor getting moved will require a motor driver. If your joystick has a pair of pots that report its position, you can use a pair of analog inputs on the wiper connections of the pots to tell the PICAXE what position the joystick is in.

Maybe you could try breaking your project down into separate parts and get each one working individually. Kind of like what programmers do with large projects.

If you can describe your idea in more detail, I might be able to offer more assistance.

Well I’m going to need to

Well I’m going to need to first figure out what kind of PICAXE to get. I was considering just getting a 40M2 to have lots of inputs and outputs. I have pretty much access to any kind of comenent I might need, so I was considering building my own motor controllers as well… at some point in time.

What I would like to do first, is figure out how to get the pots attached to the PICAXE. I can’t really find many tutorials dealing with what I’m trying to do. Or I might just not be looking in the right places.

First things first, is to be able to know what direction the joystick is being pushed in.

Then I need to know what direction the encoder is pointing. (Which looks quite easy from what I’ve found)

A good median step would be to ask the ring to move to a certain location. North… or south… etc.

Then I need to make the ring (which is attached to the encoder) rotate to that same angle as the joystick. But it would be doing this  many times per second.

 

to read a potentiometer

http://www.picaxe.com/Circuit-Creator/Sensors/Potentiometer/

The center wiper will connect to, in the code listed, pin C.0. If you need a better idea, just search for potentiometer and picaxe. I would just about bet that the PICAXE manuals probably show how to connect pots as well as other sensors. If you haven’t already downloaded the manuals, you should.

https://www.robotshop.com/letsmakerobots/node/24705 will show you how to make an adjustment to a pot to let it read continuous. That might work better than an encoder.

stoopid me

Why not just use a continuous rotation servo to move your ring?

For upscaling

The idea is to slowly go larger and larger with the designs, and a servo just does not work when upscaling.

I guess its time to learn some advanced programming tequniques.

no advanced programming required
Motors just require 2 or 3 pins to control instead of one. I would suggest you look at the h- bridge matrix https://www.robotshop.com/letsmakerobots/node/2484

Thank you

I will defiantly be building a few of these.

I may also consider using a stepper motor, which I had intended to use in the larger model. I may end up just creating a rail gear system and using that.

Once I begin testing I will know for sure, but I’m worried the motor will have a spin down time, and then overshoot the position I want. I’ve already created some test procedures that I can use with simple programs. Thanks for all your input! I will keep things updated as I learn to program more.

I will defiantly be building a few of these.

I may also consider using a stepper motor, which I had intended to use in the larger model. I may end up just creating a rail gear system and using that.

Once I begin testing I will know for sure, but I’m worried the motor will have a spin down time, and then overshoot the position I want. I’ve already created some test procedures that I can use with simple programs. Thanks for all your input! I will keep things updated as I learn to program more.

For dealing with overshoot,

For dealing with overshoot, etc. look up PID control. Servos have this built in, which is one of the reasons they are so nice to use.

However, I understand you want to go with motors. A stepper may be a good approach, as you mention, since you can control the position more accurately than a DC motor. You probably won’t need to worry about PID control with a stepper.

Along with what ignoblegnome said.

Overshoot will be more pronounced with the amount of Force (Force=mass*acceleration). If you aren’t moving a large object quickly, you should be alright just moving the stepper from position to position, as ig said “without PID”.