<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Including Quadrature Encoder - PID positioning of DC motors into Teacup_Firmware</title>
        <description> I&#039;ve been working for a while to get my Teensy 3.1 based controller board to manage four Quadrature Encoders, and provide PID position control for four DC motors.  

This was completed a month or so ago, and I&#039;ve since downloaded, and finally successfully compiled and installed Teacup_firmware on the Teensy.  

My Quadrature decoder routines use two separate methods, Hardware flextimer modules run X/Y axis, and hardware interrupts for two Z axis decoders.   Thought being that movement of the Z-Axis is less critical to path planning.

All decoder routines are interrupt driven, and run autonomous of anything else on the processor.  They simply provide global variables for the current exact position and direction of each axis. 

The DC motor PIDs today use the metro timing library and a version of the arduino PID library, and also run autonomous of anything else on the processor.  Fill a global variable with the next target position, and it goes there.  What is missing currently is the velocity profiling to have smooth X/Y path control. 

So.. long story short, I&#039;m looking for a method to use the functionality of Teacup_firmware to control my servos as if they were steppers. 
in other words, the macros that are in teacup to WRITE direction and step, I wish to replace with macros that assign +1 or -1 to an axis direction variable. (ie:  XAXIS_DIR=-1)  then when a STEP command is issued, that macro would ADD the axis direction variable to the axis target position value  (ie: XAXIS_TARGET += XAXIS_DIR) .  If DIR was negative, the addition would result in decrementing the target position.

The axis position PID would then update it&#039;s position based on this in real time. 
And yes, at some point, I would expect to use dda_clock() to control timing of the PIDs.

Am I way off track here?  Is there an easier way to integrate?   In my mind, I simply need to include my two files and their headers.  
  Encoders are interrupt driven, and feed global variables.  
  Motors read global variables and use interrupts to sync position.
  two macros need to be replaced per axis.  One for WRITE Direction  one for WRITE Step.

Thoughts? Guidance please...</description>
        <link>https://reprap.org/forum/read.php?147,486936,486936#msg-486936</link>
        <lastBuildDate>Fri, 04 Sep 2026 12:50:23 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?147,486936,489232#msg-489232</guid>
            <title>Re: Including Quadrature Encoder - PID positioning of DC motors into Teacup_Firmware</title>
            <link>https://reprap.org/forum/read.php?147,486936,489232#msg-489232</link>
            <description><![CDATA[ Yes, <a href="https://plus.google.com/113179837473309823193/posts" target="_blank"  rel="nofollow">Miguel Sanchez (MISAN)</a> and I have been talking for quite a while now.  He is doing some incredible work!<br />
<br />
He recently developed a two dc-motor controller on one arduino with Step/DIR control!]]></description>
            <dc:creator>unix_guru</dc:creator>
            <category>Firmware - experimental, borrowed, and future</category>
            <pubDate>Fri, 27 Mar 2015 08:06:37 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?147,486936,489108#msg-489108</guid>
            <title>Re: Including Quadrature Encoder - PID positioning of DC motors into Teacup_Firmware</title>
            <link>https://reprap.org/forum/read.php?147,486936,489108#msg-489108</link>
            <description><![CDATA[ If i understand u it´s "Fantastic".<br />
<br />
Seems you solved it, but mey u want to take a look Misan work in [<a href="http://forums.reprap.org/read.php?160,450687" target="_blank"  rel="nofollow">forums.reprap.org</a>] <br />
<br />
Sorry if not.<br />
<br />
I´m not english.]]></description>
            <dc:creator>SergioMC</dc:creator>
            <category>Firmware - experimental, borrowed, and future</category>
            <pubDate>Thu, 26 Mar 2015 20:56:09 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?147,486936,487289#msg-487289</guid>
            <title>Re: Including Quadrature Encoder - PID positioning of DC motors into Teacup_Firmware</title>
            <link>https://reprap.org/forum/read.php?147,486936,487289#msg-487289</link>
            <description><![CDATA[ Ok... I can hear you laughing at how naive I am....  <br />
<br />
That said, I'm working through the X-axis pin remapping and macro replacements etc... Hope to have X-Axis running later tonight. <br />
<br />
Cheers.]]></description>
            <dc:creator>unix_guru</dc:creator>
            <category>Firmware - experimental, borrowed, and future</category>
            <pubDate>Mon, 23 Mar 2015 09:30:33 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?147,486936,486936#msg-486936</guid>
            <title>Including Quadrature Encoder - PID positioning of DC motors into Teacup_Firmware</title>
            <link>https://reprap.org/forum/read.php?147,486936,486936#msg-486936</link>
            <description><![CDATA[ I've been working for a while to get my Teensy 3.1 based controller board to manage four Quadrature Encoders, and provide PID position control for four DC motors.  <br />
<br />
This was completed a month or so ago, and I've since downloaded, and finally successfully compiled and installed Teacup_firmware on the Teensy.  <br />
<br />
My Quadrature decoder routines use two separate methods, Hardware flextimer modules run X/Y axis, and hardware interrupts for two Z axis decoders.   Thought being that movement of the Z-Axis is less critical to path planning.<br />
<br />
All decoder routines are interrupt driven, and run autonomous of anything else on the processor.  They simply provide global variables for the current exact position and direction of each axis. <br />
<br />
The DC motor PIDs today use the metro timing library and a version of the arduino PID library, and also run autonomous of anything else on the processor.  Fill a global variable with the next target position, and it goes there.  What is missing currently is the velocity profiling to have smooth X/Y path control. <br />
<br />
So.. long story short, I'm looking for a method to use the functionality of Teacup_firmware to control my servos as if they were steppers. <br />
in other words, the macros that are in teacup to WRITE direction and step, I wish to replace with macros that assign +1 or -1 to an axis direction variable. (ie:  XAXIS_DIR=-1)  then when a STEP command is issued, that macro would ADD the axis direction variable to the axis target position value  (ie: XAXIS_TARGET += XAXIS_DIR) .  If DIR was negative, the addition would result in decrementing the target position.<br />
<br />
The axis position PID would then update it's position based on this in real time. <br />
And yes, at some point, I would expect to use dda_clock() to control timing of the PIDs.<br />
<br />
Am I way off track here?  Is there an easier way to integrate?   In my mind, I simply need to include my two files and their headers.  <br />
  Encoders are interrupt driven, and feed global variables.  <br />
  Motors read global variables and use interrupts to sync position.<br />
  two macros need to be replaced per axis.  One for WRITE Direction  one for WRITE Step.<br />
<br />
Thoughts? Guidance please...]]></description>
            <dc:creator>unix_guru</dc:creator>
            <category>Firmware - experimental, borrowed, and future</category>
            <pubDate>Sun, 22 Mar 2015 11:59:12 -0400</pubDate>
        </item>
    </channel>
</rss>
