<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - prjs:usmc</title>
        <description></description>
        <link>https://baszerr.eu/</link>
        <lastBuildDate>Wed, 08 Apr 2026 05:22:04 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://baszerr.eu/</link>
        </image>
        <item>
            <title>usmc</title>
            <link>https://baszerr.eu/doku.php?id=prjs:usmc:usmc</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;universal_stepper_motor_controller&quot;&gt;Universal Stepper Motor Controller&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=prjs%3Ausmc%3Ausmc&amp;amp;media=prjs:usmc:ready-to-go_system.jpg&quot; class=&quot;media&quot; title=&quot;prjs:usmc:ready-to-go_system.jpg&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=150&amp;amp;tok=bbec91&amp;amp;media=prjs:usmc:ready-to-go_system.jpg&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;ready-to-go system&quot; alt=&quot;ready-to-go system&quot; width=&quot;150&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=prjs%3Ausmc%3Ausmc&amp;amp;media=prjs:usmc:img_1892.jpg&quot; class=&quot;media&quot; title=&quot;prjs:usmc:img_1892.jpg&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=200&amp;amp;tok=a72633&amp;amp;media=prjs:usmc:img_1892.jpg&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;prototype board&quot; alt=&quot;prototype board&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;
some time ago my dad asked me to help him with controlling capacity of capacitor located on the roof. capacitor is to be used for fine-tuning amateur radio&amp;#039;s (ham radio) antenna that he uses. the key was to do it remotely, so that changing frequency would not require visiting the roof each time.
&lt;/p&gt;

&lt;p&gt;
what we&amp;#039;ve worked out is to use variable capacitor, rotated with stepper motor remotely. and so, the first step is to design and build stepper motor controller.
&lt;/p&gt;

&lt;p&gt;
whole USMC project is released under &lt;a href=&quot;https://en.wikipedia.org/wiki/BSD licenses&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/BSD licenses&quot;&gt;Revised BSD&lt;/a&gt; license, i.e. do what ever you want with it. :)
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Universal Stepper Motor Controller&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;universal_stepper_motor_controller&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;1-740&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;electronics&quot;&gt;electronics&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
there are 2 buttons to indicate left/right direction, turbo-switch that changes from step-by-step work to continues rotation (to move through wide ranges faster) and unipolar/bipolar jumper. signals are handled by &lt;a href=&quot;http://www.atmel.com/atmel/acrobat/doc0368.pdf&quot; class=&quot;urlextern&quot; title=&quot;http://www.atmel.com/atmel/acrobat/doc0368.pdf&quot; rel=&quot;ugc nofollow&quot;&gt;AT89C2051&lt;/a&gt; uC (from 8051 uC family) that generates proper signal sequences for &lt;a href=&quot;http://robotics.ee.uwa.edu.au/eyebot/doc/DataSheets/L293D.pdf&quot; class=&quot;urlextern&quot; title=&quot;http://robotics.ee.uwa.edu.au/eyebot/doc/DataSheets/L293D.pdf&quot; rel=&quot;ugc nofollow&quot;&gt;L293D&lt;/a&gt; stepper motor driver.
&lt;/p&gt;

&lt;p&gt;
logical schema (click to enlarge):
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=prjs%3Ausmc%3Ausmc&amp;amp;media=prjs:usmc:usmc_sch.png&quot; class=&quot;media&quot; title=&quot;prjs:usmc:usmc_sch.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=254b4f&amp;amp;media=prjs:usmc:usmc_sch.png&quot; class=&quot;mediacenter&quot; loading=&quot;lazy&quot; title=&quot;logical schema&quot; alt=&quot;logical schema&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
notice that it is VERY important to use L293D, not “raw” L293, since first one has internal diodes protecting lines from engine coils reverse induction voltage. to minimize number of elements in the circuit there are no diodes in discrete form, but L293D is a must!
&lt;/p&gt;

