I am trying a project that will use motors to drive the movements of an animatronic instead of my normal pneumatics that I have been using for the last 17 years. But I wanted to build up some test joints to prove out the joints and motors before I finalized a design. To do this I decided I needed a small device to drive stepper motors for the test arms. So was born the Stepper Motor Test controller. Lets get building.
|Circuit board fresh from the manufacturing. Time to start adding parts starting with the shortest and working to the tallest ones.||As this is just a one off build, it was not worth having solder paste stencils made. so for this one i am just putting small dabs of solder paste on the smd pads. once the parts are placed I can use a fine tiped soldering iron or my hot air reflow gun to melt the solder and affix the parts|
|Using tweezers and a magnifying lamp I have places all the smd parts. time to heat things up||post heating. note the solder paste is all melted and flux is around most of the parts. now is a good time to do a little cleaning, as once the taller parts are in place it will be much harder to clean up the extra flux from the paste.|
|With the smd soldered I moved to the thru hole parts going headers then terminal blocks with the tall caps last. Now I like to do some testing to make sure everything is all good. I start by applying power and checking voltages at various points.||
Now with some initial testing done, it is time to inset the pre-made modules. Here I am using the Pololu High Current DRV8825 carrier (other pin compatible versions will also work depending on your motor choice) and the Sparkfun ESP32 Thing. The ESP32 is dev board based on the Espressif’s ESP32 and includes WiFi, Bluetooth and a 32bit microprocessor among other things.
More importantly I am using the ESP32 Thing as I start learning the Arduino IDE. There is a ESP32 Arduino Core that can be added to the IDE and one can then program the Thing just like any other Arduino device. Though most Arduino’s are based on an 8 bit AVR micro so the thing has a bit more horse power and integrated WiFi.
|After a little programing everything is working. Now I can get on with figuring out and building a test arm with stepper motors to see how that works instead of pneumatics that I have been using for the last fifteen years to drive animatronics.|
|Below is the code I have put together for the Thing, it is largely based on the sample for an encoder and is far from effecient but this device just does not need to do a lot at this point. Later I will likely test position feedback so the controller will become more important. But just to drive the stepper drivers I could have just used a switch for direction and linked the A side of the encoder to the step pin of the stepper driver to create a pulse.|
#define ENC1_A 25
#define motor1_dir 2
//#define GPIO_INPUT_GET(gpio_no) ((gpio_no < 32)? ((gpio_input_get()>>gpio_no)&BIT0) : ((gpio_input_get_high()>>(gpio_no – 32))&BIT0))
/* Setup stepper driver pins as outputs */
static uint8_t counter2 = 0; //this variable will be changed by encoder input
static uint8_t counter3 = 0; //this variable will be changed by encoder input
/* returns change in encoder state (-1,0,1) */