Show Posts
Pages: [1] 2 3
1  Using Arduino / Motors, Mechanics, and Power / Stepper.h library on Arduino on: September 17, 2012, 03:16:06 pm
Does anyone know how the stepper.h library actually works? I do not quite understand how the pins are being driven in their 4-step sequence for the bipolar stepper motor (4-wires control). What is MyStepper.step( )?
2  Using Arduino / Motors, Mechanics, and Power / Re: Arduino Motor Shield + Microstepping Library? on: September 14, 2012, 06:03:54 pm
In addition, I've been trying to write code so that the motor just 1 step at a time as a shortcut way to do micro-stepping w/o using a library. So, I have stepCount to keep track of # of steps total, and then I have the switch case to go back and forth. The problem is that the motor isn't going back + forth, it's only going in 1 direction, as dicated by the statement before the switch case. How do I fix  this issue?

if (MotorRun == 1) {
  // GO back + forth
     myStepper.step(-1);
     Serial.print("steps:");
     Serial.println(stepCount);
     delay(20);
     stepCount=stepCount+1;
     
     
     if (stepCount==10) {
       myStepper.step(-1);
       delay(20);
       Serial.print("steps:");
       Serial.println(stepCount);
       stepCount=0;
       stepCount=stepCount-1;
     }
     
     if (stepCount==-10) {
       myStepper.step(1);
       delay(20);
       myStepper.step(1);
       Serial.print("steps:");
       Serial.println(stepCount);
       stepCount=0;
       stepCount=stepCount+1;
     }

I haven't heard from anyone here in the past 3 days. Does anyone have suggestions for setting the current on the Arduino Motor Shield (L298 motor driver)? Or fixing the wobbling/stalling/pausing problem of the stepper motor I have?
3  Using Arduino / Motors, Mechanics, and Power / Arduino Motor Shield + Microstepping Library? on: September 14, 2012, 05:02:58 pm
I've been using Arduino UNO + Arduino Motor Shield (L298) with the stepper.h library. However, my 132 oz*inch bipolar stepper motor, size17 is having resonant/wobbling issues: it has about 8 ounces of weight that it is constantly moving back and forth; it gets stuck and doesn't go to the same position every time. I need a micro-stepping library to smooth out the wobbling action of the motor, since it's reaching its resonant frequencies. Where is that and how do I use a micro-stepping library with my existing components?

In addition, is there any way to set the current on the Arduino Motor shield? I haven't been able to do that with the stepper.h library so far. Almost all motor driver chips allow for the user to set the current sourced to motor. Not sure how to do that with the Arduino Motor Shield or stepper library. The analog inputs A1 and A0 say that the current is 200 mA, but the motor actually needs 800mA to reach full torque of 132 oz*inch. Please assist me. Thanks.
4  Using Arduino / Networking, Protocols, and Devices / Re: Gravitech's 12bit ADC + Arduino UNO on: September 12, 2012, 11:47:38 am
The two lines I'm confused about are here in the sample code:

#void loop()
{
  const int I2C_address = 0x90; //0x48;  // I2C write address
  const byte DAT[8] = {0x8C,0xCC,0x9C,0xDC,0xAC,0xEC,0xBC,0xFC};
                                 // Constant configuration data
#
How are the addresses known? I'm not sure where the coder is pulling these addresses from; the datasheet is confusing to me. Are these the correct addresses to use?
5  Using Arduino / Networking, Protocols, and Devices / Gravitech's 12bit ADC + Arduino UNO on: September 11, 2012, 07:19:04 pm
I want to expand the # of analog pins on my Arduino Uno by using the Gravtech 12bit ADC: http://www.gravitech.us/i2c128anco.html.

But Im not sure how to code it. I have some sample code from the Gravitech website here:

/******************************************************************************
Example program I2C-ADC interface with Arduino.

SETUP:    I2C-ADC => Arduino
          PIN7 => ground, PIN11 => A5(SCL), PIN12 => A4(SDA), PIN14 => +5V
Note:     The program is written for address 0x90 (Arduino address 0x48).
          This program was tested using Arduino Nano
Document: AD7828 datasheet
Updated:  September 4, 2008
E-mail:   support@gravitech.us
          Gravitech
(C) Copyright 2008 All Rights Reserved
*******************************************************************************/

#include <Wire.h>

/*******************************************************************************
                      Setup
*******************************************************************************/
void setup()
{
  Serial.begin(9600);
  Wire.begin();             // join i2c bus (address optional for master)
  delay(1000);
}
 
/*******************************************************************************
                      Main Loop
*******************************************************************************/ 
void loop()
{
  const int I2C_address = 0x48;  // I2C write address
  const byte DAT[8] = {0x8C,0xCC,0x9C,0xDC,0xAC,0xEC,0xBC,0xFC};
                                 // Constant configuration data
 
  byte Adval_High, Adval_Low;    // Store A/D value (high byte, low byte)
  byte i;                        // Counter

  delay(1000);
 
  for (i=0; i<=7; i++)
  {
    Wire.beginTransmission(I2C_address);
    Wire.write(DAT);        // Configure the device to read each CH 
    Wire.endTransmission();
    delay(1);
   
    // Read A/D value
    Wire.requestFrom(I2C_address, 2);
    while(Wire.available())          // Check for data from slave
    {
      Adval_High = Wire.read();   // Receive A/D high byte
      Adval_Low = Wire.read();    // Receive A/D low byte
    }
   
    Serial.print("A/D value CH");
    Serial.print(i, DEC);
    Serial.print(" is ");
    Serial.print(Adval_High,HEX);
    if (Adval_Low <= 0x0F)
      Serial.print("0");
    Serial.println(Adval_Low,HEX);
  } 
  Serial.println();
}

But nothing appears on the serial monitor! Help!!
6  Using Arduino / Motors, Mechanics, and Power / Arduino Motor Shield: The A2+A3 analog input pins are wrong! on: August 22, 2012, 04:53:58 pm
I dont get the purpose of the two Tinkerkit header pins, which connect to A2 +A3, on the Arduino Motor Shield.Both analog pins are always outputting 5V, rather than measuring the voltage. I want to configure them as input analog pins rather than output pins, but I am unsuccessful in doing that. I'm using Arduino UNO + Arduino Motor Shield together. Help, please?
7  Using Arduino / Sensors / Re: What to do when I run out of analog inputs? on: August 22, 2012, 04:05:54 pm
I dont get the purpose of the two Tinkerkit header pins, which connect to A2 +A3, on the Arduino Motor Shield.Both analog pins are always outputting 5V, rather than measuring the voltage. I want to configure them as input analog pins rather than output pins, but I am unsuccessful in doing that. I'm using Arduino UNO + Arduino Motor Shield together. Help, please?
8  Using Arduino / Sensors / What to do when I run out of analog inputs? on: August 21, 2012, 06:08:26 pm
I'm using the analog inputs on the Arduino Uno R3 to measure voltage values between 0-5V. I ran out of analog inputs. Is there a way to expand the amount of analog inputs? Can the digital pins be used as analog input pins?

Sorta un-related side question:
Whenever I have the Arduino Motor shield on top of the Arduino board, I notice that the A1 + A0 inputs no longer are able to sense any voltage values and the A2+A3 inputs are always measuring 5V, even when open. Is the motor shield broken? Is this abnormal behavior? Therefore, Im looking for other ways to increase the analog input sensors.
9  Using Arduino / Motors, Mechanics, and Power / Re: Too much mass on stepper motor? It wont spin! on: August 13, 2012, 04:13:26 pm
I figured it out-- the motor was a bad motor. It was stuck even w/ all the load removed. Replaced the motor and everything worked.
10  Using Arduino / Motors, Mechanics, and Power / Re: Too much mass on stepper motor? It wont spin! on: August 13, 2012, 11:54:19 am
Not quite-- it's still at rest no matter what I do. I've tried a different power supply (from 24V to 32V) for the motor. I've tried pushing it, but it's still at rest. I know it's trying to move, because I see the 4 LED lights at the 4 outputs are flashing and there's a lot of audible motor noise.
11  Using Arduino / Motors, Mechanics, and Power / Too much mass on stepper motor? It wont spin! on: August 13, 2012, 11:24:27 am
I have a 12V/350mA bipolar stepper motor from Adafruit: http://www.adafruit.com/products/324
I have a Arduino motor shield attached on top of the Arduino; this motor shield uses the LM298 driver, which can output 2A max per channel, according to data sheet. However, due to the huge mass (20 in Al motor shaft + attached PCBs; very heavy stuff) on top of the motor shaft, the motor is no longer turning, and I have to slowly push it w/ my hand to get it to turn step by step. My power supply (from Agilent) is 24V/0.5A. Do I need a larger power supply? All I'm doing is trying to make motor spin back+forth using the Stepper.h library. How do I make this motor turn? Do I need a motor w/ a higher current rating (up to 2A)?

Edit: I have 1 more question-- is there any way to adjust the acceleration of the bipolar stepper motor on the Arduino code? I know I can adjust speed using "myStepper.setSpeed(200)", where 200 = 200 rpm.
12  Using Arduino / Motors, Mechanics, and Power / 24V BLDC Motor + Dual FETs + Arduino on: August 03, 2012, 09:27:02 am
I'm trying to drive a 24V BLDC motor using dual FETs only: the IRF7389 dual FETs. I'm not using any of the 3 Hall sensors, only controlling the on/off of the 6 transistors (n-channel + p-channel), according to the AN885 Application Note (look it up!) on BLDC Brushless Motor Fundamentals. Here's my code. Instead of plugging in the motor, I have 3 LEDs connected to the drain pins (5-8 on the IRF dual FETs) where the motor outputs are usually connected. So, this way, I do not fry the motor on the first attempt. All the p-channel sources are tied to 5V, while the n-channel sources are tied to GND. Of course, I have resistors at the gates and resistors in series at the drain pins. The problem is that the LEDs each light up one by one, the current initially spikes up to 250 mA and then drops back to 0A. Why??? How do I fix this problem? I'm too scared to plug in the motor in case it either burns up or doesn't spin at all.

const int q5=7;
const int q4=6;
const int q3=5;
const int q2=4;
const int q1=3;
const int q0=2;

void setup() {
pinMode(q5, OUTPUT);
pinMode(q4, OUTPUT);
pinMode(q3, OUTPUT);
pinMode(q2, OUTPUT);
pinMode(q1, OUTPUT);
pinMode(q0, OUTPUT);
}


void loop() { // Spin Clockwise
// Im using the table 3: AN885 application note.
// Sequence 1: q1 and q4 are high   

digitalWrite(q5, LOW);
digitalWrite(q4, HIGH);
digitalWrite(q3, LOW);
digitalWrite(q2, LOW);
digitalWrite(q1, HIGH);
digitalWrite(q0, LOW);
delay(10);

// Sequence 2: q1 and q2 are high
digitalWrite(q5, LOW);
digitalWrite(q4, LOW);
digitalWrite(q3, LOW);
digitalWrite(q2, HIGH);
digitalWrite(q1, HIGH);
digitalWrite(q0, LOW);
delay(10);

// Sequence 3: q5 + q2 are high
digitalWrite(q5, HIGH );
digitalWrite(q4, LOW);
digitalWrite(q3, LOW);
digitalWrite(q2, HIGH);
digitalWrite(q1, LOW);
digitalWrite(q0, LOW);
delay(10);

// Sequence 4: q5 and q0 are high
digitalWrite(q5, HIGH);
digitalWrite(q4, LOW );
digitalWrite(q3, LOW);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, HIGH);
delay(10);

// Sequence 5: q3 and q0 are high
digitalWrite(q5, LOW);
digitalWrite(q4, LOW);
digitalWrite(q3, HIGH);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, HIGH);
delay(10);

// Sequence 6: q3 and q4 are high
digitalWrite(q5, LOW);
digitalWrite(q4, HIGH);
digitalWrite(q3, HIGH);
digitalWrite(q2, LOW);
digitalWrite(q1, LOW);
digitalWrite(q0, LOW);
delay(10);
 }

