Announcement

Collapse
No announcement yet.

PI CHIP

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

  • #16
    Originally posted by moodz View Post
    With 100 msps you should be able to get some good oversampling. The higher the Tx frequency the higher the sample rate which means more bits for resolution.

    For example if you take 4096 samples and sum them to a single value then right shift this sum by 6 bits you end up with a 14 bit value ( with your 8 bit ADC )

    Ideally the 4096 samples should always be sampled at the same point / time on the waveform. So if your Tx waveform was running at 8.192 Khz your 14bit oversample sum would be updating at twice a second ... maybe a bit slow for fast sweeping of the coil.

    I would start with 1 Khz with a 100us tx pulse. You then have 900 us to play RX in ( overkill I know ) and take multiple adjacent samples ( eg 16 because your ADC is so fast the voltage will not change much in 16 samples ) at each sample point ( say two ... early and late ) . You do this for each pulse. That gives you an equivalent sample rate of 16 Khz and with a 14 bit oversample an update rate of 4 hz. You should do the sample summing in your dual port ram then transfer to PC only the sum of the 4096 samples. This will reduce traffic and is more elegant. Of course eventually you want to do the lot inside the FPGA.

    moodz.

    I have manged to get a very basic FIR decimate filter going and its looking good with your example figures above I assume I would capture around 40us of the wave which is a fair chunk. What I want to try is take multiple smaller sample blocks of the waveform, put them through the dual averaging filters and then display a completely new "difference" wave. Above you mentioned having a slow and fast avg filter could you give an example of how much one filter lags the other.

    Comment


    • #17
      Originally posted by maca404 View Post
      I have manged to get a very basic FIR decimate filter going and its looking good with your example figures above I assume I would capture around 40us of the wave which is a fair chunk. What I want to try is take multiple smaller sample blocks of the waveform, put them through the dual averaging filters and then display a completely new "difference" wave. Above you mentioned having a slow and fast avg filter could you give an example of how much one filter lags the other.
      The fast filter updates at a rate of approximately 20 times a second. The slow filter updates at a rate of once every 10 seconds .... so i guess the ratio is 200 to 1. These values let the slow filter track the "no target" level whilst giving a fast response to targets via the fast filter.
      There is provision to either lock the slow filter ( updates off ) if you are hovering the coil above a weak target eg when pin pointing and there is provision for "snap lock" which snaps the level of the slow filter to the fast filter ( useful where ground conditions are changing very suddenly ).

      Regards,

      moodz.

      Comment


      • #18
        Originally posted by moodz View Post
        I will probably be able to ship the chip and a suggested circuit quite soon .... I will put up some more specs and test results shortly so people can decide. I am not intending to make anyting out of this so it will be chip cost + programming cost + postage to wherever you are.
        Very well. Eagerly awaited, Thank you.

        Comment


        • #19
          Interesting the way you described it is different to how I figured it worked, So basically the fast filter incorporates the target in to its average before the slow filter can causing the difference, Now am I right in saying changing the lag between them could help reduce ground effect as at a normal a swing rate a real target will be in the field of the detector for a far shorter time and change more rapidly than ground effect. Another interesting feature I guess could be putting an accelerometer on the head so when it is not moving it instantly locks the slow filter.

          Comment


          • #20
            Originally posted by maca404 View Post
            Interesting the way you described it is different to how I figured it worked, So basically the fast filter incorporates the target in to its average before the slow filter can causing the difference, Now am I right in saying changing the lag between them could help reduce ground effect as at a normal a swing rate a real target will be in the field of the detector for a far shorter time and change more rapidly than ground effect. Another interesting feature I guess could be putting an accelerometer on the head so when it is not moving it instantly locks the slow filter.

            ... correct ... the slow filter will only catch up if you hover over a target for quite a while ... however if you then moved off the target there would be a negative shift which would also cause a target response. The ground effect is like a constant target and so only the transient targets show up as differences between the fast and slow filters. There is some technique required by the operator to maximise success using this technique .. for instance try to keep search coil at constant speed and distance from ground .. no sudden height changes.
            The accelerometer idea is excellent but I think it has been suggested previously somewhere else on this board ( not by me ).

            moodz.

            Comment


            • #21
              Interesting, Ill be winding a new coil with some teflon coated 30awg this weekend and get it all up and running. I have some accelerometers and gyros here I may have a go at running them through a kalman filter which should let me know how the head moves in any direction from a given point I have some experiance with this from working with UAV's.

              Comment


              • #22
                v2.0 chip now operational

                Below is a serial console session from the v2.0 firmware in the uni PI chip. The top limit is now an insane 20 Khz but the software is still able to track and sample with sub 100 ns accuracy.
                The lower TX frequency is around 450 Hz and you can pretty much operate at any frequency you like between these two limits. ( within limits of 16 bit clock divider word )
                The top frequency would be over 100 Khz but I am limiting it to 20 Khz as it is possible to "brick" the chip for very high TX rates ( .. the curse of the never ending interrupt ).
                All of the code is written in C and I only dipped into assembler to do the EEPROM save routine which was for the low level access not speed.

                Frequency is set like this

                >A1234

                where A is the menu item ( see below ) and 1234 is the "count" in 33.9 ns steps. So A737 for example gives the top frequency of 20 Khz or 50 us tx + rx window.

                to set TX duty cycle you enter say

                >B737

                This sets a TX duty cycle of 25 us
                and so on for the sample1, sample2 and audio rate. The audio rate value sets the signal to frequency rate of the audio generator. A larger audio rate will generate a bigger audio freq change for a given signal.

                Lastly you enter

                >S to save the settings to onchip eeprom .. so once the timings suit your coil you can "burn" them so to speak.

                The code also supports a rotary encoder and I am only using 1% of the available eeprom so variable settings and multiple timings can be saved with a little more code effort.

                The TX, target and SAT signals are all available as complimentary PWM outputs however the sample pulses are only +ve going .... so I will look to add a menu item to set the sample pulse polarity for maximum versatility.


                moodz.



                >H550
                Universal PI chip by Moodz v2.0
                S: Save all vars to EEPROM
                R: Read all vars from EEPROM
                CHECKSUM: RAM = 3226 EEPROM = -12
                STATUS:
                X: CPU Ref Clock : 4 X 7370.000 Khz = 29.480 Mhz
                PWM Step is 33.921 Nanosecond
                A: TX FREQUENCY : Count = 737 Freq = 20.000 Khz Period = 50.000 usec Scale factor = 88
                B: TX PULSE : Count = 737 Duty = 25.000 usec
                PWM2 TARGET level : Count = 126 Duty = 4.274 usec
                PWM3 SAT level : Count = 126 Duty = 4.274 usec
                E: SAMPLE PULSE 1 ON : Count = 350 ON = 23.745 usec
                F: SAMPLE PULSE 1 OFF : Count = 360 OFF = 24.423 usec width = 0.678 usec
                G: SAMPLE PULSE 2 ON : Count = 500 ON = 33.921 usec
                H: SAMPLE PULSE 2 OFF : Count = 550 OFF = 37.313 usec width = 3.392 usec
                ADC sample = 2021
                ADC SAT sample = 2020 0.154116 Volts DIFF = -1 -0.000076 Volts
                M: AUDIO freq range count = 0
                >
                Enter a command : eg A1234 sets Tx freq count to 1234

                Universal PI chip by Moodz v2.0
                S: Save all vars to EEPROM
                R: Read all vars from EEPROM
                CHECKSUM: RAM = 3226 EEPROM = -12
                STATUS:
                X: CPU Ref Clock : 4 X 7370.000 Khz = 29.480 Mhz
                PWM Step is 33.921 Nanosecond
                A: TX FREQUENCY : Count = 737 Freq = 20.000 Khz Period = 50.000 usec Scale factor = 88
                B: TX PULSE : Count = 737 Duty = 25.000 usec
                PWM2 TARGET level : Count = 126 Duty = 4.274 usec
                PWM3 SAT level : Count = 126 Duty = 4.274 usec
                E: SAMPLE PULSE 1 ON : Count = 350 ON = 23.745 usec
                F: SAMPLE PULSE 1 OFF : Count = 360 OFF = 24.423 usec width = 0.678 usec
                G: SAMPLE PULSE 2 ON : Count = 500 ON = 33.921 usec
                H: SAMPLE PULSE 2 OFF : Count = 550 OFF = 37.313 usec width = 3.392 usec
                ADC sample = 2019
                ADC SAT sample = 2020 0.154116 Volts DIFF = 1 0.000076 Volts
                M: AUDIO freq range count = 0
                >S
                EEPROM save OK : CHECKSUM OK

                Universal PI chip by Moodz v2.0
                S: Save all vars to EEPROM
                R: Read all vars from EEPROM
                CHECKSUM: RAM = 3226 EEPROM = 3226
                STATUS:
                X: CPU Ref Clock : 4 X 7370.000 Khz = 29.480 Mhz
                PWM Step is 33.921 Nanosecond
                A: TX FREQUENCY : Count = 737 Freq = 20.000 Khz Period = 50.000 usec Scale factor = 88
                B: TX PULSE : Count = 737 Duty = 25.000 usec
                PWM2 TARGET level : Count = 126 Duty = 4.274 usec
                PWM3 SAT level : Count = 126 Duty = 4.274 usec
                E: SAMPLE PULSE 1 ON : Count = 350 ON = 23.745 usec
                F: SAMPLE PULSE 1 OFF : Count = 360 OFF = 24.423 usec width = 0.678 usec
                G: SAMPLE PULSE 2 ON : Count = 500 ON = 33.921 usec
                H: SAMPLE PULSE 2 OFF : Count = 550 OFF = 37.313 usec width = 3.392 usec
                ADC sample = 2019
                ADC SAT sample = 2019 0.154040 Volts DIFF = 0 0.000000 Volts
                M: AUDIO freq range count = 0
                >

                Comment


                • #23
                  UNIVERSAL PI CHIP v2.0

                  ... added ZERO and SAT LOCK pushbutton controls.

                  The ZERO button zeros the SAT to the current average sample ... useful for pinpointing and "heavy" ground clutter and recovering quickly from big targets.

                  The SAT LOCK button stops the SAT from updating whilst pressed ... useful for fine / small target resolution where you are hovering over same spot for a long time ... otherwise the SAT would adjust out the response.

                  Below is the basic CPU circuit .... you need to add the rest to build a detector however IMHO the majority of the work in the signal processing has been done.

                  moodz.....

                  Click image for larger version

