Show Posts
Pages: 1 ... 44 45 [46] 47 48 49
676  Community / Exhibition / Gallery / Re: My first arduino project, Overhead crane on: September 13, 2012, 05:57:47 pm
the crane is more for showing a purpose than giving perfect precision.

Of course..  Your vid answered my question pretty much.  Could the two cranes be synchronous. That it very nice!  I bet you have a few hours invested.  If I was a train modeler, I would definitely buy one!
677  Community / Exhibition / Gallery / Re: My first arduino project, Overhead crane on: September 13, 2012, 02:55:03 pm
Very nice.   I see there are more magnets on your containers, will there be more electro-magnets on the crane for stability?
678  Topics / Product Design / Re: What is the best free PCB designing application..?? on: September 10, 2012, 06:52:36 pm
I personally recommend a paid programme that is circuit wizard its a complete suite that meshes well with user and also provides the simulation capability so you can test your pcb prior to ordering them in bulk that is crucial i think ,although i have used kiCad, eagle but they lack in the simulation thing that is provided by this circuit wizard and user interface is awesome too.

Curcuit Wizard is pretty sweet, user friendly = easy to learn.  In just 10 minutes, I made a schematic and a PCB of a simple circuit.  My main program is Fritzing though...  I like how it's laid out.
679  Using Arduino / Displays / Re: Nuelectronic 2.8 tft touch screen library and examples on: September 08, 2012, 09:54:01 am
Click my link and their will be a post from the old Arduino forums that even contains some sketches.

Also, you may try to find a part numbers off one of the chips and Google it.  There probably is a library for the driver chip that you can find by searching in these forums.
680  Using Arduino / Displays / Re: Nuelectronic 2.8 tft touch screen library and examples on: September 07, 2012, 05:27:50 pm
http://lmgtfy.com/?q=Nuelectronic+2.8+tft
681  Using Arduino / LEDs and Multiplexing / Re: seven segment playground library on: September 06, 2012, 07:56:55 pm
What code?  Did you install the library?
682  Development / Other Software Development / Re: Custom syntax highlighting and dark UI on: September 06, 2012, 05:55:46 am
Think this is pretty sweet.  Would like a tutorial or maybe a zip file with updated files...
683  Using Arduino / Project Guidance / Re: Mega 2560 servo pins & Fio AREF on: September 02, 2012, 11:52:34 am
Here is a spreadsheet that states what pins are on what timers. https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0
684  Using Arduino / Programming Questions / Re: detonator on: August 27, 2012, 12:17:40 pm
Quote
This video is private
685  Using Arduino / Programming Questions / Re: Servo Library and NewPing Interrput Conflict? on: August 25, 2012, 12:11:35 pm
I actually did rearrange the pins last night after you reply.  It did help in a way.  The servos that are controlled by the Ping sensor stop jittering with the other servos.  But the servos connected to the joystick are still jittering.  I am thinking that the joystick is getting some kind of noise from somewhere.  Since the joystick is not going to be the permanent solution for those servos, I will not worry about those for now.  I may stick my O-scope on them just out of curiosity.

Just for information if anyone else is having similar problems, here is a spreadsheet that states what pins are on what timers. https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Thanks for the help Paul.  
686  Using Arduino / Programming Questions / Re: Servo Library and NewPing Inturrput Conflict? on: August 24, 2012, 08:54:01 pm
Servos, commanded using the Servo library are sent new position data based on timers. There are limited number of timers available. Those same timers are responsible for PWM on the PWM pins. Using a pin for a servo effectively removes the ability to perform PWM on some pins. Which ones depends on which timers has been usurped for the Servo libraries use. Which timer is usurped depends on the pin the servo is connected to.

Is it possible to change servo pins to correct this?

Ping sensors do not return a value to an analog pin. Some other kinds of ultrasonic sensors do. You realyl would need to tell us what kind of sensor you really have.

I have a HC-SR04.   Datasheet

You include the NewPing header file, but never instance the NewPing class. Including the NewPing header file is, therefore, useless. Why do you do it?

I used the example code from the NewPing library.  Not entirely sure what you are referring to here..

Code:
// ---------------------------------------------------------------------------
// Example NewPing library sketch that does a ping about 20 times per second.
// ---------------------------------------------------------------------------

#include <NewPing.h>

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}

void loop() {
  delay(50);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");
}
687  Using Arduino / Programming Questions / Re: Servo Library and NewPing Inturrput Conflict? on: August 24, 2012, 04:45:53 pm
Here is the thread that started this line of thinking:  http://arduino.cc/forum/index.php/topic,119408.0.html

Servos are powered by a bench supply running at 7v.  Arduino is powered by USB. All of common ground.  Tried decoupling caps but with no change.

In a few days, they will all be battery powered.  Waiting for the large rechargeable battery to be shipped.
688  Using Arduino / Programming Questions / Servo Library and NewPing Interrput Conflict? on: August 24, 2012, 03:23:39 pm
I have a Mega2560 with a HC-SR04 Ping sensor with a few servos.  I have set up so that if the ping is under a curtain distance, the servo activates.  Unfortunately, I have other servos that are not controlled by the Ping sensor and I believe that they are running on the same interrupt.  This is making the servos "jump" around.  I am not %100 sure that this is an interrupt conflict but I cannot find anything else that is causing the servos to jump.  

The other servos are being controlled by a joystick.  The joystick isn't permanent because I will eventually have them operating with face recognition.  I am just doing one step at a time..

The project is a robotic "head" with eyes and eyelids being controlled by servos.  The Ping sensor is for the eyelids.  If an object gets to close to the face, the eyelids close.

I do not know much about interrupts and I am currently researching this, but figured if anyone would be willing to help out in anyway, it would be greatful.

