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
}
}


