Announcement

Collapse
No announcement yet.

Arduino based VDI!

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

  • 6666
    replied
    Thanks for the info Don

    Leave a comment:


  • dfbowers
    replied
    Updated - Arduino VDI Experiments

    Updated document.. Just to hide the misleading label.

    Thanks for catching that Steve.

    Don
    Attached Files

    Leave a comment:


  • dfbowers
    replied
    Hi,Steve.
    Ha! thanks for catching that.

    Just taking a look at my setup, the IDX has a trace that completely surrounds the PCB, and it is the common ground derived from U6 pin7. This is what I was using for a ground, NOT -v or the negative battery terminal. So, you can connect the Arduino ground to one of may points, as long as it's connected to the outer trace of the PCB.

    Sorry for the error.

    Don

    Leave a comment:


  • golfnut
    replied
    Originally posted by dfbowers View Post
    Attached are complete details for the Arduino experimenter. I have tested these programs with four different coils BM 600, Home built 8" CC and two different homebuilt DDs, they all work!

    Enjoy!!
    Don
    Hi Don,

    In the PDF you mention connecting the Arduino GND to the IDX ground - I think this is fine.

    But when I look at the Drawing showing the connection labels in red - the Ground label isnt on the idx Ground.


    IDX supply and Ground are a bit weird, Battery 0v rail is the IDX -4volt rail.

    You mention that in your experiments it worked better with a separate battery rather than using IDX supply - this odd supply system may be associated?

    Steve

    Leave a comment:


  • eduardo1979
    replied
    Thanks Don for his excellent work. I will implement their programs today.

    Leave a comment:


  • dfbowers
    replied
    Arduino VDI Experiments - Details with 3 sample programs!!

    Attached are complete details for the Arduino experimenter. I have tested these programs with four different coils BM 600, Home built 8" CC and two different homebuilt DDs, they all work!

    Enjoy!!
    Don
    Attached Files

    Leave a comment:


  • Legaucho
    replied
    Very good job Don

    Leave a comment:


  • Oatz
    replied
    Dose ground mineralization effect the VDI reading. Dose it run smooth over ground?

    Edit - BTW awesome job!

    Leave a comment:


  • eduardo1979
    replied
    Very good job. Congratulations on your project.

    Leave a comment:


  • Derx
    replied
    Good work!

    How to install 128*64 graphics display in this VDI?

    Leave a comment:


  • dfbowers
    replied
    Latest Arduino code for VDI module

    I actually finished my IDX + Arduino UNO project. Below is the link for what the code in the previous post actually does. Neat thing is, you can program it to ID anything you want if you know the VDI range.


    http://youtu.be/5j_XM0L0BKg



    Don
    Attached Files

    Leave a comment:


  • dfbowers
    replied
    Originally posted by golfnut View Post
    Hi, recently MSP430 Launchpad ( $4 ) sampling an a2d channel 10bits (1024 step) and wondered how you do the two channels!

    I mean - do you sample your X-R channels at exact same time.? So you are sampling phase relationship between X-R at that same instant in time...

    Or do you mux 2 analog channels to a single a2d, and toggle channel select, so read and convert the two input channels alternately..


    Steve

    Steve,

    I think the Arduino can only execute one line of code at a time, so I'm not sure how long it takes to sample both A0 and A1. I have attached my latest.. It ID's US coins pretty accurately and displays nothing if it comes across something that is Discriminated.
    Don


    #include <LiquidCrystal.h>
    // Connections:
    // rs (LCD pin 4) to Arduino pin 12
    // rw (LCD pin 5) to Arduino pin 11
    // enable (LCD pin 6) to Arduino pin 10
    // LCD pin 15 to Arduino pin 13
    // LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
    LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); // assign liquid crystal pins
    int backLight = 13; // pin 13 will control the backlight
    // Sensors
    int sensorPinx = A0; // Intialize analog pin A0 and name it "sensorPinx" for the all metal channel
    int sensorPinr = A1; // Intialize analog pin A1 and name it "sensorPinr" for the all disc channel
    //Variables
    float sensorValuex = 0; // assign a floating point value of "0" to a variable called "sensorValuex"
    float sensorValuer = 0; // assign a floating point value of "0" to a variable called "sensorValuer"
    float slope; // assign a floating point value of "0" to a variable called "slope"
    int n = 0; // assign an integer value of "0" to a variable called "n"
    int cursorClmn = 0; // assign an integer value of "0" to a variable called "cursorClmn"
    int numSamples = 0; // assign an integer value of "0" to a variable called "numsamples"
    float slopeTotals; // assign an integer value of "0" to a variabel called "slopeTotals"
    float slopeAve = 0; // assign an integer value of "0" to a variable called "slopeAve"
    int VDI = 0; // assign an integer value of "0" to a variable called "VDI"


    // program setup follows
    void setup()
    {
    pinMode(backLight, OUTPUT);
    digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
    lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
    lcd.clear(); // start with a blank screen
    lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
    lcd.print( " VDI Project "); // print whatever you want
    lcd.setCursor(0,1); // set cursor to column 0, row 1
    lcd.print("running 05152012"); // print whatever you want
    delay (2000); // wait 1 second
    lcd.clear(); // Clear the LCD



    }

    // The main loop follows
    void loop()
    {
    first: //This is a label called "first" so a goto statement can find the beginning of the loop when called
    sensorValuex = analogRead (sensorPinx); //Read the analog pin A0 and store it's value as sensorValuex (it will be between 0 and 1023)
    sensorValuer = analogRead (sensorPinr); //Read the analog pin A1 and store it's value as sensorValuer (it will be between 0 and 1023)
    //Change SensorValues below to adjust VDI sensitivity
    if (sensorValuex > 5) { //If this sensorvalue becomes > 5 it executes the next line. If not, it drops to the "else" statement and goes to the beginning again ("first")
    if (sensorValuer > 5) { //If this sensorvalue becomes > 5 it executes the next line. If not, it drops to the "else" statement and goes to the beginning again ("first")
    for (int n = 0 ; n < 85 ; n ++) //Starts a counter to read the sensors again in a loop 85 times
    reread: //A label called reread will check sensors again if a floating point calulation is bad {0 value)
    {
    sensorValuex = analogRead(sensorPinx); //Read the analog pin A0 and store it's value as sensorValuex (it will be between 0 and 1023)
    sensorValuer = analogRead (sensorPinr); //Read the analog pin A1 and store it's value as sensorValuer (it will be between 0 and 1023)
    slope=sensorValuer / sensorValuex; // calculate X/R ratio and call it "slope"
    if (slope ==0) {
    goto reread;
    }
    slopeTotals = slopeTotals + slope;
    }


    }

    }
    else {
    goto first; // runs a loop until the sensors become low again
    }
    slopeAve = slopeTotals/85; // take all the slope values and average them.
    VDI = ((10 - slopeAve) * 10);
    // you can manipulate the range of how your VDI numbers are calulated by changing the line below

    cursorClmn = (10 - slopeAve); // slopeAve will typically be between .1 and 9. It just converts it to an integer number between 1 and 10.. used to position the "*" character
    tone (8 , (cursorClmn * 200), 100); // produces a tone of 200 Hz X the mumber above for 100 mS
    lcd.clear(); //clear LCD
    if (VDI > 98 ) {
    lcd.clear();
    goto finish;
    }
    lcd.setCursor(0,0); //Set cursor on line 0, column 0
    lcd.print("VDI = "); // print "VDI ="
    lcd.print (VDI) ; // prints the calculated number following "VDI ="
    lcd.setCursor(9,0);
    //if (VDI = 100 ); {
    // lcd.clear();
    // goto finish;
    //}
    if ( VDI > 85 ) {
    lcd.print("Quarter");
    goto DonePrinting;
    }
    if ( VDI > 80 ) {
    lcd.print ("Dime");
    goto DonePrinting;
    }
    if ( VDI > 71) {
    lcd.print ("Penny");
    goto DonePrinting;
    }
    if (VDI > 70) {

    goto DonePrinting;
    }
    if (VDI > 65) {
    goto DonePrinting;
    }
    if (VDI > 60) {

    goto DonePrinting;
    }
    if (VDI > 47) {
    goto DonePrinting;
    }
    if (VDI > 39) {
    lcd.print ("Nickel");
    goto DonePrinting;
    }
    if (VDI > 30) {

    goto DonePrinting;
    }
    if (VDI > 0) {
    lcd.setCursor (10,0);
    lcd.print ("Foil");
    goto DonePrinting;
    }

    DonePrinting:
    lcd.setCursor(cursorClmn,1); // Positions the cursor on a particular column on row 1
    lcd.print ("*"); // prints the "*" character in that partular column
    finish:
    delay (100); // display the VDI numbers for 100 mS before going to the beginning of the code again
    numSamples = 0; // reset all numbers back to "0"
    slopeTotals = 0;
    slopeAve = 0;
    slope = 0;

    }

    Leave a comment:


  • golfnut
    replied
    Qu for Don

    Hi, recently MSP430 Launchpad ( $4 ) sampling an a2d channel 10bits (1024 step) and wondered how you do the two channels!

    I mean - do you sample your X-R channels at exact same time.? So you are sampling phase relationship between X-R at that same instant in time...

    Or do you mux 2 analog channels to a single a2d, and toggle channel select, so read and convert the two input channels alternately..


    Steve

    Leave a comment:


  • dfbowers
    replied
    Originally posted by golfnut View Post
    Hi Don, the code you posted has this line at the top..




    #include <LiquidCrystal.h>

    LiquidCrystal.h is another file in your build area - it will have been supplied when you set your project area.

    If you do a quick search for it and post we can use it too.

    (If we use the same LCD that is!)

    Stil waiting on my LCD displays from a scotland firm called Metatech (cheap Nokia parts ) poor service.


    Steve
    Hi Steve! I downloaded the LCD code directly from here:

    http://www.hacktronics.com/Tutorials...-tutorial.html

    From this, I just just built the rest of the program around it.

    But, I see your point. I just loaded it and there is no "sketch folder" in my Arduino app that shows the extra .h files so I'm wondering if it's leftover from something . I would expect the LCD library to have a .ino extension and then have it imported. I left that line in anyway(#include <LiquidCrystal.h>).


    I'm wondering if you can add a sketch folder separately from here:



    My understanding is that the libraries are just extra lines of code left out to simplify everything when you get started. Then you can add sketch folders later. But can't you just add the extra lines of code to the main body of the program?

    Don

    Don

    Leave a comment:


  • golfnut
    replied
    header file

    Hi Don, the code you posted has this line at the top..

    #include <LiquidCrystal.h>




    LiquidCrystal.h is another file in your build area - it will have been supplied when you set your project area.

    If you do a quick search for it and post we can use it too.

    (If we use the same LCD that is!)

    Stil waiting on my LCD displays from a scotland firm called Metatech (cheap Nokia parts ) poor service.


    Steve

    Leave a comment:

Working...
X