Stepper Motor - which drvier?

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
wendy
Posts: 46
Joined: Sun Aug 26, 2018 7:48 am
Contact:

Re: Stepper Motor - which drvier?

#31 Post by wendy »

Hello Joe,

Thanks, I'm not using a constant speed but a stepper speed that is variable and depending on the movement of the gyro in the simulator. I'm using a Nema 17 with a TMC2208 stepper driver and set to a very low torque and the stepper driver set to 16 microsteps so reaching 6400 steps/revolution. The stepper is a nema17 with small depth.

The speed is calculated in the Arduino sketch depending on the values received from the messageport. Air Manager sends the data to the NANO over the messageport. The simulator is XPlane 11.

Regards, Wendy

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

Re: Stepper Motor - which drvier?

#32 Post by jph »

Hi Wendy, excellent stuff. I like it.
I also have done most of my experiments with the small versions of the nema 17 units. They are amazing when paired with the tms units.
Have you looked at the accelstepper library ?. it is rather nice although I must say your adjustable delta programming is doing a lovely job also. :)
The fluidity of the acceleration and deceleration and the customisation of accelstepper is rather nice.

Are you using the arduino IDE to program with ? - if so, have you had a chance to look at the PICO in Arduino ? - absolutely amazing.
Full dual core at 240 mhz. You can run your stepper control on one core and other tasks on the other core.
Message port runs beautifully on Pico but there is a small work around needed as for some reason AM is not correctly initialising Virtual Com Ports.
I can offer work around for now if you want to experiment ?
The pico is cheaper than even the nano clones and is utterly magic (I think you may be able to tell I like the Pico :lol: )

If you haven't had the pleasure of using the pico in Arduino IDE (with full user settable code optimisation) then the work by Earle Philhower is on a different planet.
Some of the documentation
https://arduino-pico.readthedocs.io/en/latest/

Keep up the great work
Joe
Joe. CISSP, MSc.

wendy
Posts: 46
Joined: Sun Aug 26, 2018 7:48 am
Contact:

Re: Stepper Motor - which drvier?

#33 Post by wendy »

Hello Joe,

Thank you again.
I'm using the normal stepper library "stepper.h", I was playing with accelstepper but it became to complicated and as you can see the gyro is following the simulator nicely. It was far more easy with stepper.h

For this I'm using the normal Arduino IDE but I also use Visual Studio with PlatformIO.
I never played with Pico, it sure is a valid option, I'll start reading the link you included to begin with.

Regards, Wendy

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

Re: Stepper Motor - which drvier?

#34 Post by jph »

Hi Wendy, agreed 100%. As they say, don't fix what isn't broken ;) . Your routine is certainly delivering the goods.
It is often a case where too much data is available from x-plane - or any sim for that matter, and having your own algorithms allow you to send data at a much lower rate than the sim is actually sending, if needed.
Yes definitely, have a look at the pico, it is just amazing and crazy cheap. I have about 20 genuine pico boards and they all run at 240MHz overclock all day long.
There are some nice chinese versions with 4 and 16MB flash but although the RP2040 is genuine they use counterfeit flash. This is absolutely not a problem at stock speed (133MHz) but they won't overclock. It is nice to have the option of the higher flash size though. I have just received some genuine flash to swap out for the chinese one on the clones - https://eu.mouser.com/ProductDetail/454-W25Q128JVSIQTR to see if they will overclock ok then.
Unfortunately you cant up the ram on the genuine pico as the package size they use is incredibly tiny and doesn't go higher than 2MB. Not that that is an issue :lol:
The chinese ram swap for genuine QSPI flash is more a case of to 'see if it work'. I must confess it finally made me bother to go and order a PCB camera / lens combo for that kind of smd work so I can output the image of the work area to a 21" monitor !.

If you do want to experiment with Pico and messageport you will find that AM just sits there and the device and AM will not communicate - hence AM never 'sees' the device . Using a transparent serial monitor you can see that AM is sending handshake data but Messageport is not responding hence you never get a device recognised in AM. The way around it is to open ANY program / terminal /etc that can access the appropriate port at the speed that AM wants *115200,N,8,1* - you dont need to send any data, simply let the proper handshaking occur which configures the VCP to the correct baud rate. (With a VCP setting Serial.begin(115200) means absolutely nothing at all, it is ignored. It relies on the program communicating to negotiate to the same rate as the program communicating.

For example, if using the arduino IDE or PIO then when the device is flashed with MP and your sketch you can simply open the terminal window and immediately close it, then open AM and all will work properly.
AM is the same on any of the modern processors with vcp (virtual com ports) and all that will run messageport will work fine in AM - but ONY of you do the above trick first to replace whatever AM is not sending.

I actually use a little crude batch file and the command line version of Putty - called plink.exe (windows)
Whatever port the pico (or indeed you can use an STM32 nucleo board as well which is also nice) is using you add to a batch file such as the following lash up ;) which just opens and immediately closes the ports at the correct speed that AM requires an then open Air Manager and all your devices will work happily -
It literally opens plink with the correct settings pointed at the PICO com port(s) in use and then instantly kills the session. That is enough to initialise the com port correctly and AM will now work. It will also work if you shut down AM and restart it. It appears to be down to the vcp on the micro needing to be properly negotiated to the required speed - as again, what is set in Serial.begin(xxxx) is completely ignored with a VCP.

