stepper power

stepper motor power problems

This is my first Arduino project so please bear this in mind!

I have a circuit which senses the volume of water in a tube with a large area capacitor (two large pieces of foil) glued to the outside a plastic bottle filled with water, the water column. This then uses a PulseIn command to display a number on an LCD screen. The pulsein number is steady and reflects the height of the water column changing, a volume reading. This pulsein value dictates the height of a mechanical lift of something when a push-to-make button is pressed on. The thing is lifted up and then lowered down by the same distance. This raise-and-lower action is done by a stepper motor with a threaded shaft in order to get a back-and-forth motion from the motor.

I have built the circuit on a copper back board as the stepper is 12 VDC powered off an AC to DC power adapter so its to meaty to power off the 9V DC wall adapter for the Arduino. I've got an Arduino, an LCD display to show the pulsein value for field testing, the foil capacitor circuit with a 4060 chip to create the pulse thing and a SN754410NE chip to connect the stepper to the arduino.

As a warm up I played around with a breadboard and the stepper with the motorknob tutorial and got the motor working off the chip. I then built my circuit up and the foil cap and the LCD display work fine. The stepper however is not playing ball. The problem is I am working on my project I don't see any power across the motor, on either coil, from the 12VDC adapter. Power is present up to the SN754410NE chip but not up to the coils. I tried to test the soldering and I found a small resistance across every connection with the power disconnected, so this seems ok. I've traced all the wires and can't see a wiring fault versus my diagram. I have identified the coil pairs, these were not originally paired properly when the power first went on but I have put this back correctly now. (the motor wiring diagram from china was wrong!)

I read Grumpy Mikes webpage on power De-coupling and see that this could be relevant as I have the 9vdc wall adapter for the arduino and the 12vdc adapter for the stepper and only 0.1microF cap on the 4060 chip. I go back and make sure all ground cables are grouped, so all ground cables go back to the negative side of the wall adapeter socket. Note the 12v dc ground and the 9vdc ground are connected.
To try to improve power quality I try to get Grumpy Mikes diagram for improving power quality for a motor (last diagram on his page) and fit this into my circuit. This is fitted between the 12VDC power terminals on the board and the positive 12v supply to pin 8 on the SN754410NE chip. Unfortunately when I powered this up the first capacitor behind the positive power supply exploded and I have to immediately switch everything off!!! Now I feel like giving up.... I don't know what to try next... any suggestions welcome. Thanks.

this is the script:-

// capacitor sensing with 4060 chip

#include <LiquidCrystal.h>
#include <Stepper.h>
#define STEPS 200 // edit this for your specific motor with no. of steps for 1 revolution

LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // LCD module pins
const int pwPin = A2; // sense foil on pin A2

//variables needed to store values
long pulse; // reading from foil capacitor through 4060 chip
int previous = 0; //motor previous reading from analogue input sensor -dont need this as using foil thing
long factor = -0.01; // preset factor to convert pulse to suitable no. of steps for required shaft extension
int m; // makes the variable m integer

Stepper stepper(STEPS, 8, 9, 10, 11); // defines no. of steps per revolution and digi pins in use to control motor

void setup()
{

//This opens up a serial connection to shoot the foil pulse results back to the PC console
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("readfoil");
// set the speed of the motor to 900 RPM -3cm in 1 sec -might be too fast causing low torque?
stepper.setSpeed(60);
pinMode(12, INPUT); // digipin 12 senses pushy switch

}

void loop() {

pinMode(pwPin, INPUT);

pulse = pulseIn(pwPin, HIGH);

Serial.print(pulse);
Serial.println();

// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the capacitance reading
lcd.print(pulse); // print sensor output

delay(500); // 0.5 of a sec delay between LCD readings

if(digitalRead(12)){ //i.e if pushy switch is being pressed right now then
m = pulse * factor;

// move motor a number of steps equal to the change in the
// sensor reading
stepper.step(m - previous); //move forwards the required distance m
delay(5); // delay 5 milliseconds
stepper.step(-m); // move backwards to original resting position
delay(10000); // ten second delay before pushy switch can be read again, to prevent setting off twice before finishing
}

}

Post your circuit please - it will save unnecessary guesswork...

circuit diagram

I added this lot for power quality, see attached image... just after the black and red cables from the 12vdc supply which were originally in terminal block holes 12 and 13 in the bottom left hand side of my hand drawn diagram.

All values as shown with a 1 milliHenry inductor. What I am not sure of, is that I have put this seeing the chip as integral with the motor power, perhaps this was the wrong thing to do?

can you check the data sheet and your layout ? confirm that Vcc1 (5v common with Arduino) is on pin 16 ?

looks like you have it on pin 9 while pins 1 and 16 are connected. and Vcc1 is only connected to pin 9

If it is the stepper motor which is not working, write a separate sketch and make another circuit, which just tests the stepper motor only. Make sure both the software and hardware are working, and then integrate into your actual system.

It seems to me, to drive a bipolar stepper motor properly, you need 4 half bridges with 8 control inputs. I can see a diagram in the datasheet for your quad h-bridge device, showing what appears to be a stepper motor, but I cannot see how the indicated application circuit would actually work.

It also seems to me, you would be better off with a proper stepper motor driver, which does all the work of regulating the current, timing the switching, and preventing h-bridge shoot-through. Such as one of these

and there are other related devices with higher ratings.

what kind of stepper motor are you using. Do you know any of the parameters of it ? What is the resistance of each of the phase windings ?

dave-in-nj:
can you check the data sheet and your layout ? confirm that Vcc1 (5v common with Arduino) is on pin 16 ?

looks like you have it on pin 9 while pins 1 and 16 are connected. and Vcc1 is only connected to pin 9

AAAHH! I see this now! This is wrong on my board, I need to add 5V power to pins 16+1. Well spotted! thanks.... I will change this.

In the future, it helps if you resample images to a size that can display on the screen without scrolling around.

Glad you found the problem!

OK I have soldered the extra connections required to put 5V power from the arduino onto pin 1 and 16 on the stepper chip. I have removed the extra power decoupling stuff (as per grumpy mikes webpage) to go back to the original layout. I power up and still see no voltage across any of the 4 wires to the motor, when I press the switch. The only thing that happens when I press the push-to-make switch is the LCD display temporarily clears and comes back on.

I have replaced the 47 uF capacitor on the power decoupling circuit but have not added this back in, am I right to incorporate this assuming this goes immediately after the 12V DC black and red terminals (ie, assuming the stepper chip is seen as an integral part of the motor )?

the stepper motor is from SK pang, 12 vdc, 0.4a, 30 ohms phase resistance

here is a pic of my circuit...

Any more comments are greatly appreciated...

It would be much better, and easier, to drive that stepper motor with a proper stepper motor driver. For example, this Pololu A4988 web page has a great deal of information.

...R