Stepper UNO v1.0

From lechacal
Jump to navigation Jump to search

StepperUNO - Stepper Motor Manual Control

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.

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.

The software works exactly as an Arduino UNO.

Get it online


Specifications

- 2 Motor control output (Generic or embedded A4988 drivers)
- 4 Digital Input/Output
- 2 Analog Input (can be used as digital I/O)
- 1 USB port
- 1 Power port (2.1mm Jack)
- 1 Potentiometer control
- 6 push buttons.
- 16x2 LCD screen

Motor Driver options

The stepperUNO was designed to communicate with any stepper driver.

The product offers two variants. A embedded A4988 driver option and a generic screw terminal connector for interfacing with an external driver. This option is chosen at purchase time.



Generic connector

Generic Driver With this configuration it is possible to connect any external driver to the stepperUNO. The connector is a screw terminal block for V+ Ground Step Direction and Enable. For example units that can be interfaced this way might be Geckodrive / Sanyo Denki 3 / TB6600 / TB6560 etc.

A4988 driver

The A4988 driver can be fitted on the StepperUNO itself. The motor is then connected directly to the StepperUNO using the 4 pin connector.

A4988 driver

Motor Control

The step forward with the StepperUNO is the addition of dedicated Attiny85 microcontroller for each motor. Thus allowing the main microcontroller (arduino UNO) to perform other tasks. Motor control operation will not interfere with other programmed task (e.g. LCD / sensor reading / compuation/ 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 ATtiny85 communicates with the main Atmega328 MCU via i2c. All controls can be easily used using the StepperUNO library.

User Control / Manual Control

The well known LCD keypad shield is used. It uses the usual LiquidCrystal library to display informations.

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 potentiometer is available for linear controls such as speed.

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.

Enclosure

The full combo StepperUNO/keypad shield can sit in a basket enclosure. This can be mounted on aluminium profile or other support.


Library

The stepperUNO library is available in the section Files below.

The library is described in more details in StepperUNO Library 1.1

A simple usage example is shown below.

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

#define Pot 3

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

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); 

keypad Keypad;
stepMOTOR motor1, motor2;

void setup(){

  motor1.begin(0x4);
  motor2.begin(0x5);
  motor1.enable();
  
  lcd.begin(16,2); //LCD INITIALISATION
}

void loop(){
 
 int POTval = analogRead(Pot);
 float step_delay = 102400/(POTval+1);
 
 byte button = Keypad.ReadKey();
 
 if( Keypad.buttonJustPressed ) {

        switch (button){              

            case BUTTON_RIGHT:{  
                 motor1.setDirection(true);
                 motor1.speed(step_delay);
                 lcd.setCursor(0,0);
                 lcd.print("RIGHT");
                 break;
            }
            case BUTTON_LEFT:{     
                 motor1.setDirection(false);
                 motor1.speed(step_delay);
                 lcd.setCursor(0,0);
                 lcd.print("LEFT ");
                 break;
            }
        }//end switch
 }// end if
 
 if( Keypad.buttonJustPressed ) Keypad.buttonJustPressed = false; //We have now done all we wanted once the button pressed. Closing it.
 
 if( Keypad.buttonJustReleased ) {  
   if (button==BUTTON_NONE){
     motor1.stop();
     lcd.setCursor(0,0);
     lcd.print("     ");
   }
 }
 if( Keypad.buttonJustReleased ) Keypad.buttonJustReleased = false;
    
  
}//end loop

Files

StepperUNO Library v1.0
StepperUNO Library v1.1

Application Examples

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

  • Default sketch - Sketch out of manufacture.
  • Albawinder - Coil winder project
  • Position Control
  • attiny_stepperUNO - Sketch for both attiny85 mcu that individually control the drivers.
  • test_lcd - dummy sketch to test the lcd keypad