[x] Welcome at THunting.com!

A fun place to talk about Metal Detecting, Treasure Hunting & Prospecting. Here you can share finds and experience with thousands of members from all over the world

Join us and Register Now - Its FREE & EASY

THunting.com
Treasure Hunting & Metal Detecting Community
   
Advanced Search
*
Welcome, Guest! Please login or register HERE - It is FREE and easy.
Only registered users can post and view images on our message boards.
Did you miss your activation email?

Login with email, password and session length
Or Login Using Social Network Account
2
News:
Attention!

Attention: This topic has been locked. Hence no new replies can currently be posted to it.

Pages: 1    Go Down
Print
Share this topic on FacebookShare this topic on Del.icio.usShare this topic on DiggShare this topic on RedditShare this topic on Twitter
Tags:
0 Members and 1 Guest are viewing this topic.
Offline Sergio Dennis Sanchez MadrigalTopic starter
Pull Tab
*

Join Date: Jul, 2015
Thank you8

Activity
0%
Posts: 16
Referrals: 0

455.00 Gold
View Inventory
Windows XP
Windows XP
Firefox 40.0
Firefox 40.0

Awards
« on: August 20, 2015, 09:45:03 am »
Go Up Go Down

this project maybe very interesting....
this is the code atmega328 arduino sketch. look at...
// Arduino Five Coil Metal Detector

/* V21 - Production Version with dynamic thresholds and auto calibrate, Adjusted LED Brightness to maximum

*/

int ledthreshold1 = 40;
int ledthreshold2 = 40;
int ledthreshold3 = 40;
int ledthreshold4 = 40;
int ledthreshold5 = 40;

int threshdiff = 15; // Add to average to become specific threshold where LED will light (Changed V21 from 25 to 20)

long pulse1 = 0; // Stores the length of pulses in microseconds 
long pulse2 = 0; // Stores the length of pulses in microseconds
long pulse3 = 0; // Stores the length of pulses in microseconds
long pulseav = 0; // Stores value of output for calibration

int minthresh = 20; // Minimum threshold for baseline reading
int startdelay = 700; // Start at this value and work down for calibration


long pcounterA; // Counts the number of pulses in each cycle
long pcounterB; // Counts the number of pulses in each cycle
long pcounterC; // Counts the number of pulses in each cycle
long pcounterD; // Counts the number of pulses in each cycle
long pcounterE; // Counts the number of pulses in each cycle


int dly1 = 300; // Delay before sampling pulsewidth A
int dly2 = 300; // Delay before sampling pulsewidth B
int dly3 = 300; // Delay before sampling pulsewidth C
int dly4 = 300; // Delay before sampling pulsewidth D
int dly5 = 300; // Delay before sampling pulsewidth E


void setup()
{

Serial.begin(115200); // Setupserial interface for test data outputs

pinMode(2,INPUT); // Calibrate Button

pinMode(3,OUTPUT); // Pulse output from D3 Arduino
pinMode(4,INPUT); // Signal from LM339 in read by D4 on Arduino

pinMode(5,OUTPUT); // Pulse output from D5 Arduino
pinMode(6,INPUT); // Signal from LM339 in read by D6 on Arduino

pinMode(7,OUTPUT); // Pulse output from D5 Arduino
pinMode(8,INPUT); // Signal from LM339 in read by D6 on Arduino

pinMode(9,OUTPUT); // Pulse output from D5 Arduino
pinMode(10,INPUT); // Signal from LM339 in read by D6 on Arduino

pinMode(11,OUTPUT); // Pulse output from D5 Arduino
pinMode(12,INPUT); // Signal from LM339 in read by D6 on Arduino

pinMode(14,OUTPUT); // LED output to indicate a find on A0
pinMode(15,OUTPUT); // LED output to indicate a find on A1
pinMode(16,OUTPUT); // LED output to indicate a find on A2
pinMode(17,OUTPUT); // LED output to indicate a find on A3
pinMode(18,OUTPUT); // LED output to indicate a find on A4



}
void loop()
{
// Reset the pulse counter to zero for this cycle of waveform
pcounterA = 0;
pcounterB = 0;
pcounterC = 0;
pcounterD = 0;
pcounterE = 0;


// Auto Calibrate Coil Sensitivity if button pushed

if((digitalRead(2) == LOW) ){
  delay(100); // Debounce by waiting then checking again
  if((digitalRead(2) == LOW) ){
  // Carry out operation
 
  calibrate(); // Sets individual dly variable
 

  }
}



// Pulse and read Coil A three times  ---------------------------------------------

digitalWrite(7,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(7,LOW); // Set low on output pin
delayMicroseconds(dly1); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterA =   pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20);

digitalWrite(7,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(7,LOW); // Set low on output pin
delayMicroseconds(dly1); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterA =  pcounterA + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20);

digitalWrite(7,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(7,LOW); // Set low on output pin
delayMicroseconds(dly1); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterA =   pcounterA + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20);


// Pulse and read Coil B three times  ---------------------------------------------

digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterB =   pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);

digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterB =   pcounterB + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);

digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterB =   pcounterB + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);

// Pulse and read Coil C three times ---------------------------------------------

digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterC = pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);

digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterC = pcounterC + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);

digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterC = pcounterC + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);



// Pulse and read Coil D three times   ---------------------------------------------

digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pcounterD = pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);

digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pcounterD = pcounterD + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);

digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pcounterD = pcounterD + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);



// Pulse and read Coil E three times     ---------------------------------------------

digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterE =   pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);

digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterE =   pcounterE + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);

digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pcounterE =   pcounterE + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);

/*

Serial.print(pcounterA);
Serial.print(" ");
Serial.print(pcounterB);
Serial.print(" ");
Serial.print(pcounterC);
Serial.print(" ");
Serial.print(pcounterD);
Serial.print(" ");
Serial.print(pcounterE);

// Show delay variables

Serial.print("      ");
Serial.print(dly1);
Serial.print(" ");
Serial.print(dly2);
Serial.print(" ");
Serial.print(dly3);
Serial.print(" ");
Serial.print(dly4);
Serial.print(" ");
Serial.print(dly5);

Serial.print("      ");
Serial.print(pulse1);
Serial.print(" ");
Serial.print(pulse2);
Serial.print(" ");
Serial.print(pulse3);
Serial.print(" ");
Serial.println(pulseav);

*/

// Display results
digitalWrite(14,LOW); // Set the output pin to Low to deactivate the LED

if(pcounterA < ledthreshold1)
{
digitalWrite(14,HIGH); // Set the output pin to high to activate the LED
}

digitalWrite(15,LOW); // Set the output pin to Low to deactivate the LED

if(pcounterB < ledthreshold2)
{
digitalWrite(15,HIGH); // Set the output pin to high to activate the LED
}

digitalWrite(16,LOW); // Set the output pin to Low to deactivate the LED

if(pcounterC < ledthreshold3)
{
digitalWrite(16,HIGH); // Set the output pin to high to activate the LED
}

digitalWrite(17,LOW); // Set the output pin to Low to deactivate the LED

if(pcounterD < ledthreshold4)
{
digitalWrite(17,HIGH); // Set the output pin to high to activate the LED
}

digitalWrite(18,LOW); // Set the output pin to Low to deactivate the LED

if(pcounterE < ledthreshold5)
{
digitalWrite(18,HIGH); // Set the output pin to high to activate the LED
}



/* delay(10);  // Sets up LED brightness
// Turn off all LEDs
digitalWrite(14,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(15,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(16,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(17,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(18,LOW); // Set the output pin to Low to deactivate the LED
*/


}


// Subroutines


