Controling 28BYJ-48 Stepper Motor With Arduino and Fly Sky

by MalinaPl in Circuits > Arduino

291 Views, 0 Favorites, 0 Comments

Controling 28BYJ-48 Stepper Motor With Arduino and Fly Sky

370590289_816356826636207_6739648332810682574_n.jpg
356595092_1405780603325193_1864629879970578448_n.jpg

Hello. I've made this circuit for my RC Sailing model. My goal was to precisly rotate the masts of the model with adjustable speed. I decide to use 28BJ-48 Stepper motor and uln 2003 Driver. Rc ransmiter i used is flysky Fs-i6X and FS 10IAB receiver. You will need also Arduino board. I used arduino nano.

Supplies

-Fly sky-I6X transmitter

-FS 10IAB reciver

-28BJ-48 Stepper motor

-uln 2003 Driver

-Arduino Nano

-5 v power supply, or any other and 5 v regulator.

Code

Arduino.jpg

The code is simple, it only uses 5 pins on the arduino board. Library "Stepper.h" is used.

Pin Number 3 is responsible for reading data from the Rc transmitter. Pins 8,9,10,11 control the operation of stepper motors.


#include <Stepper.h>

const int stepsPerRevolution = 2038;

int channel_2 = 3;  // pin to connect receiver


Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11); //pins to stepper controler

void setup()

{

  pinMode(channel_2, INPUT);

 


  Serial.begin(9600);

}


void loop() {

 


  int value = pulseIn(channel_2, HIGH, 25000);

 

  if(value==0)

  {

  myStepper.setSpeed(0); //standby

  myStepper.step(0);

   

  }

 

  else if(value > 1800)  //rotate cw

  {

     

      myStepper.setSpeed(10);

  myStepper.step(stepsPerRevolution);


  }

 

  else if(value < 1200) // rotate ccw

  {

     

       myStepper.setSpeed(10);

  myStepper.step(-stepsPerRevolution);

  }

 

 

   

  }

 

 



Circuit

Gotowy.jpg

Connect the VIN and gnd pins to 5v power. We can use a higher voltage, but you will need a 5v voltage regulator as stepper motors is rated for 5v. Pin 3 connect with ch2 (signal) Pin 8 - in1 Pin9 - in2 Pin 10-in3 Pin 11-in4  To organize everything, it is worth using a universal PCB. I used a 5x7cm tile. I connected everything using connectors and gold pins.

Video

I've made video of builiding all project, Here is Code and electronics chapter.

https://www.youtube.com/watch?v=iMCD9L0SLgg&t=572s