{"id":11321,"date":"2023-10-12T14:10:42","date_gmt":"2023-10-12T11:10:42","guid":{"rendered":"https:\/\/learn.groundstudio.eu\/?p=11321"},"modified":"2024-08-06T14:18:10","modified_gmt":"2024-08-06T11:18:10","slug":"l298n-motor-driver-stepper-motor-control","status":"publish","type":"post","link":"https:\/\/learn.groundstudio.eu\/ro\/l298n-motor-driver-stepper-motor-control\/","title":{"rendered":"L298N  - Controlul motoarelor pas cu pas"},"content":{"rendered":"<div data-post-id=\"11972\" class=\"insert-page insert-page-11972\"><h1 class='insert-page-title'>Introducere<\/h1><\/div>\n\n\n<p>Motoarele pas cu pas se g\u0103sesc \u00een aplica\u021bii extinse \u00een diverse domenii, inclusiv \u00een ma\u0219ini de cusut, prese pentru tip\u0103rire, dispozitive de imagistic\u0103 medical\u0103, ma\u0219ini CNC \u0219i multe alte tipuri de echipamente. Cu toate acestea, controlul eficient al motoarelor pas cu pas necesit\u0103 o \u00een\u021belegere aprofundat\u0103, deoarece fiecare ma\u0219in\u0103 necesit\u0103 adesea proiectare \u0219i gestionare personalizate. Pentru a aborda aceast\u0103 provocare, s-au dezvoltat o serie de drivere pentru motoare, \u00eembun\u0103t\u0103\u021bind precizia \u0219i controlul motoarelor cu curent continuu prin intermediul microcontrolerelor precum Arduino.<\/p>\n\n\n\n<p>\u00cen acest tutorial, vom demonstra interconectarea unui motor pas cu pas cu un driver de motor L298N, folosind o plac\u0103 de dezvoltare.<\/p>\n\n\n\n<p>Modulul Driver de Motor L298N const\u0103 \u00eentr-un circuit integra L298N \u0219i un regulator de tensiune 78M05. Regulatorul de tensiune 78M05 se activeaz\u0103 numai atunci c\u00e2nd este plasat un jumper. Atunci c\u00e2nd tensiunea sursei de alimentare este de 12V sau mai mic\u0103, regulatorul de tensiune furnizeaz\u0103 energie circuitului intern, iar pinul 5V poate fi folosit ca ie\u0219ire pentru a alimenta microcontrolerul. \u00cen cazurile \u00een care tensiunea sursei de alimentare dep\u0103\u0219e\u0219te 12V, jumper-ul trebuie \u00eenl\u0103turat, iar o surs\u0103 separat\u0103 de 5V trebuie conectat\u0103 la conectorul 5V pentru a alimenta circuitul intern.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.34%\">\n<p><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.34%\">\n<figure class=\"wp-block-image aligncenter size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"500\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1.jpg\" alt=\"\" class=\"wp-image-11323\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1.jpg 500w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-12x12.jpg 12w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/ardushop.ro\/ro\/electronica\/84-l298n-punte-h-dubla-dual-h-bridge-motor-dcsteppe.html\">\ud83d\uded2 Cump\u0103r\u0103<\/a><\/div>\n<\/div>\n\n\n\n<p>L298N stepper motor driver<\/p>\n<\/div>\n<\/div>\n\n\n<div data-post-id=\"12338\" class=\"insert-page insert-page-12338\"><h1 class='insert-page-title'>Hardware necesar<\/h1><\/div>\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Nume <\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Detalii<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Imagine<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Cantitate<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Jade Uno+ <br>GroundStudio<\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11334\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/groundstudio-jade-uno-plus-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/2653-groundstudio-jade-uno-plus.html','_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button> <\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Cablu USB<\/td><td class=\"has-text-align-center\" data-align=\"center\">Type C<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11333\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/cablu-usb-tip-c-1m-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/1830-cablu-usb-tip-c-1m.html','_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Fire jumper<\/td><td class=\"has-text-align-center\" data-align=\"center\">mam\u0103-tat\u0103<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11332\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/10-x-fire-dupont-mama-tata-20cm-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">4<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/291-10-x-fire-dupont-mama-tata-20cm.html',_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Driver de motor<\/td><td class=\"has-text-align-center\" data-align=\"center\">L298N<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11323\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1.jpg 500w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/Motor_Driver_Module_L298N__For_Arduino_Stepper_Motor_Dual_H_Bridge_Motor_Driver-1-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/291-10-x-fire-dupont-mama-tata-20cm.html',_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Motor pas cu pas<\/td><td class=\"has-text-align-center\" data-align=\"center\">Nema17<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11336\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/motor-pas-cu-pas-nema17-18-grade-18a-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/printare-3d\/103-motor-pas-cu-pas-nema17-18-grade-18a.html',_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Surs\u0103 de alimentare<\/td><td class=\"has-text-align-center\" data-align=\"center\">12V<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11338\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/sursa-alimentare-12v-3a-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/517-sursa-alimentare-12v-3a.html',_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Adaptor<\/td><td class=\"has-text-align-center\" data-align=\"center\">mam\u0103<\/td><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-11340\" style=\"width: 150px;\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare.jpg\" alt=\"\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare.jpg 900w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare-300x300.jpg 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare-150x150.jpg 150w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare-768x768.jpg 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/pereche-mufe-alimentare-12x12.jpg 12w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/td><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\"><button onclick=\"window.open('https:\/\/ardushop.ro\/home\/365-pereche-mufe-alimentare.html',_blank')\">\ud83d\uded2 Cump\u0103r\u0103<\/button><\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><\/div>\n\n\n<div data-post-id=\"12373\" class=\"insert-page insert-page-12373\"><h1 class='insert-page-title'>Diagrama circuitului<\/h1><\/div>\n\n\n<figure class=\"wp-block-image aligncenter size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"337\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-1024x337.png\" alt=\"cover\" class=\"wp-image-11451\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-1024x337.png 1024w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-300x99.png 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-768x253.png 768w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-1536x506.png 1536w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2-18x6.png 18w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2023\/10\/frz_l298nnema_jadeuno3-2.png 1760w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n<div data-post-id=\"12379\" class=\"insert-page insert-page-12379\"><h1 class='insert-page-title'>Tabelul de conexiuni<\/h1><\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>L298N driver de motor<\/strong><\/td><td><strong>Conexiune<\/strong><\/td><\/tr><tr><td>GND<\/td><td>Conectorul de alimentare si GND-ul pl\u0103cu\u021bei<\/td><\/tr><tr><td>jumper 12V<\/td><td>Remove if motor voltage &gt; 12 V!<\/td><\/tr><tr><td>5V+ (optional)<\/td><td>5V-ul pl\u0103cu\u021bei, dac\u0103 jumperul de 12V e scos<\/td><\/tr><tr><td>IN1<\/td><td>Pinul 8 al pl\u0103cu\u021bei<\/td><\/tr><tr><td>IN2<\/td><td>Pinul 9 al pl\u0103cu\u021bei<\/td><\/tr><tr><td>IN3<\/td><td>Pinul 10 al pl\u0103cu\u021bei<\/td><\/tr><tr><td>IN4<\/td><td>Pinul 11 al pl\u0103cu\u021bei<\/td><\/tr><tr><td>Jumperul ENA \u0219i ENB<\/td><td>Instalat<\/td><\/tr><tr><td>OUT1 + OUT2<\/td><td>Bobina A a motorului<\/td><\/tr><tr><td>OUT3 + OUT4<\/td><td>Bobina B a motorului<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"669\" src=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2024\/01\/L298N-pinout-1.png\" alt=\"\" class=\"wp-image-12032\" srcset=\"https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2024\/01\/L298N-pinout-1.png 759w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2024\/01\/L298N-pinout-1-300x264.png 300w, https:\/\/learn.groundstudio.eu\/wp-content\/uploads\/2024\/01\/L298N-pinout-1-14x12.png 14w\" sizes=\"auto, (max-width: 759px) 100vw, 759px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Not\u0103 important\u0103: scoate\u021bi jumperul de +12V dac\u0103 utiliza\u021bi o surs\u0103 de alimentare cu o tensiune mai mare de 12 V.<\/strong><\/p>\n\n\n\n<p>C\u00e2nd jumper-ul +12V este conectat, regulatorul de tensiune de pe modul este activat \u0219i va furniza tensiunea logic\u0103 de 5 V. C\u00e2nd \u00eenl\u0103tura\u021bi jumper-ul, trebuie s\u0103 furniza\u021bi modulului 5V de la Arduino.<\/p>\n\n\n\n<p>De asemenea, trebuie s\u0103 p\u0103stra\u021bi jumper-ele ENA \u0219i ENB montate pentru a v\u0103 asigura c\u0103 motorul este \u00eentotdeauna activat.<\/p>\n\n\n<div data-post-id=\"12385\" class=\"insert-page insert-page-12385\"><h1 class='insert-page-title'>Codul Arduino<\/h1><\/div>\n\n\n<p>Pute\u021bi \u00eenc\u0103rca urm\u0103torul cod de exemplu pe plac\u0103 folosind:&nbsp;<a href=\"https:\/\/www.arduino.cc\/en\/main\/software\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE<\/a>.<\/p>\n\n\n\n<p>Acest exemplu utilizeaz\u0103 libr\u0103ria&nbsp;<strong>Stepper.h<\/strong>&nbsp;care ar trebui s\u0103 fie preinstalat\u0103 \u00een mediul Arduino IDE. O pute\u021bi g\u0103si merg\u00e2nd la&nbsp;<strong>Sketch &gt; Include Library &gt; Stepper<\/strong>.<\/p>\n\n\n\n<p>Acest sketch rote\u0219te motorul pas cu pas cu o revolu\u021bie \u00eentr-o direc\u021bie, face o pauz\u0103 \u0219i apoi rote\u0219te o revolu\u021bie \u00een cealalt\u0103 direc\u021bie.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Codul de exemplu al bibliotecii Stepper.h pentru driverul L298N pentru motor pas cu pas \u0219i Arduino<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background\" style=\"border-width:6px;background-color:#243447\"><code>\/* Example sketch to control a stepper motor with L298N motor driver, a development board and Stepper.h library.\n\n\/\/ Include the Stepper library:\n#include &lt;Stepper.h&gt;\n\n\/\/ Define number of steps per revolution:\nconst int stepsPerRevolution = 200;\n\n\/\/ Initialize the stepper library on pins 8 through 11:\nStepper myStepper = Stepper(stepsPerRevolution, 8, 9, 10, 11);\n\nvoid setup() {\n  \/\/ Set the motor speed (RPMs):\n  myStepper.setSpeed(100);\n}\n\nvoid loop() {\n  \/\/ Step one revolution in one direction:\n  myStepper.step(200);\n\n  delay(2000);\n\n  \/\/ Step one revolution in the other direction:\n  myStepper.step(-200);\n\n  delay(2000);\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Explicarea codului<\/h2>\n\n\n\n<p>The sketch starts by including the Stepper.h Arduino library.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Include the Stepper library:\n#include &lt;Stepper.h&gt;<\/code><\/pre>\n\n\n\n<p>Urm\u0103torul pas const\u0103 \u00een definirea num\u0103rului de pa\u0219i necesari pentru ca motorul s\u0103 execute o revolu\u021bie complet\u0103. \u00cen acest exemplu, vom folosi motorul \u00een&nbsp;<strong>full-step mode<\/strong>. Acest lucru \u00eenseamn\u0103 c\u0103 sunt necesari 200 de pa\u0219i pentru a roti motorul cu 360 de grade. Pute\u021bi schimba aceast\u0103 valoare dac\u0103 utiliza\u021bi un alt tip de motor pas cu pas sau o alt\u0103 configura\u021bie.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Define number of steps per revolution:\nconst int stepsPerRevolution = 200;<\/code><\/pre>\n\n\n\n<p>Apoi, trebuie s\u0103 crea\u021bi o nou\u0103 instan\u021b\u0103 a clasei Stepper, care reprezint\u0103 un anumit motor pas cu pas conectat la Arduino. Pentru aceasta, folosim func\u021bia&nbsp;<code>Stepper(steps, pin1, pin2, pin3, pin4)<\/code>&nbsp;unde steps este num\u0103rul de pa\u0219i per revolu\u021bie \u0219i pin1 p\u00e2n\u0103 la pin4 sunt pinii utiliza\u021bi pentru a controla motorul pas cu pas. \u00cen cazul nostru, ace\u0219tia sunt pinii 8, 9, 10 \u0219i 11.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Initialize the stepper library on pins 8 through 11:\nStepper myStepper = Stepper(stepsPerRevolution, 8, 9, 10, 11);<\/code><\/pre>\n\n\n\n<p>\u00cen acest caz, am numit motorul pas cu pas \"myStepper\", dar pute\u021bi folosi \u0219i alte denumiri, cum ar fi \"z_motor\" sau \"liftmotor\", etc.&nbsp;<code>Stepper liftmotor = Stepper(stepsPerRevolution, 8, 9, 10, 11);<\/code>Numele \"myStepper\" va fi utilizat pentru a seta viteza \u0219i num\u0103rul de pa\u0219i pentru acest motor \u00een particular. Re\u021bine\u021bi c\u0103 pute\u021bi crea mai multe obiecte stepper cu denumiri diferite dac\u0103 dori\u021bi s\u0103 controla\u021bi mai multe motoare.<\/p>\n\n\n\n<p>\u00cen&nbsp;<code>setup()<\/code>&nbsp;definim viteza motorului. Pute\u021bi seta viteza motorului \u00een&nbsp;<strong>RPM<\/strong>&nbsp;cu func\u021bia&nbsp;<kbd>setSpeed(rpm)<\/kbd>. O voi seta la 100, a\u0219adar ar trebui s\u0103 vedem aproximatix 1.6 rota\u021bii pe secunda<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \/\/ Set the motor speed (RPMs):\n  myStepper.setSpeed(100);<\/code><\/pre>\n\n\n\n<p>\u00cen sec\u021biunea loop a codului, apel\u0103m pur \u0219i simplu&nbsp;<code>step(steps)<\/code>&nbsp;func\u021bia care rote\u0219te motorul cu un num\u0103r specific de pa\u0219i la o vitez\u0103 determinat\u0103 de func\u021bia&nbsp;<code>setSpeed(rpm)<\/code>&nbsp;.Transmiterea unui num\u0103r negativ la aceast\u0103 func\u021bie inverseaz\u0103 direc\u021bia de rota\u021bie a motorului.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void loop() {\n  \/\/ Step one revolution in one direction:\n  myStepper.step(200);\n\n  delay(2000);\n\n  \/\/ Step on revolution in the other direction:\n  myStepper.step(-200);\n\n  delay(2000);\n}<\/code><\/pre>\n\n\n\n<p>\u021aine\u021bi cont c\u0103 func\u021bia&nbsp;<strong>step(steps)<\/strong>&nbsp;function is&nbsp;<strong>blocking<\/strong>, this means it will wait until the motor has finished moving to pass control to the next line in your sketch.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Aplica\u021bii \u0219i utiliz\u0103ri<\/h2>\n\n\n\n<p>Motoarele pas cu pas sunt utilizate pe scar\u0103 larg\u0103 \u00een diverse aplica\u021bii care necesit\u0103 control precis al mi\u0219c\u0103rii de rota\u021bie. Iat\u0103 o scurt\u0103 descriere a unor aplica\u021bii comune ale motoarelor pas cu pas:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\" translation-block\"><strong>Imprimare 3D:<\/strong> Motoarele pas cu pas sunt folosite pentru a controla mi\u0219carea capului de imprimare \u0219i a platformei de construc\u021bie \u00een imprimantele 3D, asigur\u00e2nd imprimarea strat cu strat cu precizie.<\/li>\n\n\n\n<li><strong>Ma\u0219ini CNC:<\/strong>Motoarele pas cu pas conduc mi\u0219carea sculelor de t\u0103iere \u0219i a pieselor de lucru \u00een ma\u0219inile de control numeric computerizat (CNC), asigur\u00e2nd opera\u021bii de prelucrare precise.<\/li>\n\n\n\n<li><strong>Robotic\u0103:<\/strong>Motoarele pas cu pas joac\u0103 un rol crucial \u00een mi\u0219carea \u0219i pozi\u021bionarea bra\u021belor, articula\u021biilor \u0219i altor componente ale robo\u021bilor, permi\u021b\u00e2nd mi\u0219care precis\u0103 \u0219i controlat\u0103.<\/li>\n\n\n\n<li><strong>Ma\u0219in\u0103rii pentru textile:<\/strong>\u00cen industria textil\u0103, motoarele pas cu pas controleaz\u0103 mi\u0219carea diverselor elemente, precum fusurile, rolele \u0219i dispozitivele de alimentare a \u021bes\u0103turilor, permi\u021b\u00e2nd crearea de modele de \u021bes\u0103turi complexe.<\/li>\n\n\n\n<li><strong>Echipamente pentru Fotografie \u0219i Camere Video:<\/strong>Motoarele pas cu pas sunt folosite \u00een mecanismele de focalizare automat\u0103, lentilele cu zoom \u0219i sistemele de panoramare a camerelor, asigur\u00e2nd pozi\u021bionarea \u0219i mi\u0219carea precise.<\/li>\n\n\n\n<li><strong>Aparatur\u0103 medical\u0103:<\/strong>Motoarele pas cu pas se g\u0103sesc \u00een echipamentele de imagistic\u0103 medical\u0103, precum aparatele de rezonan\u021b\u0103 magnetic\u0103 (MRI) \u0219i tomografele computerizate (CT), unde mi\u0219carea precis\u0103 este esen\u021bial\u0103 pentru imagini de \u00eenalt\u0103 calitate.<\/li>\n\n\n\n<li><strong>Sisteme automate:<\/strong>Motoarele pas cu pas sunt utilizate \u00een sisteme automate pentru sarcini precum controlul benzilor transportoare, ambalarea \u0219i manipularea materialelor.<\/li>\n\n\n\n<li><strong>Telescoape \u0219i Astronomie:<\/strong>Motoarele pas cu pas permit urm\u0103rirea \u0219i pozi\u021bionarea precise \u00een telescoape, monturi ecuatoriale \u0219i alte echipamente de astronomie.<\/li>\n\n\n\n<li><strong>Biotehnologie \u0219i Echipamente de Laborator:<\/strong>Motoarele pas cu pas sunt utilizate \u00een automatizarea laboratoarelor, cum ar fi pipetarea \u0219i manipularea probelor \u00een cercetarea medical\u0103 \u0219i biotehnologie.<\/li>\n\n\n\n<li><strong>Motoarele pas cu pas se g\u0103sesc \u00een diferite dispozitive pentru consumatori, inclusiv unit\u0103\u021bile de DVD, imprimantele 3D \u0219i sistemele de automatizare a locuin\u021bei.<\/strong>: Stepper motors are found in various consumer devices, including DVD drives, 3D printers, and home automation systems.<\/li>\n\n\n\n<li><strong>Automotive<\/strong>: Motoarele pas cu pas controleaz\u0103 mi\u0219carea \u00een camerele de securitate, sistemele pan-tilt-zoom (PTZ) \u0219i sistemele de control al accesului.<\/li>\n\n\n\n<li class=\" translation-block\"><strong>Sisteme de Securitate:<\/strong> Motoarele pas cu pas controleaz\u0103 mi\u0219carea \u00een camerele de securitate, sistemele pan-tilt-zoom (PTZ) \u0219i sistemele de control al accesului.<\/li>\n<\/ol>\n\n\n\n<p>Motoarele pas cu pas sunt apreciate pentru abilitatea lor de a se deplasa \u00een pa\u0219i preci\u0219i \u0219i discre\u021bi, ceea ce le face potrivite pentru aplica\u021bii \u00een care exactitatea \u0219i controlul sunt esen\u021biale. Versatilitatea \u0219i fiabilitatea lor le fac componente-cheie \u00een diverse industrii.<\/p>","protected":false},"excerpt":{"rendered":"<p>L298N + Nema17 stepper + development board + Arduino code<\/p>","protected":false},"author":2,"featured_media":12039,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_layout":"no_sidebar_content_centered","footnotes":""},"categories":[18,16],"tags":[],"class_list":["post-11321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-connectingexamples","category-tutorials"],"_links":{"self":[{"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/posts\/11321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/comments?post=11321"}],"version-history":[{"count":0,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/posts\/11321\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/media\/12039"}],"wp:attachment":[{"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/media?parent=11321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/categories?post=11321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learn.groundstudio.eu\/ro\/wp-json\/wp\/v2\/tags?post=11321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}