Name:	UNIPI_MOODZ_V20.JPG
Views:	1
Size:	88.7 KB
ID:	328808

                  Comment


                  • #24
                    serial console session

                    latest screen grab of serial console session for configuring UNIPI chip ....

                    moodz

                    Click image for larger version

Name:	UNIPI_MOODZ_TERM01.JPG
Views:	1
Size:	170.7 KB
ID:	328809

                    Comment


                    • #25
                      UNIVERSAL PI CHIP v2.0 UNIPI update.

                      Fixed a nasty interrupt memory leak ....
                      Cleaned up the code for compiler efficiency.

                      Code Functionality tests
                      EEPROM save OK
                      EEPROM read OK
                      Checksum of RAM and EEPROM OK
                      TX frequency set OK 450 Hertz to 20 Khz in 32767 steps ( 15 bit divider )
                      TX duty cycle OK ( 65535 steps ) 0 to 100% duty cycle
                      Sample pulse 1 ON and OFF OK sample anywhere under or after each TX pulse
                      Sample pulse 2 ON and OFF OK sample anywhere under or after each TX pulse
                      ADC sample working at better than 16 bits resolution.
                      SAT LOCK button working OK
                      ZERO button working OK
                      TARGET PWM output set to 2.5 volts +/- target signal for analogue meter drive or other.
                      SAT PWM ... not sure ... this is supposed to drive autobalance for DD or bucking coil.
                      AUDIO ... working ... but will have to test with real front end + coil.

                      I think its ready.

                      moodz.

                      Comment


                      • #26
                        ... hex file for testing only.

                        hex file for dspic30F4012 MOODZ UNIPI V2.0 Beta Test

                        Metal20.zip

                        Comment


                        • #27
                          Hi moodz,
                          Are you using C30?
                          If you don't mind, is it possible to compile your code for dsPIC33FJ128MC802 or better post here?
                          Regards,
                          Mustafa

                          Comment


                          • #28
                            Looks like a nice bit of coding congrats. Have you had a chance to do much experimenting with different targets and detection distances etc ?.

                            Comment


                            • #29
                              Originally posted by Mustafa View Post
                              Hi moodz,
                              Are you using C30?
                              If you don't mind, is it possible to compile your code for dsPIC33FJ128MC802 or better post here?
                              Regards,
                              Mustafa

                              Yes its C30 ... I will have to finish this chip version before mapping to a new one.

                              Regards,

                              moodz.

                              Comment


                              • #30
                                Originally posted by maca404 View Post
                                Looks like a nice bit of coding congrats. Have you had a chance to do much experimenting with different targets and detection distances etc ?.
                                Thanks ... the internal function is a basic version of my FPGA project ... it is intended as an experimenters chip ... to simplify generating the TX, Sample, Audio signals as well as a SAT function, ADC and feed back PWM channels for analogue target signal and SAT.

                                So I have not even used it in a circuit yet. I have a board layed out but it will need testing before the design gets close to target testing ....

                                regards

                                moodz.

                                Comment

                                Working...