void calibrate()      {
 
// Turn off all LEDs
digitalWrite(14,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(15,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(16,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(17,LOW); // Set the output pin to Low to deactivate the LED
digitalWrite(18,LOW); // Set the output pin to Low to deactivate the LED

// Calibrate Coil A delay threshold ------------------------------------------------------------

dly1 = startdelay; // Start with very high threshold and work down in steps of 10
pulseav = 0;


while (pulseav <= minthresh ){

  digitalWrite(7,HIGH); // Set the output pin to high
  delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
  digitalWrite(7,LOW); // Set low on output pin
  delayMicroseconds(dly1); // Wait before reading pulses

  // Measure the number of pulses in each cycle produced by the LC circuit

  pulse1 =   pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20); 

  digitalWrite(7,HIGH); // Set the output pin to high
  delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
  digitalWrite(7,LOW); // Set low on output pin
  delayMicroseconds(dly1); // Wait before reading pulses

  // Measure the number of pulses in each cycle produced by the LC circuit

  pulse2 =   pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20);
 
    digitalWrite(7,HIGH); // Set the output pin to high
  delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
  digitalWrite(7,LOW); // Set low on output pin
  delayMicroseconds(dly1); // Wait before reading pulses

  // Measure the number of pulses in each cycle produced by the LC circuit

  pulse3 =   pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20)+ pulseIn(8,HIGH,20) + pulseIn(8,HIGH,20);
 
  pulseav = (pulse1 + pulse2 + pulse3)/3;
 
  // Decrement threshold if output too low
  if(pulseav < minthresh) {
    dly1 = dly1 - 10;
    }
  }
  // Flash LED to prove something done
  digitalWrite(14,HIGH); // Set the output pin to high to activate the LED
  delay(5);
  digitalWrite(14,LOW); // Set the output pin to high to activate the LED

ledthreshold1 = pulseav + threshdiff;

// Calibrate Coil B delay threshold  ------------------------------------------------------------

dly2 = startdelay; // Start with very high threshold and work down in steps of 10
pulseav = 0;


while (pulseav <= minthresh ){

digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse1 =   pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);

digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse2 =   pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);
 
digitalWrite(5,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(5,LOW); // Set low on output pin
delayMicroseconds(dly2); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse3 =   pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20)+ pulseIn(6,HIGH,20) + pulseIn(6,HIGH,20);
 
  pulseav = (pulse1 + pulse2 + pulse3)/3;
 
  // Decrement threshold if output too low
  if(pulseav < minthresh) {
    dly2 = dly2 - 10;
    }
  }
  // Flash LED to prove something done
  digitalWrite(15,HIGH); // Set the output pin to high to activate the LED
  delay(5);
  digitalWrite(15,LOW); // Set the output pin to high to activate the LED
 
  ledthreshold2 = pulseav + threshdiff;
 

// Calibrate Coil C delay threshold  ------------------------------------------------------------

dly3 = startdelay; // Start with very high threshold and work down in steps of 10
pulseav = 0;


while (pulseav <= minthresh ){

digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse1 = pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);

digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse2 = pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);
 
digitalWrite(11,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(11,LOW); // Set low on output pin
delayMicroseconds(dly3); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse3 = pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20)+ pulseIn(12,HIGH,20) + pulseIn(12,HIGH,20);
 
  pulseav = (pulse1 + pulse2 + pulse3)/3;
 
  // Decrement threshold if output too low
  if(pulseav < minthresh) {
    dly3 = dly3 - 10;
    }
  }
  // Flash LED to prove something done
  digitalWrite(16,HIGH); // Set the output pin to high to activate the LED
  delay(5);
  digitalWrite(16,LOW); // Set the output pin to high to activate the LED
 
ledthreshold3 = pulseav + threshdiff;


// Calibrate Coil D delay threshold  ------------------------------------------------------------

dly4 = startdelay; // Start with very high threshold and work down in steps of 10
pulseav = 0;

while (pulseav <= minthresh ){

digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pulse1 = pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);

digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pulse2 = pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);
 
