Menu

Can this be done with gcb

2020-07-02
2020-08-02
  • stan cartwright

    stan cartwright - 2020-07-02
     
    • Anobium

      Anobium - 2020-07-02

      I would think so.

       
  • stan cartwright

    stan cartwright - 2020-07-02

    So do I expand on
    Dim OCR0 AS byte alias OCR0A
    Dim TCCR0 AS byte alias TCCR0B
    TCCR1A and TCCR1
    I don't have a clue and see no help...to help.. and no demos.
    It sets a pin to enable interrupt on rising edge and the interrupt increases a counter and resets the interrupt counter to 1 so next interrupt does the same ie a counter for the input frequency on the interrupt change pin.

     
    • Anobium

      Anobium - 2020-07-03

      Why not access/set OCR0A directly?
      Where is TCCR0B in the project INO file?

      You will use millis().
      You be using interrupts.
      You will be using Scale().

      Not sure how storedTimeDeltaDifference will work but an integer version should be ok.

       
      • stan cartwright

        stan cartwright - 2020-07-03

        Anobium..I think more precision than millis needed.
        I do not know about timers and thought they were only accessable through alias...not a clue, sorry.
        What this is ,is a frequency timer really. The fastest . simplest ?

         

        Last edit: stan cartwright 2020-07-03
  • bed

    bed - 2020-07-03

    Metal detectors normally work with two oscillators, which are floatingly adjusted to the same frequency. By approaching metals one oscillator is detuned and this change is made audible by the mixture.
    In the present circuit only one oscillator is used and the controller measures the frequency. When approaching metals the frequency difference is used to generate a tone. This is quite ingenious. One saves an adjustment before use because the controller measures the frequency immediately after switching on and uses it as a comparison.
    Great principle, that makes me want to use the principle myself. It will be on my huge todo list :-)

     

    Last edit: bed 2020-07-03
  • stan cartwright

    stan cartwright - 2020-07-03

    Bed. I think you are thinking of "inductance balance" metal detectors. ie. 2 coils.
    There are many designs of metal detectors. BFO is simplest.
    This uses a continuous Colpitt's oscillator. Normally it just rings and dies away.
    The time it takes to die away varies with the coils inductance ie metal near it and the idea is you measure the ringing time.
    Understanding microcontroller clocks is on my "to do" list :)

     
    • bed

      bed - 2020-07-03

      It may be that I am wrong, but I read in the description that it is basically a frequency measurement and the oscillator is always running.
      It simply determines the deviation of the frequency. With this you can even distinguish non-ferrous metals from iron.
      I did not bother to examine the source code. But for sure you don't work with ringing here, but by changing the quality in the search coil the frequency change is determined.
      Moreover, the circuit lacks the possibility to program the oscillator

       
      • stan cartwright

        stan cartwright - 2020-07-03

        bed, hi mate, the circuit uses a transistor to keep it ringing ie a continuous sine wave and metal changes inductance and so the frequency.
        My point was .... sorting anothers ideas to work with gcb and how to.
        This to me seems a fast way of counting pulses, it seems to count a sine wave.
        I am learning as I go and anything useful I will post.
        Interrupts can be really useful and in this case the best way?
        Why not... is port.x on and count??
        stay well

         
        • bed

          bed - 2020-07-03

          As I said, I did not look at the original source code, I dislike C++ anyway ;-)
          Apart from that it's good if you think about it and follow your own ideas, like here for example.
          It doesn't matter how it is really implemented.
          Also my idea is, where would you get if you use everything only 1:1 and don't question. Sometimes, at least I hope so, you create a new way that is more efficient, more elegant or simply different from the original solution.
          So far I have only dealt with metal detectors in a rudimentary way. A colleague of mine has this as a hobby, but that's why I'm a little bit informed about the current developments. It is a very exciting hobby, no not treasure hunting, but inventing new electronics and software to improve detection :-)

           
          • stan cartwright

            stan cartwright - 2020-07-03

            I am looking at metal detector ideas and ones that use a 328p.
            ie... a microcontroller solution.
            This will somehow need accurate resolution timing of an external input.
            The rest is open to experimentation ... and knowledge of electrical circuits.
            A glcd could be used to show results ... which would need a microcontroller anyway,
            so why not use it for the project?

             
  • stan cartwright

    stan cartwright - 2020-07-03

    Mr Kent could do an example. Kent seems very knowledgeable about timers, especially 328p.
    Gcb interrupts could be explained better...don't look at me.
    I posted a routine using interrupts and in the millis.inc is an explanation of timer0 but not a real guide how to use timers. I don't understand data sheets.
    Needed - millis but with more resolution
    The metal detector was as fast as possible?
    trigger interrupt,inc counter,reset int count to 1

     
  • stan cartwright

    stan cartwright - 2020-07-03

    bed . I will try
    if portx.x=1 then count++ to start testing a sine wave ...it would be rms?
    not the same as a rising edge interrupt.
    I got a signal generator to play with.

     
  • kent_twt4

    kent_twt4 - 2020-07-03

    Stan, you may remember this conversation a while ago about measuring frequency. https://sourceforge.net/p/gcbasic/discussion/579126/thread/8b1aa325/#57eb

    I like Mr. Roth's recommendation of devices that have the 24bit Signal Measurement Timers:
    "These chips include: 12F1612, 16F1613/14/15/18/19 as well as the 18F188xx chips."

    But if a 12f683 can do a reasonable job, then the m328p should do as well.

     
    • stan cartwright

      stan cartwright - 2020-07-04

      Thank you kent for drawing my attention to that thread.

       
  • mkstevo

    mkstevo - 2020-07-04

    The transistor is the oscillator. The frequency of oscillation determined by the inductor (sense coil) and the two capacitors across the inductor. As metal nears the sense coil, the value of inductance changes, this causes a shift in frequency.

    The processor is simply measuring the frequency. It isn't "generating" the frequency, that is done by the transistor, inductor and capacitors.

    All the processor needs to do is measure the frequency, see if it has changed significantly from the calibrated value and then act appropriately.

    You only need count how many clock cycles the oscillator is on (or off) for to do this, no complex maths would be needed as all you need is to compare one value with another.

    No need to worry whether this is a sine wave measurement. No need to worry about RMS either, RMS is a measurement of Voltage, not frequency.

    I would like to see a high (10k?) value resistor connected between the oscillator and the input pin used on the processor to both prevent the processor from loading the oscillator and to protect the processor should the voltage out of the tuned circuit exceed the supply.

     
    • stan cartwright

      stan cartwright - 2020-07-04

      Yes Steve, the transistor is feedback to keep the LC ringing ie oscillateing.
      There's the idea of pulseing LC and measuring the ringing time. This allow for a high current pulse to be used..which may give deeper searching. Lots to try :)

       
      • bed

        bed - 2020-07-04

        No, it is a colpitts oszillator, it it is continous swinging

         
  • mkstevo

    mkstevo - 2020-07-05

    Yes Bed!
    No Stan!

    To "pulse" the inductor circuit as you suggest Stan would be easy to do, but nearly impossible to measure reliably. If it was me, I would stick to the original oscillator, but with my suggested 10k on the input to the processor.

     
  • rowdy

    rowdy - 2020-07-23

    If you want a pretty decent Pulse Induction Metal Detector (PI ) useing Arduino - have a look at FoxyPI project, drop url into chrome and it will translate for you. https://acdc.foxylab.com/node/47

     
    • stan cartwright

      stan cartwright - 2020-07-24

      nice of you you to post link. it does translate to english.
      Looks simple but not simple enough for a gcb general project.
      I like it though . Thank you.

      Fets are a pain running on 5V logic levels...unless you get ones for 5 or 3.3 logic

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.