cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F100RBT6B l293d 28byj-48

anton23
Associate II
Posted on August 29, 2016 at 13:08

Hello i am trying to launch simple stepper (

http://robocraft.ru/files/datasheet/28BYJ-pdf

) using l293d.

Connecting 28byj-48 to the L293D:

Engine contact 1

is connected to the

output 1. Engine

contact

3

is connected to the

output 2. Engine

contact

4

is connected to the

output 3. Engine contact 2

is connected to the

output 4. Connecting STM32

to the

L293D:

PC1 is connected to input 1. PC3 is connected to the input 2. PC5 is connected to the input 3. PC7 is connected to the input 4.

Enable 1, Enable 2 , Vs, Vss connected to 5v.

As a result, i hear some noise from motor but it do not spin. Dear forum users tell me what am I doing wrong?

Thank you.

#include ''stm32f10x.h''
#include ''stm32f10x_gpio.h''
#include ''stm32f10x_rcc.h''
void Delay(unsigned int t)
{
unsigned int i;
for (i=0;i<t;i++);
}
void GPIOD_Initialize(){
GPIO_InitTypeDef GPIOC_Stepper;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
GPIOC_Stepper.GPIO_Pin=GPIO_Pin_1|GPIO_Pin_3|GPIO_Pin_5|GPIO_Pin_7;
GPIOC_Stepper.GPIO_Mode=GPIO_Mode_Out_PP;
GPIOC_Stepper.GPIO_Speed= GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIOC_Stepper);
}
int main(void)
{
GPIOD_Initialize();
while(1)
{
GPIO_Write(GPIOC,GPIO_Pin_1);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_1| GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_7);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_7);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_7|GPIO_Pin_1);
Delay(100);
}
}

1 REPLY 1
sherman
Associate II
Posted on August 31, 2016 at 01:58

Hearing noise but not turning can be (among other things):

  • Stepping the sequence too fast
  • Wrong sequence that is stepped
  • Not enough current supplied to the motor
What kind of 5V supply are you using?