Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Aluminum Proximity on: January 19, 2014, 02:17:37 pm
Unless you're working with pure refined aluminum, I think the problem you'll find is that most aluminum is aluminum "alloy" whereby the aluminum is mixed with different metals in order to gain certain properties.  Aluminum cans for instance contains mostly aluminum but also small amounts of magnesium,manganese, iron, and I believe some silicon and some copper. 
2  Using Arduino / Sensors / Re: Interrupt help (solved) on: January 19, 2014, 01:53:34 pm
Hi Velocity101

I'm a newbie to Arduino myself and am yet to get my hands on any hardware :-( though I have got some programming background from many years ago.

I know you have solved the issue by initialising the flag as suggested, though I thought I'd chip in and add to what has already been said.

I'm not sure how much programming experience you have but one thing I learn early was "uninitialized variables are bad news". The reason is they can cause unpredictable behaviour.

This is especially true when you consider in C (unlike most other programming languages) there is no true boolean variables - they are stored as unsigned integers.

a value of 0 is interpreted as False
any other (non-zero) value is interpreted as true.

This means that is you define a boolean variable it's more than likely to be "true" - unless you initialise it to 0 (false).

If you already know this then feel free to ignore me an hopefully it helps someone else...


Hi TallOne,

I definitely appreciate your tip.  Thanks!
3  Using Arduino / Motors, Mechanics, and Power / Re: [HELP] Move servo upon interrupt tripped. on: January 17, 2014, 02:20:03 pm
If you are trying to power the servo from the arduino, then you may be shorting out/resetting the arduino power when the servo tries to move.

Yup. Realized that but I'm actually powering it from a bench regulated DC variable power supply.  It can handle up to 5 amps and the circuit hardly draws more than 0.5 amps.
4  Using Arduino / Motors, Mechanics, and Power / Re: [HELP] Move servo upon interrupt tripped. on: January 16, 2014, 11:23:27 pm
Could it be that your interrupt pin is left floating and is picking up interference from the motor?  If the interrupt is coming from a switch connecting to +5V you need a pull-down resistor on the pin to keep it at Ground when the switch is open. Unconnected is not the same as 0V/Ground.

Hi John,

I thought that might be the case as well and already have a 10k pull down resistor on INT0 to ground.  Still does it.  I put a multimeter on that pin and without the servo attached to its pin INTO reads what it's supposed to "0" without any fluctuations.  Once I hook up the servo to its control pin, INT0 swings up and down wildly...  I may have to resort to using a separate NANO to control just the servo and isolate it--accepting a TTL signal from the 1st NANO to trigger the servo actuation sequence... not very elegant and wasteful of two microcontrollers when one should have done.

From what you see, my sketch looks correct?
5  Using Arduino / Motors, Mechanics, and Power / [HELP] Move servo upon interrupt tripped. on: January 16, 2014, 07:44:59 pm
Hi all,

I'm trying to get a servo arm to swing upon an interrupt (INT0) being tripped.  The issue is that it seems like the servo is pulsing back into the arduino (NANO) and tripping the interrupt pin.  What happens is the servo moves slightly and then the interrupt is tripped in a never-ending loop.  With the servo pin pulled (disconnected) the sketch runs fine (both LED and LCD function as programmed and no false interrupt trips).

What am I doing wrong?


Code:
/*

*/

// Servo
#include <Servo.h>


// I2C LCD
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x20,20,4);

// Interrupt
volatile boolean flag = false; // assign an initial value to the interrupt


// Variables for all
const int led = 5;
const int servoPin = A3;
const int trimPotPin = A2;
int val = 0; // variable to read the value from the analog pin
Servo myservo; // create servo object to control the servo



// --------------------------------------------------------
void setup ()
{
  attachInterrupt (0, isr, RISING);  // attach interrupt handler
  
  pinMode (led, OUTPUT);
  
  // LCD
  lcd.init();    
  lcd.backlight();
  
  // SERVO
  myservo.attach(servoPin);
  
  
}  // end of setup


//----------------------------------------------------------

void loop ()
{
  
  
  // Trim POT to move the servo arm into place --------------------------------------
  val = analogRead(trimPotPin);            
  val = map(val, 0, 1023, 0, 179);    
  myservo.write(val);                  
  delay(15);                          
  
  
  if (flag)
  {
      
    // Do this when hit is detected
    digitalWrite(led,HIGH);
    lcd.clear();
    lcd.print("Detected"); // Print to LCD
    myservo.write(90); // swing the servo arm
        
    delay(3000); // Sets the delay for reset
    
    // RESET back to ready state
    digitalWrite(led,LOW);
    lcd.clear();
    myservo.write(0); // return servo arm back to ready position
    
    }
  
  flag = false; // clears the initial "TRUE" value so that we can again wait
                // for another interrupt signal

}  // end of loop


// --------------------------------------------------------
// Interrupt Service Routine (ISR)
void isr ()
{
 flag = true;
}  // end of isr



6  Using Arduino / Sensors / Re: Interrupt help (Solved) on: January 16, 2014, 03:33:19 am

Seriously?
1)

Code:
volatile boolean flag = false;

2)
Code:
flag = false;

That did the trick!  Sorry for the newbie question.  Thanks so much for your help!
7  Using Arduino / Sensors / Re: Interrupt help on: January 16, 2014, 03:16:20 am
Assign an initial value to flag.
Clear flag once you have acted upon it.