Code: Select all

@echo off
start "" plink.exe -serial \\.\COM11 -sercfg 115200,8,1,N 
start "" plink.exe -serial \\.\COM14 -sercfg 115200,8,1,N 
start "" plink.exe -serial \\.\COM17 -sercfg 115200,8,1,N 
taskkill /im plink.exe
start "" "C:\Program Files\Air Manager\Bootloader.exe"
exit /b
You can call the pico anything you want from the recognised list - such as an uno, or a teensy - it doesn't matter with messageport. You can actually add the pico name and icon to messageport if you want as it was originally there but then removed when it was found the VCP would not work with AM - that was before it was known that it CAN work. (I literally only found the workaround (for whatever AM is not doing) a few days ago after using the transparent serial monitor to prove that it CAN work and it is at the AM end).

Just opening and closing the terminal window in the IDE or PIO will do exactly the same - no data needs to be sent, then open air manager and you will see the device with whatever name you gave it.

I havent -yet- found a library that doesn't run on the pico. The implementation in Arduino is terrific.

Definitely give it a try if and when you get chance.

All the best, I will stop rambling haha
joe
Joe. CISSP, MSc.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: Stepper Motor - which drvier?

#35 Post by marcel_felde »

I hope you can view this video from Instagram:

https://www.instagram.com/reel/ChUx5fYg ... MyMTA2M2Y=

When the props are coming out of feather, you can clearly see the needles not running smoothly. This has to be an issue of coding, issue of the driver or a combination of both. As the steppers are also used in cars and there needles are running smooth too. ;)

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

Re: Stepper Motor - which drvier?

#36 Post by jph »

Hi Marcel,
As Wendy has already made a very nice version for messageport with delta calculations (rate of change) it would be great if Wendy could pass you a small routine to try ?
I think you are working on 4320 pulses per 360 degress (1/12th degree per step)
With simvim or whatever it is (I get confused ;)) it is possibly (probably ?) the software and the serial port being overloaded depending on what it is sending. I have no idea what it sends over the serial port but it could be absolutely bombarding it with updates leading to dropouts, or conversely it could be sending data at irregular intervals. Totally unknown.
It is, I would say, nothing to do with the driver or stepper as you are using the X27 and vid6066.
What is controlling the driver ? for the prop gauges ? - I presume an arduino of some kind ? . what other things is it actually doing in the sim ?. what else does it run part from 2 prop gauges ? - I think it is probably just data overload.
Also, I have never used instagram but is there any way to increase the size of the video as it is rather small. there doesnt appear to be any 'fullscreen' controls etc ?
(This is on a laptop with no touch)
Joe
Joe. CISSP, MSc.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: Stepper Motor - which drvier?

#37 Post by marcel_felde »

I am travel now - Dornier Do 27 meeting in northern Germany and next week we are moving. So testing may take a while, sorry. ;(


bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Re: Stepper Motor - which drvier?

#39 Post by bmooneyhan »

Hi all,

My most sincere apology for resurrecting this thread! :) I'm just starting build instruments with steppers, starting with the compass. I built one with the 28BYJ-48 and a ULN driver and I'm not really happy with the performance, it's kinda not very smooth and a bit more laggy than the on-screen compass. I built another with a x27-168 using the Easy Driver and it's super odd, being that it will only move once. I have a simple test function tied to a button-release callback. When I press the button, the motor turns, no errors in code or anything. When I press the button again, nothing happens. My debug message shows up in the console, but the motor does nothing. IF I stop/start AM, it will again move the first time I press the button. So as usual, I have some questions:

1. What is the real number of steps to program in AM for the X27?
2. What driver is suggested as best? I have the 4988 and Easy Drivers on hand
3. If you're familiar with the Easy Driver, are the control leads MS2 and Enable actually required?
4. Is there a better motor I should you instead of the X27?
5. Can I drive the X27 directly with no controller, or just using the ULN?

thanks in advance for any help

User avatar
Ralph
Posts: 7880
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper Motor - which drvier?

#40 Post by Ralph »

The 28BY is very slow. It is made to control the output vanes in an airconditioning unit, so no speed required. The x27, as far as I know, can only do about 270 degrees. Maybe I'm mistaking, but I think that you need something else.

Post Reply