W10-Motor

This week's labs are exciting, and I have been waiting to learn all these for a long time. This knowledge opened up many more possibilities for the microcontroller and answered my questions about how more significant projects are powered and controlled. Learning how to connect and control motor also expands opportunities to do tasks with remote control and interactivities.

My parts took a long time to arrive due to the busy shopping season in China. So I went on a trip to a large electronic parts market in Shanghai. The experience was not pleasant at all. Due to the lack of knowledge and disorganized market layout, I spent many hours in the market just trying to find a couple of parts. And there was nowhere to find the TB6612FNG H-bridge that can work with Arduino Nano. Eventually, I found most pieces from the market, and fortunately, my parts just arrived in time before the class, so I got to test them out a bit. 

The first two labs are straightforward enough to follow along with no problem. Here are the videos.

 

However, it took me a long time to figure out how to use the stepper motor with the H-bridge, and I still cannot figure it out. I think the schematic doesn't match with the breadboard view of the last lab. After searching for information on Google:

Connection

IMG_2673 copy.jpg
  • VM to 12V

  • Vcc to 3.3V

  • GND to ground

  • AIN2 to Digital 4

  • AIN1 to Digital 5

  • BIN1 to Digital 6

  • BIN2 to Digital 7

  • PWMA and PWMB to Vcc/3.3v

Arduino code

#include "Stepper.h"
 
const int stepsPerRevolution = 512;  // change this to fit the number of steps per revolution
                                     // for your motor
 
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 4,5,6,7);            
 
int stepCount = 0;         // number of steps the motor has taken
 
void setup() {
  // initialize the serial port:
  Serial.begin(9600);
}
 
void loop() {
  // step one step:
  myStepper.step(1);
  Serial.print("steps:" );
  Serial.println(stepCount);
  stepCount++;
  delay(500);
}

My stepper motor is 12V, and I have a 12V DC power supply.

After powering up the setup, I could feel the motor's vibration and hear a clicking sound from the motor, but I didn't see the motor turning.

My stepper motor is 12V, and I have a 12V DC power supply.

After powering up the setup, I could feel the motor's vibration and hear a clicking sound from the motor, but I didn't see the motor turning.

Previous
Previous

W13-Project3-Sound Balls

Next
Next

W9-Project2-Balloon