Can you give me an example? (sorry, I'm still learning).
8  Using Arduino / Sensors / Interrupt help (solved) on: January 16, 2014, 02:58:41 am
Hi all,

I'm sure I'm making a simple newbie mistake here.  What I need to happen is do some work when an interrupt (INT 0) is detected; like light an LED and also print some text on an LCD.  When I run the sketch below, the LED stays constantly lit and the LCD prints the text regardless of any interrupt being detected (I have a sensor attached to it--which I know works fine).

Any tips/advice you can give would be greatly appreciated!


Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x20,20,4);

volatile boolean flag;
const int led = 5;

// Interrupt Service Routine (ISR)
void isr ()
{
 flag = true;
}  // end of isr

void setup ()
{
  attachInterrupt (0, isr, RISING);  // attach interrupt handler
  pinMode (led, OUTPUT);
  
  lcd.init();   // initialize the lcd
  lcd.backlight();
  
}  // end of setup

void loop ()
{
  if (flag)
    {
    // interrupt has occurred
    digitalWrite(led,HIGH);
    lcd.clear();
    lcd.print("Detected");
    
    }
  
}  // end of loop

9  Community / Gigs and Collaborations / Re: Paid assistance on IR Sensor Project on: April 24, 2013, 01:33:57 am
So, your objective is simply to annunciate1 a projectile's presence in the "window", ideally from as close to its breaking the plane as possible?
To me, that would be an Arduino misapplication. 

I would look at using:
1) an RS Latch (a/k/a SR Latch)
http://www.jameco.com/Jameco/Products/ProdDS/13004.pdf
possibly conditioned with a
2) a "one-shot" multivibrator [trigger]
http://www.jameco.com/Jameco/Products/ProdDS/252259TI.pdf

Still, you need to supply more information.
The projectile has some length and travels at some speed, within tolerances, so you should (need to) come up with a figure for how long the detection event will last, even if ideally so.

Can the IRED emitter/detector operate at that speed?


1 - trip an LED, trigger a flash, etc.

Would you be interested in helping me with this circuit if I paid you?
10  Community / Gigs and Collaborations / Re: Paid assistance on IR Sensor Project on: April 19, 2013, 10:29:42 pm
How long will it take for this bullet to pass through this square frame?
How long could the bullet obstruct the IR between the emitter and photodiode?
In other words, what's the maximum pulse width that could result?
[Very short time, very short pulse width - probably too short. Could an Arduino interrupt even notice it?]

Not sure what the pulse width would need to be but the bullet would be traveling up to 3,500 feet per second.  If not an arduino, any suggestion how to accomplish this with something else?
11  Using Arduino / Project Guidance / IR Bullet Sensor - help needed on: April 19, 2013, 03:32:51 am
This is a personal hobby project of mine that I haven’t been able to make work myself but you electronics guru’s should be able to do in your sleep.

I am trying to create an IR sensor array which detects a high-velocity bullet passing through a square frame which is set several yards away.  Upon detection, it instantly triggers an Arduino pin to go high.  This is much like a chronograph but I do not need it to measure velocity, just detect the passing of a bullet. Below is a crude (don't laugh) drawing of what it might look like.
  
I'm using a BPV10NF Photodiode and a TSAL5100 Emitting Diode and cannot get them to be sensitive enough to detect something as small as a bullet to send an Arduino pin high (or low)--even with using a rising or falling edge interrupt (or maybe I'm not writing the sketch correctly). 

Requirements:
I need help with a basic schematic and parts list along with an Arduino sketch so that I may build it on my home workbench. I am willing to pay someone to help me make this project work; please PM me.

12  Community / Gigs and Collaborations / Paid assistance on IR Sensor Project on: April 18, 2013, 05:19:40 pm
This is a personal hobby project of mine that I haven’t been able to make work myself but you electronics guru’s should be able to do in your sleep.

I am trying to create an IR sensor array which detects a high-velocity bullet passing through a square frame which is set several yards away.  Upon detection, it instantly triggers an Arduino pin to go high.  This is much like a chronograph but I do not need it to measure velocity, just detect the passing of a bullet. Below is a crude (don't laugh) drawing of what it might look like.
  
I'm using a BPV10NF Photodiode and a TSAL5100 Emitting Diode and cannot get them to be sensitive enough to detect something as small as a bullet to send an Arduino pin high (or low)--even with using a rising or falling edge interrupt (or maybe I'm not writing the sketch correctly). 

Requirements:
I need help with a basic schematic and parts list along with an Arduino sketch so that I may build it on my home workbench. I am willing to pay someone to help me make this project work; please PM me.

13  Using Arduino / Project Guidance / Re: Bullet sensor build help on: December 11, 2012, 03:47:57 pm
Quote
very interesting that all your chrono needed was to watch for a drop in light.  I'm wondering how far above the sensors the bullet can be as still be detected.

The window is a triangle about a foot or 18" tall.

I just visited the manufacturer's web site (not much hard data there), looks like some of their newer models include IR illuminators, so it's watching for a reflection rather than a shadow.  The older passive models are still available.

-j


Great! So this is essentially what I'm trying to achieve! Good to know the approach I plan to take is feasible.
14  Using Arduino / Project Guidance / Re: Bullet sensor build help on: December 11, 2012, 06:46:13 am

Quote
The best way to trigger the Arduino is probably to use a rising or falling interrupt, that way it can response to very short pulses.


Ah, good idea. Thanks!
15  Using Arduino / Project Guidance / Re: Bullet sensor build help on: December 11, 2012, 04:42:11 am
Quote
  Also, do you think that the 20us
Think of it as 320 instruction cycles.

So at 16Mhz, the Arduino is capable of handling 16 Million cycles per second, right? Then I'd say it'll do, lol.  Thanks, AWOL.
Pages: [1] 2 3 4