total noob on Arduino trying to figure out how to run a stepper motor

We have a senior project to do.


This is exactly what we have.
Sparkfun qwiic redboard and qwiic step, plus some stepper motors.

For now, I just want to make sure all the parts work, but none of us are good at coding.
(i have done a little of coding on MicroPython and Matlab, but never done it on Arduino.)
I tried a couple of codes written by other people.
such as this one:

but always got the same error message:

Arduino: 1.8.13 (Windows 10), Board: “Arduino Uno”

Sketch uses 4770 bytes (14%) of program storage space. Maximum is 32256 bytes.

Global variables use 539 bytes (26%) of dynamic memory, leaving 1509 bytes for local variables. Maximum is 2048 bytes.

avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x51

avrdude: stk500_cmd(): programmer is out of sync

avr_read(): error reading address 0x0000

read operation not supported for memory “flash”

avrdude: failed to read all of flash memory, rc=-2

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x69

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x69

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Once we can figure out the basic problem of this code we might be able to play around with it a bit more.
Really appreciate for your help.

Can you upload the basic blink sketch to your board?

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

cattledog:
Can you upload the basic blink sketch to your board?

void setup() {

// initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

yes blink can properly work on my board

  • You have to choose tools / cards / (the card you used) (like Arduino Uno).
  • You have to choose the USB port where you connect your card. (port: "COM5")
  • From the Serial Port Screen, you should select 115200 baud.

/******************************************************************************
The Qwiic Step library has a simple begin function that verifies the connection
to the Qwiic Step board.
Priyanka Makin @ SparkFun Electronics
Original Creation Date: January 10, 2020
SparkFun labored with love to create this code. Feel like supporting open source hardware?
Buy a board from SparkFun! Qwiic Step - SPX-15951 - SparkFun Electronics
This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
local, and you've found our code helpful, please buy us a round!
Hardware Connections:
Attach Red Board to computer using a USB cable.
Connect Qwiic Step to Red Board using Qwiic cable.
Open Serial Monitor at 115200 baud.
Distributed as-is; no warranty is given.
******************************************************************************/

#include "SparkFun_Qwiic_Step.h" //Click here to get the library: http://librarymanager/All#Qwiic_Step by SparkFun
QwiicStep motor;

void setup()
{
Serial.begin(115200);
Serial.println("Qwiic step examples");
Wire.begin();

//Check if Qwiic Step is correctly connected to I2C
if (motor.begin() == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while (1);
}
if (motor.begin() == true)
{
Serial.println("Motor acknowledged and is connected correctly!");
}
//Get firmware version
Serial.print("The firmware version is: 0x");
int version = motor.getFirmwareVersion();
Serial.println(version, HEX);
}

void loop()
{
}

Cem_Murat_Yildiz:

  • You have to choose tools / cards / (the card you used) (like Arduino Uno).
  • You have to choose the USB port where you connect your card. (port: "COM5")
  • From the Serial Port Screen, you should select 115200 baud.

I have done the first two points.
I'm not sure about serial port screen, but I just changed the "serial plotter" under "tool" to 115200 baud.
then I tried the code again and no more error message shows up.
But the motor is still not running, and it has a short noise sound when I apply the code.

I wonder is the motor is broken but I don't have another motor right now

plus some stepper motors.

But the motor is still not running, and it has a short noise sound when I apply the code.

Please explain more about these stepper motors. What is the max current per phase?
What is connected to the barrel jack of the qwiic step board?

cattledog:
Please explain more about these stepper motors. What is the max current per phase?
What is connected to the barrel jack of the qwiic step board?

The label I can see on the motor is "Lin Engineering 5718M-06S-RO, 2.8Amp"
and this is the only one I found similar to:

The power connected to the board is 12voltage. (input:120V~60Hz, output:12V)
Again really appreciate for your help.

The power connected to the board is 12voltage. (input:120V~60Hz, output:12V)

How many amps?

I see this in Qwicc StepLibrary example 16

Qwiic Step defaults to a hold and run voltage of 1.2V. This is about 1A per
phase but varies on the motor and step configuration you have.
The A4988 IC is capable of 2A total (1A per phase) but requires heat sinking
and a larger power supply.

The label I can see on the motor is "Lin Engineering 5718M-06S-RO, 2.8Amp"

Unloaded, I think that at 1A per phase the motor would step, but I'm not certain.

I really believe that your best course of action is to work with SparkFun technical support