<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><description>Raspberry PIO stepper library ( pio_stepper_lib ) is a C++ library that runs stepper motors in PIO state machines. It&amp;#39;s intended to be easy to integrate and use in Pico projects.
In this post: create ramps when motor starts, stops or changes direc...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Mon, 19 May 2025 15:12:52 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;First attempt for a more trapezoidal(ish) ramp:&lt;/p&gt;
&lt;p&gt;[View:https://youtu.be/AyNQrvEplDw:640:360]&lt;/p&gt;
&lt;p&gt;This&amp;nbsp;(very early)&amp;nbsp;attempt takes core (non-PIO) processor time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How do you ramp, as a library user?&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:e4e9b0b7-839a-40bf-b57d-d60d5d0f2a58:type=c_cpp&amp;text=%20%20%20%20%20%20%20%20%7B%7B400%20%2A%20microstep_x%2C%20true%7D%2C%207000%2C%202600%7D%2C%0D%0A%20%20%20%20%20%20%20%20%7B%7B8000%20%2A%20microstep_x%2C%20true%7D%2C%202600%2C%202600%7D%2C%0D%0A%20%20%20%20%20%20%20%20%7B%7B400%20%2A%20microstep_x%2C%20true%7D%2C%202600%2C%207000%7D]&lt;/p&gt;
&lt;p&gt;You tell it the amount of steps, start delay and end delay.&lt;/p&gt;
&lt;p&gt;If start and end is the same, the&amp;nbsp;library hands of everything to the PIO.&lt;br /&gt;If they are different, the core calculates the ramp delay (naive attempt [emoticon:c4563cd7d5574777a71c318021cbbcc8]) after each step, then&amp;nbsp;sets the next delay and takes the next step.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s a continuous ramp, but absolutely not linear / trapezoidal at this moment.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Tue, 13 May 2025 20:41:01 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>DAB</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Nice update Jan.&lt;/p&gt;
&lt;p&gt;This project is coming together very nicely.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Mon, 12 May 2025 17:47:33 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;an interesting article for motor profiles (stepper and servo): &lt;a href="https://www.pmdcorp.com/resources/type/articles/get/mathematics-of-motion-control-profiles-article" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;Mathematics of Motion Control Profiles&lt;/a&gt;.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Sun, 11 May 2025 17:40:22 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>shabaz</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Impressive work!&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know enough about this subject, but hopefully others do.&lt;/p&gt;
&lt;p&gt;As a use-case, if I wanted to control the number of rotations precisely, say, 1000.5 turns (could be fractional),&amp;nbsp;it would be interesting to see how that sort of thing could theoretically be implemented to work with the library with ramping up, maintaining speed and then ramping down (I suspect that would require to be mostly outside PIO for computational flexibility, e.g. a computed list as Jan shows, especially if it needed to be modified in future, and it&amp;#39;s also very likely it would be too large for PIO anyway).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Another theoretical requirement could well be to do an ad-hoc &amp;#39;abort&amp;#39; and ramp down part-way through a list, if a user hits a button part-way. I can see all of this could get very complicated very quickly though.&lt;/p&gt;
&lt;p&gt;And I&amp;#39;ve never understood, how does a n-axis machine work, where you may want several motors to be at particular turn counts at the same time, e.g. motor 1 to be at 10.5 turns, and motor 2 to be at 4.6 turns, and then later on, at two different turns values. Would ramping be used, or would one just stick to a slow speed with no ramping? It sounds massively complicated,&amp;nbsp;I guess&amp;nbsp;in practise a huge&amp;nbsp;list would be built for the motors to execute. I&amp;#39;m just wondering out aloud,&amp;nbsp;more rhetorical&amp;nbsp;because I realize none of this is trivial, and probably needs me to go away and read up a lot, maybe peek at some open source CNC software to see how they do it.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Sun, 11 May 2025 15:48:44 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>genebren</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Ramping is a great approach to moving steppers.&amp;nbsp; It also a useful approach of working with servos.&amp;nbsp; I have created some projects around using servos in animatronic devices.&amp;nbsp; Some of these devices have a significant amount of mass connected to them and benefit greatly from soft starting/stopping.&amp;nbsp; Here is a captured trace of some multiple axis movements that use ramping start/stops, with fixed rate movements to create smooth motions:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img alt=" " src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3/movments.jpg" /&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Sun, 11 May 2025 13:34:20 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;a trace without pauses or prinf()s shows that this runs smooth.&lt;/p&gt;
&lt;p&gt;In this ramp example, several times the cores have to take over from PIO (we trickle-feed commands one by one). But it&amp;#39;s unnoticeable, given the low speed of the&amp;nbsp;stepper pulses:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3/pastedimage1746970457620v1.png" /&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Raspberry PIO stepper library documentation - 5: simple ramp up and down</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pio-stepper-library-documentation---5-simple-ramp-up-and-down</link><pubDate>Sun, 11 May 2025 12:57:42 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b5f0f5e-330a-42e9-83e0-f64d8ddab0b3</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This simple pattern, with a single step ramp up-and down speed, makes it possible to run the stepper at higher speed.&lt;/p&gt;
&lt;p&gt;The fast movement below was not achievable when I used a single fixed speed for all commands:&lt;/p&gt;
&lt;p&gt;[View:https://youtu.be/HuXfmYXk8QY:640:360]&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28890&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>