Пускане На 20BYJ-46 12V Стъпков Мотор / Run 20BYJ-46 12V Step Motor
by batvanio in Circuits > Arduino
620 Views, 0 Favorites, 0 Comments
Пускане На 20BYJ-46 12V Стъпков Мотор / Run 20BYJ-46 12V Step Motor

Пускане На 20BYJ-46 12V Стъпков Мотор / Run 20BYJ-46 12V Step Motor
Supplies





20BYJ-46 12V, Arduino Nano, ULN2003 драйвер за стъпков мотор, Захранващ адаптер 9V (не повече от 1А ток), Джъмпер кабели, mini USB кабел
20BYJ-46 12V, Arduino Nano, ULN2003 stepper motor driver, Power adapter 9V (Not more than 1A current), jumperscable, mini USB cable
Свързване / Connection

Свържете компонентите по схемата от снимката
Connect the components according to the diagram in the photo
Свързване На Ардуино / Arduino Connection


Свържете Ардуиното с УСБ кабела към компютъра.
Connect the Arduino with the USB cable to the computer.
Пуснете програмата Arduino IDE и я настройте спрямо вашите данни.
Run the Arduino IDE program and set it to your data.
Ако не знаете кой порт използва отворете Управление на компютъра
If you don't know which port it uses, open Computer Management
Ако не знаете къде е отворете някоя папка, в полето горе напишете това в кавичките, но без тях "compmgmt.msc /s" и натиснете Ентер
If you don't know where a folder is, open a folder, in the field above write this in quotes, but without them "compmgmt.msc /s" and press Enter
Натиснете отляво на Диспечер на устройства, а от дясно на Портове
Click on Device Manager on the left and Ports on the right
Порта на Ардуиното е USB-SERIAL CH340
It's an Arduino port USB-SERIAL CH340
Програмиране / Programming
Ако не сте сигурни, проверете и ако е необходимо, инсталирайте библиката, която е необходима. Намира се в менюто инструменти, управление на библютеки. Потърсете "Stepper" и ако не е инсталирана я инсталирайте.
If you are not sure, check and if necessary install the bible that is needed. It's under the Tools menu, Library Management. Look for "Stepper" and if not installed install it.
Изтрийте въведеният код и поставете този по долу или го заредете от прикаченият файл.
Delete the entered code and paste the one below or load it from the attached file.
#include <Stepper.h>
const int stepsPerRevolution = 2048;
// Около 5.688 градуса на стъпка / About 5.688 degrees per step
// 2048 - 360 градуса / 2048 - 360 degrees
// Определяне пиновете от 8 до 11 за библютеката
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 11, 9, 10, 8 );
void setup() {
// определяне на скороста от ~9 оборота в минута
// set the speed at 60 rpm:
myStepper.setSpeed(9);
// инитализиране на серииният порт
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// Стъпка в едната посока
// step one revolution in one direction:
Serial.println("clockwise"); // по часовника
myStepper.step(stepsPerRevolution);
delay(500); // изчакване в милисекунди / wait in milliseconds
// Стъпка в другата посока
// step one revolution in the other direction:
Serial.println("counterclockwise"); // обратно на часовникя
myStepper.step(-stepsPerRevolution);
delay(500); // изчакване в милисекунди / wait in milliseconds
}
Downloads
Качване На Програмата / Upload the Program

Натиснете на кръгчето с отметка под менюто за проверка на файла и ако всичко е наред кръгът със стрелка на дясно за качване. При избраните настройки достига максималната си скорост от около 9 оборота за минута. Това е.
Click on the circle with a checkmark under the menu to check the file and if everything is OK click on the arrow on the right to upload. At the selected settings, it reaches its maximum speed of about 9 revolutions per minute. It is.