&lt;p&gt;
board schematic (click to enlarge):
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=prjs%3Ausmc%3Ausmc&amp;amp;media=prjs:usmc:usmc_brd.png&quot; class=&quot;media&quot; title=&quot;prjs:usmc:usmc_brd.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=4c44e6&amp;amp;media=prjs:usmc:usmc_brd.png&quot; class=&quot;mediacenter&quot; loading=&quot;lazy&quot; title=&quot;PCB print&quot; alt=&quot;PCB print&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
PCB elements&amp;#039; names view (click to enlarge):
&lt;a href=&quot;https://baszerr.eu/lib/exe/detail.php?id=prjs%3Ausmc%3Ausmc&amp;amp;media=prjs:usmc:usmc_names.png&quot; class=&quot;media&quot; title=&quot;prjs:usmc:usmc_names.png&quot;&gt;&lt;img src=&quot;https://baszerr.eu/lib/exe/fetch.php?w=400&amp;amp;tok=67e274&amp;amp;media=prjs:usmc:usmc_names.png&quot; class=&quot;mediacenter&quot; loading=&quot;lazy&quot; title=&quot;PCB element&amp;#039;s names&quot; alt=&quot;PCB element&amp;#039;s names&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
board, as designed, uses 24MHz oscillator. why? i just had plenty of them so i&amp;#039;ve used one. since code is not complicated and does not required high CPU power i&amp;#039;d expect it to work fine even with 1MHz oscillator, assuming delay_ms() function will be updated to new timings. feel free to experiment. if you&amp;#039;ll use different parameters, please let me know. :)
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;electronics&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;electronics&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;741-2098&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;software&quot;&gt;software&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
to control the device software in C has been prepared. &lt;a href=&quot;http://sdcc.sourceforge.net&quot; class=&quot;urlextern&quot; title=&quot;http://sdcc.sourceforge.net&quot; rel=&quot;ugc nofollow&quot;&gt;SDCC&lt;/a&gt; toolchain has been used to compile and link the code. in the download package proper makefiles are prepared so that simple &amp;#039;make&amp;#039; will generate binary and intel hex output files.
&lt;/p&gt;

&lt;p&gt;
code is decomposed into several modules, to make it easier to read and understand:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; usmc.c – main program loop&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; delay.c – call to generate delays in code&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; idle.c – support for idle mode&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; init.c – initialization procedures&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; interrupts.h – interruption procedures handles (used in usmc.c only!)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; motor.c – stepper motors (bipolar and unipolar) driver&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; uC.h – some uC-specific settings and includes, kept in one place&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
software uses uC&amp;#039;s idle mode when nothing is happening to keep power consumption as low as possible.
&lt;/p&gt;

&lt;p&gt;
to indicate that engine is moving LED is blinking shortly for each step made.
&lt;/p&gt;

&lt;p&gt;
to flash uC you can use linux tool &lt;a href=&quot;https://baszerr.eu/doku.php?id=prjs:ezdlin:ezdlin&quot; class=&quot;wikilink1&quot; title=&quot;prjs:ezdlin:ezdlin&quot; data-wiki-id=&quot;prjs:ezdlin:ezdlin&quot;&gt;EZDlin&lt;/a&gt;… or anything you want. :)
&lt;/p&gt;

&lt;p&gt;
though code is written in C, there is one inline assembler piece of code, that generates time delay (delay.c). when you&amp;#039;d like to change oscillator you must remember to update this call as well.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;software&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;software&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;2099-3301&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;download&quot;&gt;download&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
get latest version of &lt;a href=&quot;https://github.com/el-bart/universal_stepper_motor_controller&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/universal_stepper_motor_controller&quot; rel=&quot;ugc nofollow&quot;&gt;USMC&lt;/a&gt; via github. you can download stable version via &lt;a href=&quot;https://github.com/el-bart/universal_stepper_motor_controller/tags&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/universal_stepper_motor_controller/tags&quot; rel=&quot;ugc nofollow&quot;&gt;releases&lt;/a&gt; tab.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;download&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;download&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;3302-3551&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;further_improvements&quot;&gt;further improvements&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
what more can be done:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; add support for RS232 (or USB) communication with the computer.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; choose components so that it will be able to work in outdoor conditions (say: -40 to +100 degrees C).&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; update delay_ms() call from delay.c so that it will be easier to change oscillator in use.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; use persistent memory (EEPROM?) to save last position it was on when next power-on comes.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;further improvements&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_improvements&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;3552-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:52 +0000</pubDate>
        </item>
    </channel>
</rss>
