Stepper X27 + VID6606

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
albafer
Posts: 10
Joined: Mon Nov 02, 2020 6:12 pm

Stepper X27 + VID6606

#1 Post by albafer »

Hi everyone,

My name is Carlos and I'm trying to understand and learn all these kind of things to build my own "cockpit".

Studing AM and Lua I have a few doubts about how to control a stepper motor with a VID6606 controller.

I'm using exactly the same code form the web to understand the logical, but I can't not reach to understand how to define the maximum and minimum in my gauge. I have tried to find this information in the forum even google but I didn't.

The code...

stepper_rpm = hw_stepper_motor_add("VID66-06", 4096, 200, false, "ARDUINO_MEGA2560_A_D14", "ARDUINO_MEGA2560_A_D15") -- I have modified this line to use the VID6606 controller

-- Initialization starting, rotate clockwise for 3 seconds
hw_stepper_motor_position(stepper_rpm, nil, "ENDLESS_CLOCKWISE")

timer_start(3000, function(count)
hw_stepper_motor_calibrate(stepper_rpm, 0.0)
hw_stepper_motor_position(stepper_rpm, 0.0)

local function new_rpm_xpl(rpm)
engine_rpm = var_cap(rpm[1], 0, 3500)
-- The stepper motor position is set as a value from 0 to 1, so we have to convert the RPM to a position.
-- Therefore we divide 1 by 3500, this is then multiplied with the current RPM.
hw_stepper_motor_position(stepper_rpm, 1 / 3500 * engine_rpm)
end

xpl_dataref_subscribe("sim/cockpit2/engine/indicators/prop_speed_rpm", "FLOAT[8]", new_rpm_xpl)
end)


I have moved the gauge without any problem but I can not fix the 0 rpm position or the maximum rpm position.

In the hw_stepper_motor_add, what is the way to define the "nr_steps"? Why is 2048? Why not 4096?

I guess that with the hw_stepper_motor_calibrate I can adjust the 0 position in my gauge, but I have tried to change the parameter from 0.0 to 0.1075 (this it the value that I have could measure) but nothing happens.
Captura.JPG
The problem is the values from the xplane don't match with my gauge and I can not find the way to adjust propperly.

Could you help me to undertand this function?

Thank you in advance!

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper X27 + VID6606

#2 Post by jph »

Hi
The steps per revolution of the X27 is 1080 (3 steps per degree) - not 2048 or 4096
Normal rotational angle is 315 degrees.
From that you can work out your start and end needle positions. You do not need to calibrate the unit as it has physical end stops so you can simply force it to the anticlockwise end stop on startup and work from there. You wont damage the motor driving it to an end stop. That is the normal way even in vehicles.
Joe. CISSP, MSc.

albafer
Posts: 10
Joined: Mon Nov 02, 2020 6:12 pm

Re: Stepper X27 + VID6606

#3 Post by albafer »

Thank you JPH for your very quick answer.

But you answer generate me a new question more...

3 steps per degree. 315 degrees. 315 x 3 = ¿945 steps? Is this the configuration that I need to use when I defined the stepper motor?

If I use 945 the needle of my gauge only moves 30 or 40º.

In my understanding, and correct me if I'm wrong please, If I write... "hw_stepper_motor_position(stepper_rpm, 1.0)" the needle should move to the final position, right?

I'm a really lost with that...

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper X27 + VID6606

#4 Post by jph »

