Announcement

Collapse
No announcement yet.

Arduino Nano PI Main Discussion

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

  • Originally posted by pito View Post
    is there a video ?
    Surfdetector made some youtube videos. You can find the link on this page -> Arduino Nano Pulse Induction Metal Detector Project - Published March 2021
    BernteOne also made a video here -> https://www.youtube.com/watch?v=Z2XFnPe3u58

    Comment


    • Originally posted by pito View Post
      is there a video ?
      Will post photos after the hardware is put together, should be finalised this week.

      Comment


      • Originally posted by Gunghouk View Post
        Hi all I'd like to offer my slicked up version of the software sketch for the ANPI detector. I think the changes will go a long way to eliminatiing jitter caused by excessive software times and system noise jitter on the potentiometer.

        I'm hoping to try this version out on some lower spec arduino boards to see how they cope.

        The pot currently gives about an extra 126 uS on top of the default 10uS. This can be halved to 63uS with a simple mod to the sketch.

        Please share your experiences good or bad.

        Cheers

        [ATTACH]n417564[/ATTACH]
        Can you tell me how you got the offset numbers, i.e how does -40 = 8us? Formula please.

        // Integer Timing Offset values in instruction cycles ie. ± 6.25E-8 sec intervals (1/16Mhz xtal clock freq)
        word TxOnOffset = -40; // TX-on pulse width offset (8us)
        word MainDelayOffset = -36; // Main sample pulse delay offset (10us)
        word MainSampleOffset = -41; // Main sample pulse width offset (9us)
        word EfeDelayOffset = -118; // EFE pulse delay offset (-32us)
        word EfeSampleOffset = -42; // EFE pulse width offset (9us)
        word TxPeriodOffset = -241; // TX period offset (56us) zz0.d88w9rmuog5zz
        These numbers and the comments(us) don't line up i.e 8us=-40. 9us=-41, 10us=-36?

        Comment


        • Last minute tuning meant the comments are inaccurate. Sorry about that.
          Other than my lax commenting how is the sketch working for you?

          Comment


          • In the original code the offsets are defined in micro-seconds. All the detector delays and pulse widths are controlled by timer interrupts, but in practice the calculated timer contents do not result in exactly the requested value. This is because there are additional delays introduced by entering and exiting the interrupt routine, and by some internal processing in the routine itself. However, these extra delays are consistent and can be corrected by applying an appropriate offset value.

            How to obtain the corrected values is fully explained in the book on page 19.


            Comment


            • I tuned the software using clock cycles rather than uS in order to give better precision when using the faster integer math equivalents to the floating point maths and used the oscilloscope for fine tuning.

              Comment


              • Originally posted by Gunghouk View Post
                Last minute tuning meant the comments are inaccurate. Sorry about that.
                Other than my lax commenting how is the sketch working for you?
                So what is the formula? uS to number please. I havn't used the sketch yet, as I want to understand the changes first.
                Also, you havn't provided "digitalWriteFast.h" so can't compile .. helps if you distribute "all" the code.

                Comment


                • 1 = 1/16 Mhz = 62.5 nS so multiply those offset values by 62.5nS to give uS.

                  The first line of the comments says exactly this.

                  Just Google digitalWriteFast.h to find the library and add it to your arduino library folder.

                  Comment


                  • digitalWriteFast-master.zip

                    Here it is anyway.

                    Comment


                    • Originally posted by Gunghouk View Post
                      1 = 1/16 Mhz = 62.5 nS so multiply those offset values by 62.5nS to give uS.

                      The first line of the comments says exactly this.

                      Just Google digitalWriteFast.h to find the library and add it to your arduino library folder.
                      Ok, tried the included file digitalWriteFast.h, but get this on compile:
                      /Users/bernardmentink/My_Work/Arduino/arduino_PI/arduino_PI.ino:112:7: note: in expansion of macro 'digitalWriteFast'
                      digitalWriteFast(txPin, mosfetOn); // Turn on Mosfet
                      ^~~~~~~~~~~~~~~~
                      /Users/bernardmentink/My_Work/Arduino/arduino_PI/digitalWriteFast.h:316:18: error: call to 'NonConstantUsed' declared with attribute error:
                      NonConstantUsed(); \​

                      Comment


                      • digitalWriteFast-1.2.0.zip

                        OK this is from the Arduino site.

                        https://www.arduino.cc/reference/en/...italwritefast/
                        Attached Files

                        Comment


                        • Originally posted by Gunghouk View Post
                          1 = 1/16 Mhz = 62.5 nS so multiply those offset values by 62.5nS to give uS.

                          The first line of the comments says exactly this.

                          Just Google digitalWriteFast.h to find the library and add it to your arduino library folder.
                          Or divide the number by 16 to get uS

                          Using clock cycles allows precision down to 62.5nS when tuning the pulse waveforms with an oscilloscope.

                          Comment


                          • Originally posted by Gunghouk View Post

                            Or divide the number by 16 to get uS

                            Using clock cycles allows precision down to 62.5nS when tuning the pulse waveforms with an oscilloscope.
                            The way to generate precise pulses is to configure a timer to drive a PWM output.

                            Comment


                            • Originally posted by Teleno View Post

                              The way to generate precise pulses is to configure a timer to drive a PWM output.
                              This is the best tool I know of.

                              https://dbuezas.github.io/arduino-we...GA328P&timer=0

                              Comment


                              • Originally posted by Gunghouk View Post
                                Yep, that was better, thanks.

                                Comment

                                Working...