Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
TB65603A Single Axis Stepper Motor Driver Board (HCMODU0022) 
Author Message

Joined: Tue Apr 28, 2015 4:24 am
Posts: 4
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
i am using arduino uno. and switch is connected to pin 7 of arduino and switch center off to GND


Wed Apr 29, 2015 10:04 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 638
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
I've added a few lines to output the state of the switch to the serial port. Try the sketch below and open up the serial monitor (Tools->Serial Monitor). Set the baud rate to 9600. When you flick the switch the output in the serial monitor change between 'Switch high' and 'Switch low'. If it does then the problem has something to do with the connections to your stepper motor driver.


Code:
int sensorPin = A3;
int sensorValue = 0;
int DirectionSwitch = 7; //Connect switch to this pin and GND
int DirectionOutput = 8; //Connect this pin to the direction pin on your stepper controller.
boolean SwitchState;

void setup() {
  Serial.begin(9600);
  pinMode(DirectionOutput, OUTPUT); //direction pin
  pinMode(DirectionSwitch, INPUT_PULLUP);
  pinMode(9, OUTPUT); //step pin
  //digitalWrite(8, LOW);
  digitalWrite(9, LOW);
}

void loop() {
  sensorValue = analogRead(sensorPin);
  sensorValue = map(sensorValue,0,1023,3600,1);
  SwitchState = digitalRead(DirectionSwitch);


  if(SwitchState)
  {
    Serial.println("Switch high");
  }else
  {
    Serial.println("Switch low");
  }
  digitalWrite(DirectionOutput, SwitchState);

  digitalWrite(9, HIGH);
  delayMicroseconds(sensorValue);
  digitalWrite(9, LOW);
  delayMicroseconds(sensorValue);
}

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Wed Apr 29, 2015 11:18 am
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
Hello! Help to understand with the program. I have a MEGA 2560, the rest is all like the pictures in the original. Library downloaded. Launched, the motor rotates in both directions, the speed changes depending on the position of the rotor resistor. Everything seems right, but when rotated in one direction the frequency Step-Clk" 993 Hz, and in another 763 Hz. How to increase this frequency? TB 6560 allows up to 15000 Hz. Thanks in advance.
P.S. Sorry for my English, I write through the translator.


Mon Aug 03, 2015 5:00 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 638
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
If you're using the HCMotor library, this wasn't written for or tested on a Mega so I quite surprised it actually works.

You can edit the library to get a bit more speed out of it. Open up the HCMotor.cpp file and find the following line of code:

Code:
HCMotor::_MotorTimer2Init(T2_CLK_DIV_32, 49);


You should be able to get more speed out of it by either reducing the number 49 and / or changing the T2_CLK_DIV_32 argument to T2_CLK_DIV_8

You can change either one or both arguments but there is a limit to how much you can speed it up before the library will stop working.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Tue Aug 04, 2015 12:41 pm
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
Thank you!
Changed some code and it worked, although it is not clear... Now the frequency of about 5 kHz to either side.
How to register in the program 2 motors and 2 resistor?

HCMotor.Direction(0, REVERSE);
Speed = map(Pot, POT_REV_MIN, POT_REV_MAX, 2, 10);

/* Is the pot in the forward position ? */
}else if (Pot >= POT_FWD_MIN && Pot <= POT_FWD_MAX)
{
HCMotor.Direction(0, FORWARD);
Speed = map(Pot, POT_FWD_MIN, POT_FWD_MAX, 10, 1);


Tue Aug 04, 2015 2:11 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 638
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
I would suggest looking at each line of the example sketch to see if you can understand how it works. In the exampel sketch you will notice this line which adds a motor:

Code:
HCMotor.attach(0, STEPPER, CLK_PIN, DIR_PIN);


For two motors just add an additional line so it looks like this:

Code:
HCMotor.attach(0, STEPPER, CLK_PIN, DIR_PIN);
HCMotor.attach(1, STEPPER, CLK_PIN, DIR_PIN);


Remember to change CLK and DIR parameters to match the pins your motors are connected to. Notice that the first parameter is 0 for the first line and 1 for the second. This is the reference to the motors. 0 is the reference to the first motor, and 1 is a reference to the second motor. All the other motor commands use a reference in the same way so for example to set the direction for the first motor (0) you would use:

Code:
HCMotor.Direction(0, REVERSE);


And to set the direction for the second motor (1) you would use:

Code:
HCMotor.Direction(1, REVERSE);

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Tue Aug 04, 2015 3:53 pm
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
Thank you!
Could you please write the whole code snippet.
I only started to learn Arduino, and absolutely no knowledge of the programming language, not to mention English...


Tue Aug 04, 2015 5:16 pm
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
removed unnecessary


Last edited by Rom327 on Wed Aug 05, 2015 10:10 am, edited 1 time in total.



Tue Aug 04, 2015 5:45 pm
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
removed unnecessary


Last edited by Rom327 on Wed Aug 05, 2015 10:10 am, edited 1 time in total.



Tue Aug 04, 2015 5:56 pm
Profile

Joined: Mon Aug 03, 2015 1:08 pm
Posts: 8
Post Re: TB65603A Single Axis Stepper Motor Driver Board (HCMODU0
Hello! Again need help... Wrote a sketch on 3 motors and 3 of the potentiometer. Built the circuit and found the following: the motors operate in parallel from any of the potentiometer. How to assign one potentiometer - one motor? Thank you! The sketch in the archive.


You do not have the required permissions to view the files attached to this post.


Wed Aug 05, 2015 9:51 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 49 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD