Announcement

Collapse
No announcement yet.

Arc tangent function

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

  • Arc tangent function

    ...
    Last edited by ivconic; 01-12-2023, 06:57 PM.

  • #2
    ...
    Last edited by ivconic; 01-12-2023, 06:57 PM.

    Comment


    • #3
      ...
      Last edited by ivconic; 01-12-2023, 06:57 PM.

      Comment


      • #4
        ...
        Last edited by ivconic; 01-12-2023, 06:58 PM.

        Comment


        • #5
          I'm assuming that you are measuring the X&Y channels of something like the IDX or TGSL?? did this exercise a while back and used a 2 x16 display.
          It basically worked and did not need a fast or high resolution ADC. An arduino Micro, Nano or UNO was all that was needed. One thing that made a difference though was the polarity of the signals while measuring. With the IDX, I had to sample the channels when the went negative to get accurate samples. You can sample after they "fly back" positive but sometimes got irratic results.

          https://www.youtube.com/watch?v=b93lfFtUSFs

          Comment


          • #6
            How processor-intensive is the arctan function? I assume that most detectors use a linearized calculation for VDI with maybe a look-up table for correction.

            Comment


            • #7
              ...
              Attached Files
              Last edited by ivconic; 01-12-2023, 06:58 PM.

              Comment


              • #8
                ....
                Last edited by ivconic; 01-12-2023, 06:58 PM.

                Comment


                • #9
                  ...
                  Last edited by ivconic; 01-12-2023, 06:58 PM.

                  Comment


                  • #10
                    ...
                    Last edited by ivconic; 01-12-2023, 06:59 PM.

                    Comment


                    • #11
                      ...
                      Last edited by ivconic; 01-12-2023, 06:59 PM.

                      Comment


                      • #12
                        From my several years of experience with time measurement on ATMega328 I came to the most accurate measurement by comparison in OCR3A, the method with 'millis' I consider the least accurate. PS. I use ATMega A* 328BP at 8MHz - I had one.
                        Code:
                         int o=3900;//time = 0,5s
                         ... 
                         void Licznik() { //funkcja ... 
                        ready=0;                        //reset period measure flag
                         cbi (TIMSK0,TOIE0);             //T0 dissable millis and delay
                         TCCR3A = 0; 
                         TCNT3 = 0; //T3=0
                         sbi(TIFR3,OCF3A);               //T3 clear flag
                         TCCR3B = 13; //T3 prescaler 1024
                        
                         OCR3A = o; //T3 time
                         sbi(TIMSK3,OCIE3A); //T3 enable Int, Attach time measurement
                         ... 
                         while (ready == 0); //Wait for the end of the measurement
                         ... 
                         cbi(TIMSK3,OCIE3A); //T3 disable Int, Turn off timing
                         sbi(TIMSK0,TOIE0); //T0 enable 
                         }
                         ... 
                         ISR(TIMER3_COMPA_vect) {ready=1;} //T3 Int 33, time measurement
                        The same can be done with the T1 on a regular A328P.
                        Good luck!
                        Last edited by Krzysztof; 01-04-2023, 09:11 AM. Reason: lang

                        Comment


                        • #13
                          ...
                          Last edited by ivconic; 01-12-2023, 06:59 PM.

                          Comment


                          • #14
                            ...
                            Last edited by ivconic; 01-12-2023, 06:59 PM.

                            Comment


                            • #15
                              My wild guess is that a lookup table would do a more decent job than atan algorithm, especially at the extremes. Also it is pointless to take angles of absolute values because of offset. A derivative would give a more consistent result.

                              Comment

                              Working...
                              X