Announcement

Collapse
No announcement yet.

Arduino metal detector?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 6666
    replied
    Thanks for the code, but there is a small error when I try and verify the code here is the error message (there is a smiley face in the code would that cause a problem ?)

    Arduino: 1.6.11 (Windows 7), Board: "Arduino Nano, ATmega328"

    C:\Felz\sketch_may01a\sketch_may17a\sketch_may17a. ino: In function 'void loop()':

    sketch_may17a:154: error: expected primary-expression before '{' token

    {

    ^

    sketch_may17a:154: error: expected ')' before '{' token

    sketch_may17a:168: error: expected primary-expression before '}' token

    }

    ^

    sketch_may17a:168: error: expected '}' at end of input

    exit status 1
    expected primary-expression before '{' token

    Leave a comment:


  • homefire
    replied
    Try this. Should give you progressing LED.


    // PI metal detector for arduino version_16_min (C)alex---1967 2015
    byte ss = 0;
    byte c = 0;
    byte i = 0;
    int s0 = 0;
    int s1 = 0;


    void setup()
    {
    DDRB = 0xFF; // port B - all out
    DDRD = 0xFF; // port D - all out

    for (i = 0; i <16; i++) // калибровка / calibration
    {
    s0 = analogRead(A0);
    s1 = analogRead(A0);
    c = c + s1;
    }
    c = c / 16;
    c = c - 2;
    }

    void loop()
    {
    PORTB = B11111111; // переводим пины порта B в 1, открывая т.о. ключ (turn on)
    delayMicroseconds(200); // wait 200 microseconds
    PORTB = 0; // закрывааем ключ, прерывая ток в поисковой катушке (turn off - interrupt circut in search coil )

    s0 = analogRead(A0);
    s1 = analogRead(A0);

    ss = s1 - c;
    ss = ss / 2;

    PORTD = ss; // посылаем на индикатор (send to LEDs)


    delay(4);
    }









    // PI metal detector for arduino version_18_min (C)alex---1967 2015 **** Modified LED Progression I Hope
    int ss0 = 0;
    int ss1 = 0;
    int ss2 = 0;
    long c0 = 0;
    long c1 = 0;
    long c2 = 0;
    byte i = 0;
    int sss0 = 0;
    int sss1 = 0;
    int sss2 = 0;
    int s0 = 0;
    int s1 = 0;
    int s2 = 0;


    void setup()
    {
    DDRB = 0xFF; // port B - all out
    DDRD = 0xFF; // port D - all out

    for (i = 0; i <255; i++) // калибровка / calibration
    {
    PORTB = B11111111; // переводим пины порта B в 1, открывая т.о. ключ (turn on)
    delayMicroseconds(200); // wait 200 microseconds
    PORTB = 0; //
    delayMicroseconds(20);
    s0 = analogRead(A0);
    s1 = analogRead(A0);
    s2 = analogRead(A0);
    c0 = c0 + s0;
    c1 = c1 + s1;
    c2 = c2 + s2;


    delay(3);
    }
    c0 = c0 / 255;
    c0 = c0 - 5;
    c1 = c1 / 255;
    c1 = c1 - 5;
    c2 = c2 / 255;
    c2 = c2 - 5;


    }

    void loop()
    {
    PORTB = B11111111; // переводим пины порта B в 1, открывая т.о. ключ (turn on)
    delayMicroseconds(200); // wait 200 microseconds
    PORTB = 0; // закрывааем ключ, прерывая ток в поисковой катушке (turn off - interrupt circut in search coil )
    delayMicroseconds(20);
    s0 = analogRead(A0);
    s1 = analogRead(A0);
    s2 = analogRead(A0);
    ss0 = s0 - c0;

    if (ss0 < 0)
    {
    sss0 = 1;
    }
    ss0 = ss0 / 16;
    PORTD = ss0; // посылаем на индикатор (send to LEDs)
    delay(1);

    ss1 = s1 - c1;
    if (ss1 < 0)
    {
    sss1 = 1;
    }
    ss1 = ss1 / 16;
    PORTD = ss1; // посылаем на индикатор (send to LEDs)
    delay(1);


    ss2 = s2 - c2;
    if (ss2 < 0)
    {
    sss2 = 1;
    }
    ss2 = ss2 / 16;
    PORTD = ss2; // посылаем на индикатор (send to LEDs)
    delay(1);

    if ( sss0+sss1+sss2 > 2)
    {
    digitalWrite(0,HIGH);
    delay(2);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    if ( sss0+sss1+sss2 > 3)
    {
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }
    if ( sss0+sss1+sss2 > 4)
    {
    digitalWrite(3,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }
    if ( sss0+sss1+sss2 > 5)
    {

    digitalWrite(4,HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }
    if ( sss0+sss1+sss2 > 6)
    {
    digitalWrite(5,HIGH);
    digitalWrite(4,HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }
    if ( sss0+sss1+sss2 > 7)
    {

    digitalWrite(6,HIGH);
    digitalWrite(5,HIGH);
    digitalWrite(4,HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }if ( sss0+sss1+sss2 >
    {
    digitalWrite(7,HIGH);
    digitalWrite(6,HIGH);
    digitalWrite(5,HIGH);
    digitalWrite(4,HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(1,HIGH);
    digitalWrite(0,HIGH);
    delay(1);
    sss0 = 0;
    sss1 = 0;
    sss2 = 0;
    }
    }

    Leave a comment:


  • homefire
    replied
    LOL The code looks like it's trying to light all LED's at the same time to me. Not by levels.

    Leave a comment:


  • 6666
    replied
    All of the above (Random ? Erratic? To Fast?)

    Leave a comment:


  • homefire
    replied
    What does it do? Random ? Erratic? To Fast?

    Leave a comment:


  • 6666
    replied
    I tried this project, but the way the LEDs light up in response to a target is too hard to follow.

    Leave a comment:


  • 6666
    replied
    Hi Foxylab

    I am trying to find out the value of L2 the choke in the 12 v battery supply of your PI circuit, could you please tell what is its value ? thanks.

    Leave a comment:


  • 6666
    replied
    Originally posted by bernte_one View Post
    Hello captainart3000,

    can you provide sourve file or hexcode?

    which Controller is it atmel or pic?
    you can contact him at [email protected]

    Leave a comment:


  • bernte_one
    replied
    Hello captainart3000,

    can you provide sourve file or hexcode?

    which Controller is it atmel or pic?

    Leave a comment:


  • Watanabe
    replied
    Originally posted by captainart3000 View Post
    Attached is my old schematic for arduino shield
    This long board is the same circuit?
    Thanks.




    ...

    Leave a comment:


  • captainart3000
    replied
    Attached is my old schematic for arduino shield
    Attached Files

    Leave a comment:


  • FoxyLab
    replied
    Here's a demo - the signal output from the op-amp:

    Since the op amp gain is small for stable operation of the comparator circuit, then for clarity using large targets placed in the coil - 1 (without target), 2 (beer can), 3 (dumbbell).
    Taking the curve of exponential function, defined for fun time constant for dumbbell - 84 microseconds.
    P.S. I went back to the old version of the driver:

    This circuit is the most stable.
    Attached Files

    Leave a comment:


  • FoxyLab
    replied
    I solved the problem with the driver, add a filter capacitor and inductor (replaced driver IC for the best - TC4420):

    MD works fine!
    Attached Files

    Leave a comment:


  • FoxyLab
    replied
    Originally posted by bernte_one View Post
    i think you do good work with this fast optocoupler und the mosfet driver ic
    With IR4427 has turned a strange thing - a metal detector began to react on literally everything - my body (I'm not the Terminator)))), touching to the connectors, to the coil... I went back to version 3 with HCPL-3120.

    Leave a comment:


  • FoxyLab
    replied
    Originally posted by Prospekteur View Post
    Nice project! I have a few Arduino nano here too. Eventually a nice winterproject;-) Good work!
    Thanks!

    Leave a comment:

Working...
X