{"id":5204,"date":"2018-10-07T11:37:54","date_gmt":"2018-10-07T08:37:54","guid":{"rendered":"http:\/\/roboromania.ro\/?p=5204"},"modified":"2018-10-07T11:49:31","modified_gmt":"2018-10-07T08:49:31","slug":"cum-comandam-un-motor-dc-cu-un-tranzistor","status":"publish","type":"post","link":"https:\/\/roboromania.ro\/?p=5204","title":{"rendered":"Cum comandam un motor DC cu un tranzistor"},"content":{"rendered":"<h4><span style=\"color: #0000ff;\">Cum comandam un motor DC cu un tranzistor<\/span><\/h4>\n<p><a href=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5205\" src=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/1.jpg\" alt=\"1\" width=\"128\" height=\"121\" \/>\u00a0 <\/a><a href=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-5206\" src=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/2-300x157.jpg\" alt=\"2\" width=\"300\" height=\"157\" srcset=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/2-300x157.jpg 300w, https:\/\/roboromania.ro\/wp-content\/uploads\/2018\/10\/2.jpg 548w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>\u00a0 <\/a><a href=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2015\/09\/2n2222-roboromania-pini.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-983\" src=\"http:\/\/roboromania.ro\/wp-content\/uploads\/2015\/09\/2n2222-roboromania-pini.jpg\" alt=\"2n2222-roboromania-pini\" width=\"146\" height=\"146\" srcset=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2015\/09\/2n2222-roboromania-pini.jpg 200w, https:\/\/roboromania.ro\/wp-content\/uploads\/2015\/09\/2n2222-roboromania-pini-150x150.jpg 150w, https:\/\/roboromania.ro\/wp-content\/uploads\/2015\/09\/2n2222-roboromania-pini-180x180.jpg 180w\" sizes=\"auto, (max-width: 146px) 100vw, 146px\" \/><\/a><\/p>\n<p>Pentru a comanda un motor de curent continuu, ave\u021bi nevoie de o cantitate mai mare de curent dec\u00e2t poate da <a href=\"http:\/\/roboromania.ro\/produs\/placa-de-dezvoltare-uno-r3-placa-de-dezvoltare-compatibila-arduino\/\" target=\"_blank\">arduino<\/a>.<br \/>\nTrebuie s\u0103 utiliza\u021bi un tranzistor.<br \/>\nTranzistorul pe care \u00eel folosim pentru acest tutorial este <a href=\"http:\/\/roboromania.ro\/produs\/tranzistor-2n2222-npn-universal\/\" target=\"_blank\">2N2222<\/a> \u0219i este de 40V \u0219i 200mA, este perfect pentru un motor de juc\u0103rie.<br \/>\nNot\u0103: Cu acest cod ve\u021bi putea controla viteza motorului din &#8222;serial monitor&#8221;.<\/p>\n<p>Componente:<br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/placa-de-dezvoltare-uno-r3-placa-de-dezvoltare-compatibila-arduino\/\" target=\"_blank\">Arduino UNO<\/a><br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/breadboard\/\" target=\"_blank\">Breadboard<\/a><br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/rezistor-220%cf%89-5-bucati-pentru-montaje-electronice-compatibile-arduino\/\" target=\"_blank\">Rezistor de 220 Ohm<\/a><br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/tranzistor-2n2222-npn-universal\/\" target=\"_blank\">Tranzistor 2N2222<\/a><br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/dioda-1n4148\/\" target=\"_blank\">Dioda 1N4148<\/a><br \/>\n<a href=\"http:\/\/roboromania.ro\/produs\/motor-3-5v-140-toy-526\/\" target=\"_blank\">DC Motor<\/a><\/p>\n<p>Cod:<\/p>\n<p>\/\/ &#8211;&#8211;&#8211;&#8211;&#8211;<\/p>\n<p>\/\/Baza de la tranzistor la (Arduino PWM Digital) Pin 3<br \/>\nconst int motorPin = 3;<\/p>\n<p>int Speed; \/\/Variabila &#8222;Speed&#8221; PWM<br \/>\nint flag;<\/p>\n<p>void setup()<br \/>\n{<br \/>\npinMode(motorPin, OUTPUT); \/\/Set pin 3 as an OUTPUT<br \/>\nSerial.begin(9600); \/\/Init serial communication<br \/>\n\/\/Print a message:<br \/>\nSerial.println(&#8222;Scrie un numar de la\u00a0 50 la 255&#8221;);\u00a0\u00a0 \/\/De ce minimun 50, pentru ca altfel motorul se opreste<br \/>\nSerial.println(&#8222;&#8221;);<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\n\/\/Verifica daca se poate comunica peserial:<br \/>\nif (Serial.available() &gt; 0)<br \/>\n{<br \/>\n\/\/ Daca se scrie ceva pe serial:<br \/>\nSpeed = Serial.parseInt();<br \/>\nflag=0;<br \/>\n}<\/p>\n<p>\/\/Trimitere valida intre 50 si 255<br \/>\nif (Speed&gt;=50 &amp;&amp; Speed&lt;=255){<br \/>\n\/\/Trimite valoarea PWM la Pin3 spre tranzistor si mesaj pe monitor<br \/>\nanalogWrite(motorPin, Speed);<br \/>\n\/\/Print mesaj pe monitor o data<br \/>\nif (flag==0){<br \/>\n\/\/Print valoare PWM<br \/>\nSerial.print(&#8222;Motorul se invarte cu: &#8222;);<br \/>\nSerial.print(Speed);<br \/>\nSerial.println(&#8221; PWM&#8221;);<br \/>\nflag=1;<br \/>\n}<br \/>\n}<br \/>\ndelay(1000);<br \/>\n}<\/p>\n<p>\/\/ &#8211;&#8211;&#8211;&#8211;-<\/p>\n<p><span style=\"color: #0000ff;\">Succes!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cum comandam un motor DC cu un tranzistor \u00a0 \u00a0 Pentru a comanda un motor de curent continuu, ave\u021bi nevoie de o cantitate mai mare de curent dec\u00e2t poate da arduino. Trebuie s\u0103 utiliza\u021bi un tranzistor. Tranzistorul pe care \u00eel folosim pentru acest tutorial este 2N2222 \u0219i este de 40V \u0219i 200mA, este perfect pentru [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[176],"tags":[],"class_list":["post-5204","post","type-post","status-publish","format-standard","hentry","category-tutoriale-arduino"],"_links":{"self":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/posts\/5204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5204"}],"version-history":[{"count":4,"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/posts\/5204\/revisions"}],"predecessor-version":[{"id":5210,"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/posts\/5204\/revisions\/5210"}],"wp:attachment":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}