AAIMI GPIO is a web-based control interface for the Raspberry Pi and Arduino. Check out the tutorials below.
AAIMI GPIO Stepper Motor
23rd November 2017
In this article I'll show you how to configure and control a 360 degree stepper motor with your Raspberry Pi using the AAIMI GPIO system.
Stepper motor basics
I've covered using stepper motors in other articles in the Cave. They are basically a motor that take a set amount of steps to turn a full rotation, meaning the controller can know exactly where the motor is at all times.
Those two articles should tell you all you need to know about connecting your stepper and motor controller, so I'll only briefly cover the connection details here.
This is an example of a 4-wire stepper motor connected.
The first pair of motor wires go to OUT1 and OUT2 on the motor controller, and the second pair to OUT3 and OUT4. The signal wires connect to pins 18, 23, 24, and 8.
You configure the motor by pressing the button for the first motor pin in the AAIMI GPIO configuration window and clicking Change Setting.
The initial pin form will load.
I'll call my motor steppy and select Stepper Motor from the drop-down pin-type menu, then click Next.
In the Output Options section I've set the default state Low, or off, and chosen to manually switch the motor.
I've then entered the three other motor pin numbers.
In the Position section I've entered zero, which means the motor will face twelve o'clock or directly ahead.
I've entered -90 and 90 as the left and right stops, which equates to nine o'clock and three o'clock. These are the stopping positions if you set the motor to automatically oscillate.
In the rotation section I've set the pause btween steps (the speed of the motor) to six milliseconds. That seems to work best with small ebay stepper motors, you may need to adjust it for others. Lower is faster.
The multiplier value is to convert the steps of the motor into degrees of rotation. With the 40-28 gear ratio I have on my sensor mast I actually have exactly 360 full steps per rotation (Really lucky!), so I leave the multiplier as 1.0. You'll need to experiment to get you ratio right.
Lastly, select whether you wish to move the motor manually to position or set it to automatically oscillate when it is turned on. You can also overide this and start the motor oscillating from the control GUI.
I selected Move to position.
Click Next, then Back to return to the main configuration window.
You'll see your first motor pin is now in the default output color.
Run the motor
Now click the Run tab and you'll see your motor in the Control window. Click on the motor then click Change.
The motor-control window will open.
There are left, center, and right buttons to quickly move your motor to the stops you defined during setup. Below those is a slider to turn the motor anywhere from -180 to 180 degrees.
The motor will never turn more than 360 degrees. This is to stop damage to wires when you have another device rotating with the motor, such as the distance sensor that sits atop my mast.
To start the motor oscillating, click the Oscillate button. Click the button again to stop oiscillating, and the motor will return to its default position, in my case center.
In the next article we'll configure AAIMI GPIO to send email and HTTP notifications for pin events.