read this bit first (which isn't the full story) - then read the bit after as I forgot something important.... ;)
The figure required to be entered is the number of STEPS per revolution which = 360 * 3 = 1080.
Although the X27 stepper motor is usually internally limited to 315 degrees of movement by plastic end stops that is still the figure that needs to be entered.
You then only need to find two figures for the positioning of the needle. The number of steps needed to move from the anticlockwise end stop to the 0 RPM position and also the additional number of steps to move from 0 rpm to the maximum rpm.
You 'could' set the gauge so that the anticlockwise position is at the 0 rpm gauge position (physically) but it is not at all required.

To the next part, yes you are correct re the positional routine.
HOWEVER - I forgot that the VID Driver IC is NOT direct - it is using microstepping - doh :? . therefore it is using 12 steps per degree - so a microstep of 4 (if the motor is 3 degrees per step. Hence the value to enter should be 1080 x 4 = 4320 which also = 360 * 12 so it would seem.
Give that a try. in theory then a full 315 degree arc would be around 315 * 12 = 3780 steps. (although you would still enter the 360 degree figure for the hardware add.)

That 'should' work :D - famous last words....

after entering the theoretical 4320 you can experiment with calculated values to move, say, 90 degrees or 180 degrees etc to check the calculations and see if there is something different in your setup as the figure entered and the amount of movement should be able to be reverse engineered if necessary.

so, a value to move one degree of 12 should be correct. where 90 degree is equal to 90*12 = 1080 etc which should also be equal to 0.25 in the full range hw move function.

and as said above - should there still be an issue then it should be straightforward to calculate the number of steps needed for, say, a 90 degree movement and reverse engineer what your step angle is.. shouldn't be needed, but...................

Joe
Joe. CISSP, MSc.

albafer
Posts: 10
Joined: Mon Nov 02, 2020 6:12 pm

Re: Stepper X27 + VID6606

#5 Post by albafer »

Thank you so much for your time and explanations!!

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper X27 + VID6606

#6 Post by jph »

You are welcome - ;) . And a belated welcome to the forums. Have fun.
Joe
Joe. CISSP, MSc.

albafer
Posts: 10
Joined: Mon Nov 02, 2020 6:12 pm

Re: Stepper X27 + VID6606

#7 Post by albafer »

Hi again,

I want to share with you my progress... It's designed and mounted by me and fully retro-iluminated.
IMG_0361.jpg
IMG_0362.jpg
I'm awaiting for the new vinyl.

Thank you.
Carlos

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper X27 + VID6606

#8 Post by jph »

Really nice and top quality Carlos. Nice. :D
Out of interest, how many instruments does the single board support ?
It looks like you have a mega 328 and the SI Labs Serial to USB on board as well as the VID66.
The vid66 can drive 4 X27s so I presume you can link the other 3 to use this as the driver via J4 ?
or, maybe, by looked at your notations on the board it is designed to be used as a single instrument for various types of instrument ?
Top class.
Joe
Joe. CISSP, MSc.

albafer
Posts: 10
Joined: Mon Nov 02, 2020 6:12 pm

Re: Stepper X27 + VID6606

#9 Post by albafer »

Hi,

I come from SIMVIM (now realsimcontrol) and the idea was to integrate the brain of all steppers on this board. I have changed the base of my project to AM and the board will not be fully functional.

As you said, USB - SI2102 - ATMEGA 328 - VID6606 and via J4 you can connect 3 more motors. The board is capable of using CNY70 or hall-efect sensors to locate the needle if you need it. Additionally, the footprint for a enconder is located in a corner to use the same board for another kind of gauge like an altimeter. The board is something like an custom ARDUINO UNO.

With AM I have new rules of game and I'm going to re-design my board to be fully functional.

Carlos

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper X27 + VID6606

#10 Post by jph »

Hi Carlos,
Very nice design and lovely PCB work as well.
Yes, that seems like a well thought out and logical layout. Are you assembling all the SMD yourself :o ? It is so good that it looks to have been done with a mask and P&P machine. :)
Out of interest, you can make any X27 motor into one that is capable of continually rotating by clicking open the case of the motor and cutting away the plastic 'stop' tabs.
You need to have some means of calibrating the unit then though, but, it does allow for greater flexibility if you need multi turn.
There is also a dual concentric X27 unit available for use in such as an altimeter. Nice unit. I think I have an image of it if you would like me to find it ? - you may already have one of those units.
Another useful thing for AM is that by using the function HW ADD for the VID66, you can use this to drive something like an A4988 or ANY industry standard stepper controller as the VID066 channel operates on just 2 pins - a direction pin and a step pulse. This is exactly the same as how 99% of all industrial stepper controllers work so AM is capable of driving those as well by using the same function. Just use any 2 pin step direction controller as needed.
Great for jobs requiring more torque.
Do you have a web page or channel ?
Joe
Joe. CISSP, MSc.

Post Reply