digitalWrite(3,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(3,LOW); // Set low on output pin
delayMicroseconds(dly4); // Wait before reading pulses


pulse3 = pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20)+ pulseIn(4,HIGH,20) + pulseIn(4,HIGH,20);
 
  pulseav = (pulse1 + pulse2 + pulse3)/3;
 
  // Decrement threshold if output too low
  if(pulseav < minthresh) {
    dly4 = dly4 - 10;
    }
  }
  // Flash LED to prove something done
  digitalWrite(17,HIGH); // Set the output pin to high to activate the LED
  delay(5);
  digitalWrite(17,LOW); // Set the output pin to high to activate the LED
 
  ledthreshold4 = pulseav + threshdiff;
 

// Calibrate Coil E delay threshold  ------------------------------------------------------------

dly5 = startdelay; // Start with very high threshold and work down in steps of 10
pulseav = 0;

while (pulseav <= minthresh ){

digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse1 =   pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);


digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse2 =   pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);

digitalWrite(9,HIGH); // Set the output pin to high
delayMicroseconds(5000); // Delay 5000 microseconds before setting low on output pin
digitalWrite(9,LOW); // Set low on output pin
delayMicroseconds(dly5); // Wait before reading pulses

// Measure the number of pulses in each cycle produced by the LC circuit

pulse2 =   pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20)+ pulseIn(10,HIGH,20) + pulseIn(10,HIGH,20);


 
  pulseav = (pulse1 + pulse2 + pulse3)/3;
 
  // Decrement threshold if output too low
  if(pulseav < minthresh) {
    dly5 = dly5 - 10;
    }
  }
  // Flash LED to prove something done
  digitalWrite(18,HIGH); // Set the output pin to high to activate the LED
  delay(5);
  digitalWrite(18,LOW); // Set the output pin to high to activate the LED
 
 
  ledthreshold5 = pulseav + threshdiff;
 

}


Posted on: August 20, 2015, 09:40:30 am
this is the page......

You are not allowed to view links.
Please Register or Login

http://www.instructables.com/id/Arduino-Metal-Detector/


Posted on: August 20, 2015, 09:42:04 am
schematic.....

You are not allowed to view links.
Please Register or Login

http://cdn.instructables.com/FXV/SGW9/IDIN4AF9/FXVSGW9IDIN4AF9.LARGE.jpg

i don t know how to put one image this project

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300341.html#msg300341




Logged
Offline golddustcarl
Silver Member
*

Mood:Happy
Happy

Join Date: May, 2014
Thank you159

Activity
1%
Male
United States
Posts: 1333
Referrals: 0

7377.00 Gold
View Inventory
Windows NT 10.0
Windows NT 10.0
Chrome 42.0.2311.135
Chrome 42.0.2311.135

Awards

NOKTA SIMPLEX+,Tesoro Vaquero, VibraProbe 580, Garrett Carrot, Garrett Master Hunter ADSIII
« Reply #1 on: August 20, 2015, 01:22:49 pm »
Go Up Go Down

I think this should be moved to the downloads section but leave the links here.

I think it is a pretty unique detector. I like the way you thought outside of the box. Good Job

Dusty Carl

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300346.html#msg300346


A bad day at gold prospecting or metal detecting is better than a good day at work.


« Last Edit: August 20, 2015, 01:31:40 pm by golddustcarl »
Logged

GOLDDUST CARL

Offline GoldDigger1950
The Old Man and the Soil
Global Moderator
Platin Member
*****

Just call me GD.
The Old Man and the Soil
Join Date: Jun, 2009
Thank you225

Activity
0%
Male
United States
Posts: 11219
Referrals: 12

47848.00 Gold
View Inventory
Windows NT 10.0
Windows NT 10.0
Firefox 40.0
Firefox 40.0

Awards

Garrett Groundhog ADS, Garrett Sea Hunter, Bounty Hunter Tracker IV, Bounty Hunter Pioneer 505,Minelab Eldorado Mk II, Tesoro Compadre, Tesoro Tiger Shark & A Few Home Brew Detectors
« Reply #2 on: August 20, 2015, 01:26:09 pm »
Go Up Go Down