In addition, are there any inherent delays in between each new "digitalWrite" command? I want the transistors in each sequence to either be on/off all at the same time.
13  Using Arduino / Motors, Mechanics, and Power / Re: L6235 + Arduino + 24 BLDC motor on: July 27, 2012, 07:28:35 pm
Let's say I dont want to use the L6235. How do I directly control the BLDC motor with my Arduino? I can attach the transistors (6) to the Arduino and pull them high or low to get the CCW or CW directions. The Arduino can only source a few mA of current to the 3 outputs of the motor, which needs 24V.
14  Using Arduino / Motors, Mechanics, and Power / Re: L6235 + Arduino + 24 BLDC motor on: July 27, 2012, 09:44:29 am
Motor: http://www.anaheimautomation.com/products/brushless/brushless-motor-item.php?sID=142&pt=i&tID=96&cID=22 The BLWR111S-24V-10000 is the 24V BLDC motor I'm using.

I've never used the L6235 smart motor driver chip, but from the datasheet, there are only 4 logic inputs to control it: the Fwd/Reverse, the Vref pin, the Brake pin, and the Enable Pin. It's also got the typical 3 Hall Sensor Inputs and the 3 Phase Motor Outputs to control the BLDC motor's commutation. It uses PWM control by setting the R + C values to determine the pulse frequency; see pg9 on the datasheet.

 Any reference or advice would be helpful. Thanks!
15  Using Arduino / Motors, Mechanics, and Power / L6235 + Arduino + 24 BLDC motor on: July 26, 2012, 07:18:56 pm
The L6235 is a smart motor driver chip. I want to interface it directly with the Arduino in order to drive a 24V BLDC motor. Ideas? 
Pages: [1] 2 3