4.23.2014

BeagleBone Black: TB6600 Stepper Driver w/ Python

On the float we needed a way to spin the spool and spool the tether for the sub in a coherent calculated fashion. This aspect of the float is very important because the autonomous spooling system will be used in tandem with the depth sensor on the submersible. Live data will continuously spool and unspool the tether.

Materials:

  • Stepper motor
  • TB6600 Stepper Driver board
  • Adafruit's BBIO Python Library
  • Stepper code found here (in the stepper folder).

Overview:

We looked into various different ways of spooling and decided to settle on using stepper motors and pulley system. These motors are unique in that they allow for extremely specific (exactly 1.8°) movement and, on the software side, and easy way to record the number of rotations. This precision, in both the mechanical and software aspects of the float, is why we chose to use steppers.

The stepper motor family actually consists of two distinct types of motors. This paper from Northwestern does a good job explaining it. For all intents and purposes Bipolar motors have 4 wires while Unipolar motors can have 5-6 wires. The motors we used for the float were Bipolar steppers from Automation Direct. We used motors from this site because of the torque they were rated for. We wanted to make sure that the spooling system was well equipped and able to handle the weight of the tether. Below is a picture of one of the steppers:






After purchasing the steppers we needed a way of controlling them. Unlike other DC motors, stepper motors needed to have current pulsed through the different coils in a specific order.To automate the process of continuously powering different coils one must use a computer (like the Raspberry Pi) or micro-controller (like the Arduino).

We first decided to purchase the MC33932 chip from Freescale because of our past experiences using the L293D. Not only could it handle the 5A current, but also be controlled using the 3-5v logic from the BeagleBone. We thought that it be easy to create a custom PCB and use it as our motor driver....sadly it was not as easy as we though. After searching for a few weeks on how to integrate this custom chip in a PCB at a reasonable price and minimal effort, we settled on using a pre-built board. We chose to use the TB6600 which is a stepper driver for a CnC Router. An image of the board is below:





The great thing about this driver is that it only needs two signals from the BeagleBone. One sets the direction and the sends the signal to run the stepper motor.


Wiring:

The connections on the board labeled and straightforward. Attach your power and the bipolar stepper motor. Then attached the Clk- and Dir- to the GND on the BeagleBone. Attach the Dir+ and Clk+ to P8_15 and P8_17 respectively. See the diagram below for the BeagleBone's pinouts (you may used from of the reserved pins if you play around with the device tree overlay):



BN: The connections on the TB6600 are backwards (at least I think so). The wires must be screwed into the top of the connectors, not the bottom. 


Software:

The software to run this stepper driver was pretty straight forward. Before starting please read Haoyu Electronics' page and the data sheet to get a better understanding of how the chip works.

Take note that the the driver has an hex inverter and therefore the signals sent from the BeagleBone will be opposite what the data sheet says. For example, instead of holding the Enable pin High, we leave it low (or unplugged) because the inverter pulls it high for us.

Install our BBB stepper library from out git hub page:




Navigate to the stepper folder. Run the setup.py file:



The BBstepper.py library is used to run the stepper motor easily from another Python file. After importing the library you can use the following commands to make your own program to run the stepper motors using the TB6600:


stepper.init_pins(config.pins)
stepper.spin_clockwise(config.pins, rotations, rpm)
stepper.spin_counterclockwise(config.pins, rotations, rpm)
stepper.cleanup(config.pins)


B.N: Please note that this software has only been tested on the BeagleBone Black with the TB6600 Stepper Motor Driver.


No comments:

Post a Comment