Arduino: Portable Two-Axis Stepper Control
Introduction: Arduino: Portable Two-Axis Stepper Control
In a previous tutorial we have seen how to run two stepper motors synchronously from a given start position to a defined destination using an Arduino and a very simple “user interface”. That user interface was restricted to some microswitches and LEDs, both installed on a breadboard.
As promised, this new instructable shows
* how to add a small OLED screen,
* how to run the Arduino, the motors, and the screen from one power supply, and
* how to put it all in a fancy control box.
In the end, you will have a device for controlling the steppers not only at home, but also “in the wild”, e.g. from a USB power bank / portable charger.
Supplies
* 1x Arduino Nano
* 2x 28BYJ-48 Stepper Motors (5V version) + ULN 2003 Driver Boards
* 1x OLED Display 0.96 inch (160x80px, SPI, 8 pins, e.g. this one)
* 3x Microswitches (optional, for testing)
* 1x Breadboard (830 holes, optional, for testing)
* 15x Jumper Cables (male-to-male, 10...20 cm, optional, for testing)
* 12x Jumper Cables (male to-female, 10...20 cm, optional, for testing)
* 1x Perfboard (70 mm x 30 mm - 24 x 10 holes)
* 1x DC Barrel Jack Socket 5.5 mm/2.1 mm (for Panel Mount, w/ M7 Nut)
* 3x Pushbuttons (7mm diameter, like these)
* 1x Electrolytic Capacitor (100µF)
* 1x 5V Power Supply
* 1x 3D printer or 3D printing service (optional, a plastic box or wooden box would be ok, too)
Step 1: Adding the Screen
As a first step, we revisit the circuit from the previous instructable and add the small 0.96" OLED screen to the breadboard. This step is optional for testing all the components. Alternatively, you may skip it and proceed with Step 2.
Set-up your breadboard as shown in the pictures above:
* Connect GND and 5V of the power supply to the upper red and blue rails of the breadboard.
* Connect the upper and lower (blue) ground rails and the GND pin of the Arduino to one of it.
* Pins D2 to D5 of the Arduino go to In1 to In4 of the first ULN2003 board.
* Pins D6 to D9 of the Arduino go to In1 to In4 of the second ULN2003 board.
* Pin D11 of the Arduino goes to the SDA (or Data or MOSI) pin of the display.
* Pin D13 of the Arduino goes to the SCL (or CLK or SCK) pin of the display.
* Pin A3 of the Arduino goes to the DC (or SA0 or A0) pin of the display.
* Pin A4 of the Arduino goes to the CS pin of the display.
* Connect the RST pin of the Arduino to the RST (or RES) pin of the display.
* Connect the GND pin of the display to one of the ground rails and the Vin pin of the display to the 5V pin of the Arduino.
* Connect the Arduino pins A1 to A3 to the microswitches. 611
Connect the other side of the microswitches to GND. We will not use any resistors to avoid short circuits here, because we use the pull-up that are already integrated in the Arduino.
Please note: The 0.96” display I have used (see link under "supplies") officially asks for a 3.3V operating voltage. Hence, all pings (i.e. Vin and signals) do not match the voltage of the output pins of the Arduino Uno/Nano/Mega which have 5V. Thus, you would need to connect the Vin pin to 3.3V and you need to add signal converters for the other lines either by using a bi-directional logic level shifter chip as presented here or a resistor-based voltage dividers as shown here. But: other tutorials like this one or this one propose to connect at least the signal lines directly to the output pins of the Arduino as I did in the sketch above, because the display is typically 5V-tolerant. Furthermore, some users in Arduino forums found the display flickering or entirely black when connecting Vin to 3.3V - which was my experience, too. 1003