|
451
|
Using Arduino / Motors, Mechanics, and Power / Re: setting an angle on a continuous rotation servo
|
on: February 28, 2011, 12:17:59 am
|
You didn't say what your application is but stepper motors excel in low speed applications. Unlike a brushed DC motor they develop their highest torque at the lowest speed.
Sure enough??! Well, that might be exactly what I need then. Tell me, would SparkFun's stepper motor: http://www.sparkfun.com/products/9238 work to open a drawer in this setting: If I put a small rubber wheel on it (say, 1-1/12") and mounted it under the drawer. The drawer would be the equivilent in weight of a silverware drawer or something, with new, quality drawer glides. Right now I can slide it open and closed with 1 finger. So I would be able to accurately open the drawer 8" without having to have some kind of limit switches? This would be great.
|
|
|
|
|
455
|
Using Arduino / Motors, Mechanics, and Power / gearmotor test doesn't work
|
on: February 26, 2011, 10:49:40 am
|
This simple test sketch gives me an else without if error, but it's right there before it. If I remove the else code it compiles. Is this a bug? const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A) const int motor2Pin = 2; // H-bridge leg 2 (pin 7, 2A) const int ledPin = 13; // LED const int button1Pin = 8; //Forward button const int button2Pin = 9; //Reverse button // variables will change: int buttonState1 = 0; // variable for reading the pushbutton status int buttonState2 = 0; // variable for reading the pushbutton status void setup() {
// set outputs: pinMode(motor1Pin, OUTPUT); pinMode(motor2Pin, OUTPUT); pinMode(ledPin, OUTPUT); pinMode(button1Pin, INPUT); pinMode(button2Pin, INPUT); }
void loop() { // read the state of the pushbutton1 value: buttonState1 = digitalRead(button1Pin); // read the state of the pushbutton1 value: buttonState2 = digitalRead(button2Pin);
if (buttonState1 == HIGH) // check if a pushbutton is pressed. { // turn LED on: digitalWrite(ledPin, HIGH); //turn motor on forward digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high } else if (buttonState2 == HIGH); // check if a pushbutton is pressed. { // turn LED on: digitalWrite(ledPin, HIGH); //turn motor on backward digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge low digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge high } else { // turn LED off digitalWrite(ledPin, LOW); //turn motor off digitalWrite(motor1Pin, LOW); digitalWrite(motor2Pin, LOW); } }
|
|
|
|
|
456
|
Using Arduino / Motors, Mechanics, and Power / Re: max current for v5 pin
|
on: February 25, 2011, 05:17:41 pm
|
|
I dunno, this 7812 gets really hot when my solenoid turns on. It's dropping the voltage from a 12 volt wall wart down to 12 volts, so I didn't think I'd even need a heat sink. The solenoid is 550 mA. I think I'll just use a 9 volt wall wart. (the solenoid turns on if I hook it up to a 9 volt battery). And a 9 volt wall wart will probably end up being closer to 12 volt any way. then I also won't have to worry about the 12 volt wart putting 16 volts into my Uno, when the solenoid is not running.
|
|
|
|
|
459
|
Using Arduino / Sensors / Sensor Test -- something simple must be wrong here?
|
on: February 25, 2011, 02:29:41 pm
|
Testing out a flow sensor ( http://www.seeedstudio.com/depot/datasheet/water%20flow%20sensor%20datasheet.pdf) This blinks the LED normal (2 times, at 1 second each) as the loop shows, but when I blow through the flow sensor, it shows the increasing pulses on the serial monitor, but when it reaches the limit, it flashes the LED 3 times, but so fast I can hardly tell. If I change the line to blink(ledPin, 3, 30000); then it flashes at about one per second! What is wrong here!? const int ledPin = 13; //LED pin volatile int FlowSensorCount; //the counter for the flow sensor
void setup() { //Setup Pins pinMode(ledPin, OUTPUT); attachInterrupt(0, CountPulse, RISING); //turn on interrupt for flow sensor on pin 2 Serial.begin(9600); }
void loop() { Serial.println(FlowSensorCount);
noInterrupts(); if (FlowSensorCount > 30) { blink(ledPin, 3, 3000); delay(5000); FlowSensorCount = 0; } interrupts();
blink ( ledPin, 2, 1000); delay(2000); }
void blink(int whatPin, int howManyTimes, int milliSecs) { int i = 0; for ( i = 0; i < howManyTimes; i++) { digitalWrite(whatPin, HIGH); delay(milliSecs/2); digitalWrite(whatPin, LOW); delay(milliSecs/2); } }
void CountPulse() { FlowSensorCount++; //increases the count from the interupt pin 2 }
|
|
|
|
|
460
|
Using Arduino / Motors, Mechanics, and Power / Re: max current for v5 pin
|
on: February 25, 2011, 10:57:35 am
|
|
I need 12 v to run something else- a solenoid. I'll just through a 7812 on my shield as well to power the Uno Vin pin. With my solenoid and motor power coming directly off my shield, my Uno won't really be drawing a whole lot of current, I don't think, just telling things when to turn on/off, and powering an LCD. I don't need any control over my motor speed, just forward/reverse, and I don't have any extra pins to regulate it's voltage.
|
|
|
|
|
461
|
Using Arduino / Motors, Mechanics, and Power / Re: max current for v5 pin
|
on: February 25, 2011, 10:21:04 am
|
|
Thanks! I think I will remove the DC Jack from the board, and put a DC Jack on my shield. Then I won't have to send any current through the Uno. I'll use a 7805 regulator for my motor. It will be powered from a 12 volt 1 amp wall wart. They run about 16 volts with no load, that should be fine to feed directly from the DC Jack on my shield into the Vin PIN on the Uno to power it, right?
|
|
|
|
|
465
|
Using Arduino / General Electronics / Re: tx & rx pins
|
on: February 24, 2011, 01:44:03 am
|
Yes it's important for code to be clear to a human as well as correct for the computer. And just to show that I don't practice what I preach, here's a line from the app I'm writing now. Serial.print (isprint(((*(start + i)) & 0xFF)) ? (*(start + i)& 0xFF) : '.', BYTE); Quick, you have 5 seconds to tell me what this does  ______ Rob ...errrr, ummmm...
|
|
|
|
|