Stepper UNO v2.0: Difference between revisions

From lechacal
Jump to navigation Jump to search
No edit summary
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
=StepperUNO  - Stepper Motor Manual Control=
{{#seo:
|title=StepperUNO - Stepper Motor Control
|title_mode=append
|keywords=Stepper Motor, Manual Control, Arduino, stepper driver
|description=Control one or two stepper Motors manually with the StepperUNO. Program it with Arduino.
|robots=User-agent: *, Allow: /
}}
 
[https://lechacal.com/docs/Stepper_Control/Stepper_UNO_v2.0/ VIEW THE NEW DOCUMENTATION INSTEAD HERE]
 
==StepperUNO  - Stepper Motor Manual Control==
 
[[File:Stepperuno_v2_picture_001_small.png | 500px | alt='Manual Control Stepper Motor']]
 
[[File:Link_to_the_shop.png | link=https://lechacalshop.com/gb/cnc/105-stepperuno-arduino-stepper-motor-control-lcd-keypad-shield.html | alt="lechacalshop.com"]]


The StepperUNO is a stepper motor manual control board for standalone system.  
The StepperUNO is a stepper motor manual control board for standalone system.  


It can control up to two stepper motors and read sensors at the same time. It is suitable for small application requiring manual control and automation.
It controls up to two stepper motors and read sensors at the same time. It is suitable for small application requiring manual control and automation.


Based on the pattern of the Arduino UNO it is designed to host a LCD keypad shield. This combination makes the stepperUNO an excellent board for application control.
Based on the pattern of the Arduino UNO it is designed to host a LCD keypad shield. This combination makes the stepperUNO an excellent unit for application control.


This is programmed using Arduino IDE. Sketch can be uploaded directly from USB port.
This is programmed using Arduino IDE. Sketch can be uploaded directly from USB port.


Some basic Arduino programming skills are needed to work with this product. We provide a library to help you with this.
Some basic Arduino programming skills are needed to work with this product. We provide a library to help you with this.
[[File:Diagram_stepperuno_v2.png|alt='Diagram for stepperUNO']]


==Specifications==
==Specifications==
[[File:Diagram_stepperuno_v2.png]]


* 2 Motor control output (Generic or embedded A4988 drivers)<br>
* 2 Motor control output (Generic or embedded A4988 drivers)<br>
* 4 Digital Input/Output<br>
* 4 Digital Input/Output<br>
* 2 Analog Input (can be used as digital I/O)<br>
* 2 Analog Input (can be also used as digital I/O)<br>
* 1 USB port<br>
* 1 USB port<br>
* 2 12V Power port  
* 2 12V Power port  
Line 26: Line 40:
** 6 push buttons.<br>
** 6 push buttons.<br>
** 16x2 LCD screen
** 16x2 LCD screen
[[File:Lcd_keypad_image.png | 300px]]


==Motor Driver==
==Motor Driver==
Line 37: Line 49:


===Onboard Driver===
===Onboard Driver===
The StepperUNO can host two onboard drivers. These can be A4988 or S2225 or DRV8825 or any equivalent driver with the same footprint.
The StepperUNO can host two onboard drivers.  
 
Some example of onboard drivers are:
* '''A4988'''. Great for speed control and torque. Lost cost. Not recommended for positioning.
* '''S2225'''. Great for positioning. Silent.
* '''DRV8825'''.  


When using onboard drivers the connectors named motor1 and motor2 should be directly connected to the motor.
When using onboard drivers the connectors named motor1 and motor2 should be directly connected to the motor.
Line 43: Line 60:
Onboard drivers are powered from the 12V supplied.
Onboard drivers are powered from the 12V supplied.


[[File:Stepperuno_v2_microstepping.png]]
Microstepping is done by mean of solder jumpers at the back of the StepperUNO board.
 
[[File:Stepperuno_v2_microstepping.png|alt='StepperUNO microstepping']]


===External Driver===
===External Driver===
Line 53: Line 72:
The external driver must be powered separately. The StepperUNO will not power the external driver.
The external driver must be powered separately. The StepperUNO will not power the external driver.


Some example of external drivers are Geckodrive / Sanyo Denki 3 / TB6600 / TB6560.
Some example of external drivers are Geckodrive / Sanyo Denki 3 / TB6600 / TB6560 / DM542.
 
[[File:IMG_20220717_093402.jpg | 500px | alt='StepperUNO External Driver for manual control']]
 
==Motor Control==
 
The step forward with the StepperUNO is the addition of dedicated Attiny84 microcontroller for each motor. Thus allowing the main microcontroller (Arduino UNO) to perform other tasks while the motor are in action. Motor control operation will not interfere with other programmed task (e.g. LCD / sensor reading / computation/ etc...). This also allows for smooth operation of the motors (e.g. preventing the motor rattle while the mcu is sending data to print on the screen).
 
The ATtiny84 communicates with the main Atmega328 MCU via i2c. All controls can be easily used using the StepperUNO library.
 
See also [[Update attiny firmware on StepperUNO V2]]
 
==User Control / Manual Control==
 
The LCD keypad shield from DFRobot is used and supplied. It uses the usual LiquidCrystal library to print on the screen.
 
From the LCD keypad six push buttons are available. We have rerouted the reset button as a normal function button. The StepperUNO library contains functions to program them easily.
 
The two potentiometers are available for linear controls such as speed.
 
[[File:Lcd_keypad_image.png | 300px| alt='LCD Keypad']]
 
==Inputs/Outputs==
 
All digital and analog ports are available with screw terminal connectors. On each port there are three pins. Data/Ground and +5V. Ground and +5v are here for powering the sensor.
 
Digital Input/Outputs available are:<br>
D10<br>
D11<br>
D12<br>
D13<br>
 
Analog Inputs available are <br>
A1<br>
A2<br>
The analog input can be used as Digital I/O. Making 6 DIO available. These would be<br>
A1 -> D15<br>
A2 -> D16<br>
 
===Microswitch===
 
To connect a microswitch to one of the DIO the pin out should be as such<br>
Vcc -> NO<br>
Gnd -> NC<br>
In  -> Common<br>
 
==Power supply==
The stepper UNO can be powered using a conventional 12V PSU with 2.1mm jack connector.
 
Onboard Drivers are powered by the PSU of the StepperUNO. Make sure the PSU is rated appropriately to cover both drivers demand.
 
With the generic driver is it recommended to use a separate power supply for the motor. This later must be connected directly to the external driver.
Using the power from the stepperUNO (Gnd and V+) to feed the motors can used for small motors only.
 
==Library==
 
The stepperUNO library is available in the section Files below.
 
The library is described in more details in
 
[[StepperUNO Library 1.4]]<br>
[[StepperUNO Library 1.5]]
 
A simple usage example is shown below.
<syntaxhighlight lang=c style="border:1px dashed blue">
// simpledrive v1.3
// lechacal.com
// Example usage of stepperUNO library
// drive a single motor with left/right button
 
// library: stepperUNO_v1.4
 
#define Pot 6 // Potentiometer 1 is on pin 6
 
#include <LiquidCrystal.h>
#include <stepperUNO.h>
 
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
keypad Keypad;
stepMOTOR motor1;
 
const int Nstep = 200; // Enter here the number of step/rev for your motor
 
void setup() {
 
  motor1.begin(0x4, Nstep); // Motor 1 is at address 0x5. Motor 2 on 0x4
  motor1.enable();
 
  lcd.begin(16, 2); // LCD initialisation
 
}
 
void loop() {
 
  int POTval = analogRead(Pot);
  int rpm = map(POTval, 0, 1023, 5, 500); // Speed range from 5 to 500rpm
 
  Keypad.ReadKey();
 
  if (Keypad.state == PRESSED_RIGHT) {
    motor1.set_direction(true);
    motor1.set_speed_rpm(rpm);
    motor1.start();
    lcd.setCursor(0, 0);
    lcd.print("RIGHT");
    Keypad.closeEvent(); // Must be here to indicate we are done with the event
  }
  else if (Keypad.state == PRESSED_LEFT) {
    motor1.set_direction(false);
    motor1.set_speed_rpm(rpm);
    motor1.start();
    lcd.setCursor(0, 0);
    lcd.print("LEFT ");
    Keypad.closeEvent();
  }
 
  else if ( Keypad.state == RELEASED_RIGHT ) {
    motor1.stop();
    lcd.setCursor(0, 0);
    lcd.print("READY");
    Keypad.closeEvent();
  }
  else if ( Keypad.state == RELEASED_LEFT ) {
    motor1.stop();
    lcd.setCursor(0, 0);
    lcd.print("READY");
    Keypad.closeEvent();
  }
 
}//end loop
</syntaxhighlight>
 
==Files==
 
[http://lechacal.com/stepperUNO/stepperUNO_v1_2.zip StepperUNO Library v1.2]<br>
[http://lechacal.com/stepperUNO/stepperUNO_v1_3.zip StepperUNO Library v1.3]<br>
[http://lechacal.com/stepperUNO/stepperUNO_v1_4.zip StepperUNO Library v1.4]<br>
[http://lechacal.com/stepperUNO/stepperUNO_v1_4_1.zip StepperUNO Library v1.4.1]<br>
[http://lechacal.com/stepperUNO/stepperUNO_v1_5_0.zip StepperUNO Library v1.5.0]<br>
 
To install the library download the above zip file. In Arduino IDE go to '''Sketch''' | '''Include Library''' | '''Add .ZIP Library'''.
Then select the downloaded zip file.
 
Version 1.4 -> If you have acquired the stepperUNO before 1st March 2021 you will need to reflash the 2 attiny85 to use this version.
 
==Application Examples==
 
The library is provided with several examples in the Example directory.
 
* Default sketch - Sketch out of manufacture.
* [[albawinder | Albawinder - Coil winder project]]
* [[Position Control with StepperUNO]]
* attiny_stepperUNO - Sketch for both attiny85 mcu that individually control the drivers.
* test_lcd - dummy sketch to test the lcd keypad

Latest revision as of 11:29, 19 January 2024


VIEW THE NEW DOCUMENTATION INSTEAD HERE

StepperUNO - Stepper Motor Manual Control

'Manual Control Stepper Motor'

"lechacalshop.com"

The StepperUNO is a stepper motor manual control board for standalone system.

It controls up to two stepper motors and read sensors at the same time. It is suitable for small application requiring manual control and automation.

Based on the pattern of the Arduino UNO it is designed to host a LCD keypad shield. This combination makes the stepperUNO an excellent unit for application control.

This is programmed using Arduino IDE. Sketch can be uploaded directly from USB port.

Some basic Arduino programming skills are needed to work with this product. We provide a library to help you with this.

'Diagram for stepperUNO'

Specifications

  • 2 Motor control output (Generic or embedded A4988 drivers)
  • 4 Digital Input/Output
  • 2 Analog Input (can be also used as digital I/O)
  • 1 USB port
  • 2 12V Power port
    • 2.1mm Barrel Power Jack or
    • Screw Terminal Connector
  • 2 Potentiometer control
  • Host LCD Keypad with
    • 6 push buttons.
    • 16x2 LCD screen

Motor Driver

The stepperUNO V2 is designed to operate with most stepper driver.

There are two options for each motor.

  • An onboard driver and
  • A generic external driver interface.

Onboard Driver

The StepperUNO can host two onboard drivers.

Some example of onboard drivers are:

  • A4988. Great for speed control and torque. Lost cost. Not recommended for positioning.
  • S2225. Great for positioning. Silent.
  • DRV8825.

When using onboard drivers the connectors named motor1 and motor2 should be directly connected to the motor.

Onboard drivers are powered from the 12V supplied.

Microstepping is done by mean of solder jumpers at the back of the StepperUNO board.

'StepperUNO microstepping'

External Driver

External drivers should be connected to the connectors marked (EN1, DIR1, ST1, GND). Signals are TTL 5V level.

Onboard drivers must be removed when using the external driver.

The external driver must be powered separately. The StepperUNO will not power the external driver.

Some example of external drivers are Geckodrive / Sanyo Denki 3 / TB6600 / TB6560 / DM542.

'StepperUNO External Driver for manual control'

Motor Control

The step forward with the StepperUNO is the addition of dedicated Attiny84 microcontroller for each motor. Thus allowing the main microcontroller (Arduino UNO) to perform other tasks while the motor are in action. Motor control operation will not interfere with other programmed task (e.g. LCD / sensor reading / computation/ etc...). This also allows for smooth operation of the motors (e.g. preventing the motor rattle while the mcu is sending data to print on the screen).

The ATtiny84 communicates with the main Atmega328 MCU via i2c. All controls can be easily used using the StepperUNO library.

See also Update attiny firmware on StepperUNO V2

User Control / Manual Control

The LCD keypad shield from DFRobot is used and supplied. It uses the usual LiquidCrystal library to print on the screen.

From the LCD keypad six push buttons are available. We have rerouted the reset button as a normal function button. The StepperUNO library contains functions to program them easily.

The two potentiometers are available for linear controls such as speed.

'LCD Keypad'

Inputs/Outputs

All digital and analog ports are available with screw terminal connectors. On each port there are three pins. Data/Ground and +5V. Ground and +5v are here for powering the sensor.

Digital Input/Outputs available are:
D10
D11
D12
D13

Analog Inputs available are
A1
A2
The analog input can be used as Digital I/O. Making 6 DIO available. These would be
A1 -> D15
A2 -> D16

Microswitch

To connect a microswitch to one of the DIO the pin out should be as such
Vcc -> NO
Gnd -> NC
In -> Common

Power supply

The stepper UNO can be powered using a conventional 12V PSU with 2.1mm jack connector.

Onboard Drivers are powered by the PSU of the StepperUNO. Make sure the PSU is rated appropriately to cover both drivers demand.

With the generic driver is it recommended to use a separate power supply for the motor. This later must be connected directly to the external driver. Using the power from the stepperUNO (Gnd and V+) to feed the motors can used for small motors only.

Library

The stepperUNO library is available in the section Files below.

The library is described in more details in

StepperUNO Library 1.4
StepperUNO Library 1.5

A simple usage example is shown below.

// simpledrive v1.3
// lechacal.com
// Example usage of stepperUNO library
// drive a single motor with left/right button

// library: stepperUNO_v1.4

#define Pot 6 // Potentiometer 1 is on pin 6

#include <LiquidCrystal.h>
#include <stepperUNO.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
keypad Keypad;
stepMOTOR motor1;

const int Nstep = 200; // Enter here the number of step/rev for your motor

void setup() {

  motor1.begin(0x4, Nstep); // Motor 1 is at address 0x5. Motor 2 on 0x4
  motor1.enable();

  lcd.begin(16, 2); // LCD initialisation

}

void loop() {

  int POTval = analogRead(Pot);
  int rpm = map(POTval, 0, 1023, 5, 500); // Speed range from 5 to 500rpm

  Keypad.ReadKey();

  if (Keypad.state == PRESSED_RIGHT) {
    motor1.set_direction(true);
    motor1.set_speed_rpm(rpm);
    motor1.start();
    lcd.setCursor(0, 0);
    lcd.print("RIGHT");
    Keypad.closeEvent(); // Must be here to indicate we are done with the event 
  }
  else if (Keypad.state == PRESSED_LEFT) {
    motor1.set_direction(false);
    motor1.set_speed_rpm(rpm);
    motor1.start();
    lcd.setCursor(0, 0);
    lcd.print("LEFT ");
    Keypad.closeEvent();
  }

  else if ( Keypad.state == RELEASED_RIGHT ) {
    motor1.stop();
    lcd.setCursor(0, 0);
    lcd.print("READY");
    Keypad.closeEvent();
  }
  else if ( Keypad.state == RELEASED_LEFT ) {
    motor1.stop();
    lcd.setCursor(0, 0);
    lcd.print("READY");
    Keypad.closeEvent();
  }

}//end loop

Files

StepperUNO Library v1.2
StepperUNO Library v1.3
StepperUNO Library v1.4
StepperUNO Library v1.4.1
StepperUNO Library v1.5.0

To install the library download the above zip file. In Arduino IDE go to Sketch | Include Library | Add .ZIP Library. Then select the downloaded zip file.

Version 1.4 -> If you have acquired the stepperUNO before 1st March 2021 you will need to reflash the 2 attiny85 to use this version.

Application Examples

The library is provided with several examples in the Example directory.