<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=The_Use_of_DC_Motor</id>
		<title>The Use of DC Motor - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=The_Use_of_DC_Motor"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=The_Use_of_DC_Motor&amp;action=history"/>
		<updated>2026-04-21T20:34:18Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=The_Use_of_DC_Motor&amp;diff=11130&amp;oldid=prev</id>
		<title>1304410487@qq.com：Created page with &quot; {| style=&quot;width: 800px;&quot; |- | ==Outline== N20 direct current speed reduction motor: Compared with the ordinary DC motor, it is equipped with gear speed reduction box, which o...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=The_Use_of_DC_Motor&amp;diff=11130&amp;oldid=prev"/>
				<updated>2015-10-29T08:08:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Outline== N20 direct current speed reduction motor: Compared with the ordinary DC motor, it is equipped with gear speed reduction box, which o...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Outline==&lt;br /&gt;
N20 direct current speed reduction motor: Compared with the ordinary DC motor, it is equipped with gear speed reduction box, which offers lower rotation rate and larger torque, enhancing the use rate of the DC motor in the automation industry.   &lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
=== Speed Reduction DC Motor===&lt;br /&gt;
*Electrical specification &lt;br /&gt;
**Operation voltage: 5V&lt;br /&gt;
*Tech parameters&lt;br /&gt;
**Rotation rate: 200 r/min &lt;br /&gt;
**Driven by [[mCookie-Motor]]&lt;br /&gt;
==Development==&lt;br /&gt;
===Equipment===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Module||Number||Function &lt;br /&gt;
|-&lt;br /&gt;
|[[mCookie-CoreUSB]]||1||Core board &lt;br /&gt;
|-&lt;br /&gt;
|[[mCookie-Motor]]||1||DC motor drive board &lt;br /&gt;
|-&lt;br /&gt;
|[[mCookie-BM]]||1||Power supply &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*Other Hardware Equipment &lt;br /&gt;
**DC motor &lt;br /&gt;
**One USB cable  &lt;br /&gt;
[[File:module-n20.jpg|600px|center]]&lt;br /&gt;
&lt;br /&gt;
=== Wire Connection of DC Motor ===&lt;br /&gt;
*Connect a DC motor to (OUT1A，OUT1B) and the other motor to (OUT2A，OUT2B); &lt;br /&gt;
*DC motor control pin: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//(D6,D8) controls (1A,1B) motor &lt;br /&gt;
#define OUT1A 6&lt;br /&gt;
#define OUT1B 8&lt;br /&gt;
//(D5,D7) controls (2A,2B) motor  &lt;br /&gt;
#define OUT2A &lt;br /&gt;
#define OUT2B 7&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Preparation &lt;br /&gt;
*Setup 1：Connect a motor to the Motor module as the diagram showed above; &lt;br /&gt;
[[File: _304_DozingDonkey _Motor.jpg|600px|center]]&lt;br /&gt;
*Setup 2：You can install accessories in the motor and the axis according to project needs, and then fix them on other materials. &lt;br /&gt;
[[File: _304_DozingDonkey _Motor1.jpg|400px|center]]&lt;br /&gt;
*Setup 3：Connect the activated battery box with BM module. &lt;br /&gt;
[[File:CoreUSB_Ble_steup2.jpg|600px|center]]&lt;br /&gt;
*Setup 4：Connect all devices to a computer with a USB cable.&lt;br /&gt;
[[file:mCookie-n20-pc.JPG|600px|center]]&lt;br /&gt;
&lt;br /&gt;
===Experiment 1: Connection and disconnection control ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! rowspan=&amp;quot;1&amp;quot; |6||8||5||7||1A||1B||2A||2B||Function&lt;br /&gt;
|-&lt;br /&gt;
|Low||Low||Low||Low||Off||Off||Off||Off||Close (Stop habitually) &lt;br /&gt;
|-&lt;br /&gt;
|High||Low||High||Low||High||Low||High||Low||Rotate clockwise&lt;br /&gt;
|-&lt;br /&gt;
|Low||High||Low||High||Low||High||Low||High||Rotate counter clockwise &lt;br /&gt;
|-&lt;br /&gt;
|High||High||High||High||Low||Low||Low||Low||Halt &lt;br /&gt;
|}&lt;br /&gt;
*Open Arduino IDE and copy the following codes to IDE. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define OUT1A 6&lt;br /&gt;
#define OUT1B 8&lt;br /&gt;
#define OUT2A 5&lt;br /&gt;
#define OUT2B 7&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  pinMode(OUT1A, OUTPUT);&lt;br /&gt;
  pinMode(OUT1B, OUTPUT);&lt;br /&gt;
  pinMode(OUT2A, OUTPUT);&lt;br /&gt;
  pinMode(OUT2B, OUTPUT);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