I am attaching the libraries.

Code:
#include <Servo.h>
#include <NewPing.h>

#define TRIGGER_PIN  8  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     9  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

unsigned int pingSpeed = 50; // How frequently are we going to send out a ping (in milliseconds). 50ms would be 20 times a second.
unsigned long pingTimer;     // Holds the next ping time.

Servo righteyelid;
Servo lefteyelid;
Servo EyeUpDown;
Servo EyeLeftRight;

int potpin = A1;   // analog pin used to connect the potentiometer
int val;           // variable to read the value from the analog pin
int potpin2 = A5;  // analog pin used to connect the potentiometer
int val2;          // variable to read the value from the analog pin

void setup() {
  Serial.begin (115200);
  EyeUpDown.attach(46);
  EyeLeftRight.attach(48);
  righteyelid.attach(50);    // attaches servo on Right Eye Lid
  lefteyelid.attach(52);     // attaches servo on Left Eye Lid
}

void loop() {
  unsigned int uS = sonar.ping();     // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");

  if (uS / US_ROUNDTRIP_CM <= 8 && uS / US_ROUNDTRIP_CM > 0)         //if distance is less than 8 cm, close eye lids
  {
    righteyelid.write(60);                //Closed postion of Right Eye
    lefteyelid.write(135);                //Closed position of Left Eye
  }
  else
  {
    righteyelid.write(95);                //open postion of Right Eye
    lefteyelid.write(96);                 //open postion of Left Eye
  }
  {
    val = analogRead(potpin);             // reads the value of the potentiometer (value between 0 and 1023)
    val = map(val, 0, 1023, 40, 170);     // scale it to use it with the servo (value between 0 and 180)
    EyeUpDown.write(val);                 // sets the servo position according to the scaled value

    val2 = analogRead(potpin2);            // reads the value of the potentiometer (value between 0 and 1023)
    val2 = map(val2, 0, 1023, 40, 150);    // scale it to use it with the servo (value between 0 and 180)
    EyeLeftRight.write(val2);              // sets the servo position according to the scaled value
  }
}
689  Using Arduino / Programming Questions / Re: Servo Jitter on: August 21, 2012, 09:04:03 pm
Are you saying the jitter occurs when you read the ultrasonic sensor?

I don't know how you're accessing the sensor, but does it involve disabling interrupts? I think the Servo library relies on timer interrupts. If this is the problem, you could probably reproduce it by setting all the servos to a constant position and then just reading the sensor repeatedly. I don't know how you would resolve it, but one option might be to detach the servos while you take a reading.

I think you may have realized my problem.  I have read on this forum about the servo library and the ultrasonic sensor using Interrupts.  I do not know which Interrupt Servo library is using.  I just skimmed through the library and I know that my 4 servos are on one interrupt.  I just don't know which one..  I am using the Mega...  If I could get some hints on where to look in the library would be beneficial for my understanding.

If I can find out which interrupt the Mega is running the servos, I am sure I could find the NewPing library interrupts and see if I can change them.

I have attached the Servo library.
690  Using Arduino / Programming Questions / Re: Servo Jitter on: August 21, 2012, 03:48:33 pm
..the joystick value could easily jump  +/-3 when using longer wires.. try to connect 100nF capacitors onto analog inputs (analog input--100nF--GND)..

Tried the Caps but no luck.  The wires right now are ~6in jumper wires on a breadboard.  It could be just noise as I have other things connected.  But nothing high voltage.

Could be time outs.
Have a look around for teckel's sonar library

Also implemented his library with no luck on getting the jitters out. 

Revised Code:

Code:
#include <Servo.h>
#include <NewPing.h>

#define TRIGGER_PIN  8  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     9  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

unsigned int pingSpeed = 50; // How frequently are we going to send out a ping (in milliseconds). 50ms would be 20 times a second.
unsigned long pingTimer;     // Holds the next ping time.

Servo righteyelid;
Servo lefteyelid;     

Servo EyeUpDown;
Servo EyeLeftRight;

int potpin = A1;   // analog pin used to connect the potentiometer
int val;           // variable to read the value from the analog pin
int potpin2 = A5;  // analog pin used to connect the potentiometer
int val2;          // variable to read the value from the analog pin

void setup() {
  Serial.begin (115200);
  EyeUpDown.attach(46);
  EyeLeftRight.attach(48);
  righteyelid.attach(50);    // attaches servo on Right Eye Lid
  lefteyelid.attach(52);     // attaches servo on Left Eye Lid
}

void loop() {
  unsigned int uS = sonar.ping();     // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");

  if (uS / US_ROUNDTRIP_CM <= 8 && uS / US_ROUNDTRIP_CM > 0)         //if distance is less than 8 cm, close eye lids
  {
    righteyelid.write(60);                //Closed postion of Right Eye
    lefteyelid.write(135);                //Closed position of Left Eye
  }
  else
  {
    righteyelid.write(95);                //open postion of Right Eye
    lefteyelid.write(96);                 //open postion of Left Eye
  }
  {
    val = analogRead(potpin);             // reads the value of the potentiometer (value between 0 and 1023)
    val = map(val, 0, 1023, 40, 170);     // scale it to use it with the servo (value between 0 and 180)
    EyeUpDown.write(val);                 // sets the servo position according to the scaled value

    val2 = analogRead(potpin2);            // reads the value of the potentiometer (value between 0 and 1023)
    val2 = map(val2, 0, 1023, 40, 150);    // scale it to use it with the servo (value between 0 and 180)
    EyeLeftRight.write(val2);              // sets the servo position according to the scaled value
  }
}
Pages: 1 ... 44 45 [46] 47 48 49