Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Measurig model bridge stress on: May 23, 2013, 01:55:19 pm
Hello!  One of my teachers asked me to help come up with an Arduino based approach to measuring the load carrying abilities of model bridges being made by other classes. We looked into load cells (which are way too expensive), hacking preexisting scales (which we have no idea how to do), and various other weight sensors for the task, but nothing looks like it will work.  This is the main problem: every year, at least one person builds a bridge with a 400lb+ capacity.  Load cells that can handle that are way out of the budget.  One idea we've been toying with is using a piston with a pressure sensor in it to approximate the weight (we'd probably do a few tests and find a best fit equation for it).  How feasible is this?  I figure that there must be some reason I've never heard of anyone using something like this.  Thank you!
~Eric
2  Using Arduino / Motors, Mechanics, and Power / Re: Servo CAD on: November 15, 2012, 01:02:11 pm
THANKS!!  I hope it's accurate
3  Using Arduino / Motors, Mechanics, and Power / Servo CAD on: November 15, 2012, 10:45:15 am
Hello
I was wondering if anyone had any CAD drwaings of
a standard size Hitec 311 digital servo or something
similar?  I'm building a robot arm, and need to make
brackets, which I need a reference for.
Thank you!

4  Using Arduino / Programming Questions / Narcolepsy on: November 14, 2012, 06:15:16 pm
Hello
I am getting some errors with a program.
Errors:

sketch_nov14a.cpp: In function 'void loop()':
sketch_nov14a:61: error: 'Narcoleptic' was not declared in this scope

Here is my code:
Code:
#include <Servo.h>
#include <Narcoleptic.h>

/*
A library that allows the microcontroller to go into standby
in times of inactivity, saving energy.
*/
 
Servo myservo;
int Value;
int Center=105;

/*
The variable Center represents the value of centering of
servo continuous rotation. In my case is 105.
*/

void setup() {
  Serial.begin(9600);
  myservo.attach(9); // Connect the servo to pin 9
}

void loop() {
  int sensorValue = analogRead(A0);  // Read the value of the sensor LDR left
  int sensorValue2 = analogRead(A1); // Read the value of the sensor LDR right
 
  Value=(sensorValue-sensorValue2)/10; 

   /*
   Calculates the difference between the two sensors and divides them for 10,
   in this way a difference of 10 is equal to 1, a difference
   of 53 is equivalent to 5 and so on
   */
 
  if (Value==0) myservo.detach(); else myservo.attach(9);
   
 
  if (Value>10) Value=10;
  if (Value<-10) Value=-10;
 
   /*
   Limits the maximum difference between -10 and + 10
   (to avoid excessive speed)
   */
 
  Serial.println(Value); // Debug - Displays the value on the serial
  myservo.write(Center+Value);

   /*
   If the value of Value is positive, move the Servo DX, if it is negative SX.
   The speed sould be directly proportional to the absolute value of Value
   */
 
  Narcoleptic.delay(15);

   /*
 I'm using this to save energy.
    */
   
}

Ultimately, I'm trying to make a servo follow the sun.
My Fritzing sketch is attached.  Please help.  Thanks!
5  Using Arduino / Programming Questions / Re: COmpiler issue on: November 12, 2012, 06:52:05 pm
How else would you propose I do the same thing?

The comments look reasonable, but the code doesn't do what the comments say - hardly a good example to set.

All the code has to do is turn the servo 180 degrees, delay for 15ms or so, and turn back 180 degrees.  How could I do this (more efficiently) ?
6  Using Arduino / Programming Questions / Re: COmpiler issue on: November 12, 2012, 02:07:27 pm
How else would you propose I do the same thing?  Coincidentally, the example should do exactly what I need my servo to do....  If you have any suggestions, could you let me know?  Thanks!
7  Using Arduino / Programming Questions / Re: COmpiler issue on: November 12, 2012, 01:45:04 pm
Quote
Here is an example that works:
But, I'm having some problems with other code that I'm not going to show you...

Well, good luck resolving the issues.

It's the example code under file -> examples -> servo -> sweep.
I apologize for the inconvenience.  I thought it came standard
with all installations of the arduino IDE.  Here it is:
Code:
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
int pos = 0;    // variable to store the servo position
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
 
