cerdemir / arm-erol

6 DOF robotic arm with dc motors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arm-erol

project started as a robotic arm but I have only DIY servo now :)

6 DOF robotic arm with dc motors

video

Motor&Encoder: https://www.robotshop.com/en/12v-120-rpm-dc-motor-641.html

UC: http://www.st.com/en/evaluation-tools/stm32f4discovery.html

Discovery used as a brain of project. Because of the STM32F407VG can handle 6 encoders with its hardware timers. Lots of code generated by STM-CUBE

IDE: Keil

Framework: STM HAL library

How to use

Just define your

  • motor controller pins
  • pins timers for counting pulses
  • PID params (Kd, Ki, Kp)
void MotorInit()
{
		motors[0].CNT = &(TIM1->CNT);
		motors[0].PWM= &(TIM9->CCR1);
		motors[0].GPIO_Port = GPIOE;
		motors[0].Direction_Pin1=GPIO_PIN_1;
		motors[0].Direction_Pin2=GPIO_PIN_0;	
		motors[0].Enabled= false;
		*motors[0].CNT = motors[0].LastEncoderCount = 30000;
		*motors[0].PWM= 0;			
		motors[0].CurrentPosition= 0;
		motors[0].PID.Kd= 7;
		motors[0].PID.Ki= 0.001;
		motors[0].PID.Kp= 2;
		
}

and set the target

MotorSetTarget(&motors[0],1000);

After target setted STM start to apply PWM pulses until motor arrive to targert. After arrive to target it tries to holt motor in position.

Erol is my fathers name :)

About

6 DOF robotic arm with dc motors


Languages

Language:C 98.4%Language:HTML 0.5%Language:C++ 0.5%Language:Makefile 0.4%Language:Assembly 0.2%