head();&lt;br /&gt;
delay(2000);&lt;br /&gt;
back();&lt;br /&gt;
delay(1000);&lt;br /&gt;
stop();&lt;br /&gt;
delay(500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void head()&lt;br /&gt;
{&lt;br /&gt;
  digitalWrite(OUT1A, HIGH);&lt;br /&gt;
  digitalWrite(OUT1B, LOW);&lt;br /&gt;
  digitalWrite(OUT2A, HIGH);&lt;br /&gt;
  digitalWrite(OUT2B, LOW);&lt;br /&gt;
}&lt;br /&gt;
void back()&lt;br /&gt;
{&lt;br /&gt;
  digitalWrite(OUT1A, LOW);&lt;br /&gt;
  digitalWrite(OUT1B, HIGH);&lt;br /&gt;
  digitalWrite(OUT2A, LOW);&lt;br /&gt;
  digitalWrite(OUT2B, HIGH);&lt;br /&gt;
}&lt;br /&gt;
void stop()&lt;br /&gt;
{&lt;br /&gt;
  digitalWrite(OUT1A, LOW);&lt;br /&gt;
  digitalWrite(OUT1B, LOW);&lt;br /&gt;
  digitalWrite(OUT2A, LOW);&lt;br /&gt;
  digitalWrite(OUT2B, LOW);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* Select the right port from Tools→Serial Port in Arduino IDE after compiling, then download program. &lt;br /&gt;
 [[file:upload.JPG|500px|center]]&lt;br /&gt;
*After download, you'll see the DC motor rotates forward 2s, reverse 1s and stops for 0.55s.&lt;br /&gt;
&lt;br /&gt;
===Debugging==&lt;br /&gt;
*Control the rotation of the motor by the &amp;quot; digitalWrite(pin, xx);&amp;quot; function outputting high and low level signals. &lt;br /&gt;
&lt;br /&gt;
===Experiment 2: PWM Motor Speed Control===&lt;br /&gt;
* Open Arduino IDE and copy the following codes to IDE.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//( D6，D8) controls motor (1A，1B) &lt;br /&gt;
#define OUT1A 6&lt;br /&gt;
#define OUT1B 8&lt;br /&gt;
//( D5，D7) controls motor (2A，2B) &lt;br /&gt;
#define OUT2A 5&lt;br /&gt;
#define OUT2B 7&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  pinMode(OUT1A, OUTPUT);&lt;br /&gt;
  pinMode(OUT1B, OUTPUT);&lt;br /&gt;
  pinMode(OUT2A, OUTPUT);&lt;br /&gt;
  pinMode(OUT2B, OUTPUT);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
  for (int fadeValue = 0; fadeValue &amp;lt;= 255; fadeValue += 5)&lt;br /&gt;
    //Loop statement. Along with PWM rate increases, you can change brightness level by controlling fadeValue. &lt;br /&gt;
  {&lt;br /&gt;
    analogWrite(OUT1A, fadeValue);  //Write rate level into the motor &lt;br /&gt;
    digitalWrite(OUT1B, LOW);&lt;br /&gt;
    analogWrite(OUT2A, fadeValue);&lt;br /&gt;
    digitalWrite(OUT2B, LOW);&lt;br /&gt;
    delay(100);                       //Delay time of rate. (The unit is ms)&lt;br /&gt;
  }&lt;br /&gt;
  for (int fadeValue = 255; fadeValue &amp;gt;= 0; fadeValue -= 5)&lt;br /&gt;
    // Loop statement. Along with PWM rate decreases, you can change brightness level by controlling fadeValue.&lt;br /&gt;
  {&lt;br /&gt;
    digitalWrite(OUT1A, LOW);&lt;br /&gt;
    analogWrite(OUT1B, fadeValue);  // Write rate level into the motor&lt;br /&gt;
    digitalWrite(OUT2A, LOW);&lt;br /&gt;
    analogWrite(OUT2B, fadeValue);&lt;br /&gt;
    delay(100);                     // Delay time of rate. (The unit is ms)&lt;br /&gt;
  }&lt;br /&gt;
  delay(1000);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* Select the right port from Tools→Serial Port in Arduino IDE after compiling, then download program. &lt;br /&gt;
 [[file:upload.JPG|500px|center]]&lt;br /&gt;
*Open the serial monitor after download and input angle (0-180) in the serial input box, then click &amp;quot;Send&amp;quot;. &lt;br /&gt;
[[file:serial-.JPG|500px|center]]&lt;br /&gt;
*From the result you can see that the speed is increasingly fast to the upmost and then slow download and finally circulates. &lt;br /&gt;
===Program Debugging===&lt;br /&gt;
*Adopt &amp;quot;for&amp;quot; function to control cyclic speed change  &lt;br /&gt;
*Adopt &amp;quot; analogWrite(pin, XX);&amp;quot; function to control speed.  &lt;br /&gt;
**pin: It has to be PWM control pin, which can be D5,D6,D7,D8 for mCookie-CoreUSB. &lt;br /&gt;
**XX: The value range is 0-225. The larger is value is, the quicker the speed becomes. ==Project==&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>1304410487@qq.com</name></author>	</entry>

	</feed>