void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

help?
8  Using Arduino / Programming Questions / COmpiler issue on: November 12, 2012, 10:39:22 am
Hello!
I am having a compiling issue.  When I try to compile the example servo code that comes with the IDE, I get this error:  

Sweep.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Users\Owner\AppData\Local\Temp\build1200514424625972248.tmp/Sweep.cpp:8: undefined reference to `Servo::Servo()'
Sweep.cpp.o: In function `loop':
C:\Users\Owner\AppData\Local\Temp\build1200514424625972248.tmp/Sweep.cpp:23: undefined reference to `Servo::write(int)'
C:\Users\Owner\AppData\Local\Temp\build1200514424625972248.tmp/Sweep.cpp:28: undefined reference to `Servo::write(int)'
Sweep.cpp.o: In function `setup':
C:\Users\Owner\AppData\Local\Temp\build1200514424625972248.tmp/Sweep.cpp:15: undefined reference to `Servo::attach(int)'

I have managed to compile other code perfectly, so I don't think it's a driver issue........

Here is an example that works:
 
Code:
int servoPin     =  2;    // control pin for servo motor  
int minPulse     =  600;  // minimum servo position  
int maxPulse     =  2400; // maximum servo position  
int turnRate     =  100;  // servo turn rate increment (larger value, faster rate)  
int refreshTime  =  20;   // time (ms) between pulses (50Hz)  
  
/** The Arduino will calculate these values for you **/  
int centerServo;         // center servo position  
int pulseWidth;          // servo pulse width  
int moveServo;           // raw user input  
long lastPulse   = 0;    // recorded time (ms) of the last pulse  
  
  
void setup() {  
  pinMode(servoPin, OUTPUT);                                       // Set servo pin as an output pin  
  centerServo = maxPulse - ((maxPulse - minPulse)/2);  
  pulseWidth = centerServo;                                        // Give the servo a starting point (or it floats)  
  Serial.begin(9600);  
  Serial.println("      Arduino Serial Servo Control");  
  Serial.println("Press < or > to move, spacebar to center");  
  Serial.println();  
}  
  
void loop() {  
                                                                    // wait for serial input  
  if (Serial.available() > 0) {  
                                                                    // read the incoming byte:  
    moveServo = Serial.read();  
                                                                    // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really)  
    if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; }  
    if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; }  
    if (moveServo == 32) { pulseWidth = centerServo; }  
  
                                                                    // stop servo pulse at min and max  
    if (pulseWidth > maxPulse) { pulseWidth = maxPulse; }  
    if (pulseWidth < minPulse) { pulseWidth = minPulse; }  
  
                                                                    // print pulseWidth back to the Serial Monitor (uncomment to debug)  
     Serial.print("Pulse Width: ");  
     Serial.print(pulseWidth);  
     Serial.println("us");   // microseconds  
  }  
  
  // pulse the servo every 20 ms (refreshTime) with current pulseWidth  
  // this will hold the servo's position if unchanged, or move it if changed  
  if (millis() - lastPulse >= refreshTime) {  
    digitalWrite(servoPin, HIGH);   // start the pulse  
    delayMicroseconds(pulseWidth);  // pulse width  
    digitalWrite(servoPin, LOW);    // stop the pulse  
    lastPulse = millis();           // save the time of the last pulse  
  }  
}  

Please help!  Thanks!
9  Using Arduino / General Electronics / Re: Controling three servos on: November 08, 2012, 01:36:55 pm
DuaneB, thank you very much for your response!  This is exactly what I was looking for!
10  Using Arduino / General Electronics / Controling three servos on: November 07, 2012, 11:30:18 pm
I'm about to begin a project in which I need to control three servos,
and my idea of what my project would look like is in the picture below
(made in Fritzing).  First of all, can this work?  I have three 4.8-6 volt
servos connected to the five volt on the arduino.  If not, how do I fix
this?  In addition, I'm new to the forums, and probably uploaded the image
incorrectly, so it's attached as well.  Any help with that would be great,
too!  Thanks!
Pages: [1]