Maybe so but the code is unverified. I'll see if I can't find it in zip format somewhere because we can't put a text file in downloads or as an attachment.

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300347.html#msg300347




Logged

It's all about that moment when metal that hasn't seen the light of day for generations frees itself from the soil and presents itself to me.
Let's Talk Treasure!

Offline Homefire
Global Moderator
Platin Member
*****

Join Date: Jan, 2009
Thank you662

Activity
0%
Male
United States
Posts: 15906
Referrals: 0

52360.00 Gold
View Inventory
Windows NT 6.3
Windows NT 6.3
Firefox 40.0
Firefox 40.0

Awards
« Reply #3 on: August 20, 2015, 02:05:53 pm »
Go Up Go Down

  Why would any one want to open up all those links  ?


Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300348.html#msg300348




Logged
Offline golddustcarl
Silver Member
*

Mood:Happy
Happy

Join Date: May, 2014
Thank you159

Activity
1%
Male
United States
Posts: 1333
Referrals: 0

7377.00 Gold
View Inventory
Linux
Linux
Chrome 34.0.1847.76
Chrome 34.0.1847.76

Awards

NOKTA SIMPLEX+,Tesoro Vaquero, VibraProbe 580, Garrett Carrot, Garrett Master Hunter ADSIII
« Reply #4 on: August 20, 2015, 03:04:08 pm »
Go Up Go Down

There's only 2 links. the rest is all C code. Would have been better if he had just posted it as a file. The YouTube video shows it working. It's just a simple oscillator circuit that gets loaded down by a target. I  am guessing it doesn't have much depth. Probably best suited for robotic collision avoidance. You must admit it looks pretty cool and not your run of the mill detector. He isn't boasting that it's the next greatest thing, but I  like his thinking.

Welcome to the forum Sergio.

Dusty Carl

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300350.html#msg300350


A bad day at gold prospecting or metal detecting is better than a good day at work.


Logged

GOLDDUST CARL

Offline Sergio Dennis Sanchez MadrigalTopic starter
Pull Tab
*

Join Date: Jul, 2015
Thank you8

Activity
0%
Posts: 16
Referrals: 0

455.00 Gold
View Inventory
Windows XP
Windows XP
Firefox 40.0
Firefox 40.0

Awards
« Reply #5 on: August 20, 2015, 03:09:08 pm »
Go Up Go Down

the code arduino metal detecxtor atmega328 in download. ino format

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300351.html#msg300351




Logged
Offline golddustcarl
Silver Member
*

Mood:Happy
Happy

Join Date: May, 2014
Thank you159

Activity
1%
Male
United States
Posts: 1333
Referrals: 0

7377.00 Gold
View Inventory
Linux
Linux
Chrome 34.0.1847.76
Chrome 34.0.1847.76

Awards

NOKTA SIMPLEX+,Tesoro Vaquero, VibraProbe 580, Garrett Carrot, Garrett Master Hunter ADSIII
« Reply #6 on: August 20, 2015, 05:22:57 pm »
Go Up Go Down

Quote:Posted by Sergio Dennis Sanchez Madrigal
the code arduino metal detecxtor atmega328 in download. ino format


Not to worry anyone. I turned it into a pdf. I  hope this uploads.

Dusty Carl

Posted on: August 20, 2015, 04:18:19 pm
All,

If you click on it and don't see it, check your download folder. It may have went there, or maybe you don't have Adobe Acrobat Reader.

Linkback:

You are not allowed to view links.
Please Register or Login

http://www.thunting.com/smf/index.php/topic,60763.msg300359.html#msg300359


A bad day at gold prospecting or metal detecting is better than a good day at work.

There are 1 attachment(s) in this post which you can not view or download

Please register for viewing them.

Email.pdf


Logged

GOLDDUST CARL

Print
Pages: 1    Go Up
Jump to:  
Attention!

Attention: This topic has been locked. Hence no new replies can currently be posted to it.


Powered by SMF 1.1.19 | SMF © 2005, Simple Machines | Sitemap
Copyright THunting.com