- Table of contentShow
As you may have noticed in my past videos, I've been using a self-made rotating platform to display the projects. In this article, I'll describe and present it to you. It is still in its baby step, and I need a case to put everything inside. However, the code is available. The microcontroller is an ESP32, which is connected to Wi-Fi and hosts a website to configure the angle, speed, and direction of rotation. The ESP32 is programmed using MicroPython. Check out the following video!
Software and Hardware
The following hardware and software will be used in this article:
DIY Instructions
I used a bipolar stepper motor to rotate the plate. The L298N is a friendly motor driver and works well with the bipolar stepper motor. You can also use an L293D. However, the L293D can drive a motor with up to 600mA, while the L298N supports up to 2A. Both ICs can be used for brushed motor, bipolar and unipolar stepper motors.
To build the rotating platform, follow these steps:
- Connect the bipolar stepper motor to the L298N board. Check the cable colors in Figs. 1 and 2. to see how to connect the bipolar stepper motor cables.
Connect the L298N board to the ESP32 board. I connected the INx pins following this table:
L298N ESP32 In1
32
In2
33
In3
26
In4
25
GND
GND
but you can change this inside the
config.py
file.- Bridge the jumpers
ENA
andENB
. - Bridge the
12V
jumper, if your motor needs12V
and connect an external power supply to the terminal board. Otherwise, you can use5V
. If you've 12V stepper motors, you'll need another power supply for the ESP32. - Clone the repository
lemariva/uPySteppers
git clone https://github.com/lemariva/uPySteppers.git
- Rename the file
config.sample.py
toconfig.py
and configure your Wi-Fi credentials. If you've changed the pins to connect to the L298N, modify themotor_config
variable too. Configure thenumber_of_steps
andmax_speed
of your motor. In my case, the motor has a resolution of 1.8°, which means it needs 200 steps to achieve a 360° rotation. Thus, 200 isnumber_of_steps
. Themax_speed
parameter unit is steps/second. My motor can run up to 80 steps/second with the actual moment of inertia of my projects (battery + boards + etc.). If you set this parameter too high, the magnetic field rotates, but it won't be followed by the rotor. Therefore, it doesn't rotate. - Flash MicroPython on the ESP32. If you are new with this, follow the steps in this tutorial: Tutorial: Getting Started with MicroPython on ESP32, M5Stack, and ESP8266.
- Upload the project code to the ESP32 using VSCode and the PyMakr extension.
- Connect to the ESP32 using a browser. You should get something like in the video. Have fun! :)
Fig. 1: Bipolar Stepper Motor schematic.
Fig. 2: L298N board schematic.Conclusions
This article presents a DIY rotating platform. The angle, speed, and direction of rotation are controlled using an ESP32 connected to Wi-Fi. The ESP32 is wired to an L298N that drives a bipolar stepper motor.
The ESP32 is programmed using MicroPython and hosts a website that allows you to configure and start the rotation remotely.
We use cookies to improve our services. Read more about how we use cookies and how you can refuse them.
Empty