Announcement

Collapse
No announcement yet.

STM32 Based PI Detector

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

  • STM32 Based PI Detector

    Greetings all. I'm working on an STM32 based metal detector of my own design using the STM32L412KB, selected for it's high ADC sampling rate and 12 bit resolution (see the bottom JPG for a decay curve on the OLED display), FPU availability, adequate RAM resources and the 32 pin LQFP variant being large enough to be semi-friendly to hand solder (using hot air soldering station.)

    I've gotten my first 3 prototype boards (through hole for easier prototyping / adjustments) in house and 1 built-up.  There will be a rev 1 that fixes a myriad of issues (biggest - I thought I could get by with just monitoring coil current, I failed to realize the eddy currents are so small that an immense amount of amplification would be needed.)

    Rev 1 will keep the coil amp monitoring but add a sense resistor and obligatory dual direction diodes on the ground side. I'm switching to an IRF9510, as it has immensely lower capacitances on both the gate and the output. (From 450 pf to 90 pf)

    I'm quite confident Rev 1 will be golden - or near enough to golden that it will be usable.  At this point in development, I don't see this becoming a commercial activity - and am mostly interested in making it an open-hardware project.

    I am new to metal detectors, but have been an electronics tech for nearly 30 years. This will also be my first time open sourcing a hardware project.

    This post is to request for input on:
    1) Recommendations on promoting as an open source project
    2) Any recommendations / thoughts / suggestions on the circuitry. i.e. EVERY PI schematic I've come across uses low side N-MOS switching, I'm not seeing the downside to high side switching. (Or at least comparing the IRF9510 to the IRF740 on most published schematics... not seeing a major downside.)
    3) If there are any others that this design idea might tickle and would care to join the effort.

    Currently the schematics are on EasyEDA (web based circuit entry) and I'm planning on opening up a github page for it in the next few weeks.

    As best I can tell googling and searching github, no one's actually brought an openly available STM32 PI detector to completion.

    Schematic (Rev 0) http://www.johnclymer.net/JEC-PI-STM32-Rev0.pdf
    Testing Setup (Nucreo board is only there as a debugger) http://www.johnclymer.net/Rev0-PCB-N...ardAndOLED.jpg
    OLED display showing end of decay curve http://www.johnclymer.net/Rev0-OLED-Display.jpg

  • #2
    Hi
    Why PI Metal Detector ? the resolution is not as good as with BI Metal Detectors. I also worked on a Metal Detector with STM32 but I then decided to use the nRF52840 64 MHz Cortex-M4 https://www.nordicsemi.com/Products/...eless/nRF52840 it has everything it needs and has a 14 bit differential ADC which is very good and is the possibility to update the firmware directly via mobile phone via Bluetooth. Here https://github.com/folny/nRF52_Metal_Detector are photos of my project, I will add other files later.

    Comment


    • #3
      Marchel,

      Many thanks for the reply, I did see those pictures when I was searching github, but not seeing any schematic, was not sure how far along that project was.

      Was BI a typo for IB ? If not, I am not familiar with BI type metal detectors. (Honestly, I have very little experience other than random googlings and a handful of decently written semi-technical articles that I've studied, because written documentation in metal detectors seems to be a voodoo unwritten magic )

      Having researched between VLF, IB and PI - the PI types make more sense to me and remind of my younger years working on RADAR systems.

      From what I've seen - most of the PI types that are openly available use such slow ADC's that they only get to read 1 or 2 samples during the time of interest. The ADC on the STM32L412 running at 80 MHz gives 5 million readings per second - which is about 20 ADC readings in the window of interest. With a 12 bit resolution and that fine many samples, you get enough data points that you can interpolate other useful information. I've seen some PIC based PI's - but those are mostly based on 18F series PIC's - which also have rather slow ADC's. I've came across 1 design that used a PIC32, and while the ADC on that goes up to 1 MSPS, it's also only a 10 bit ADC.

      Comment


      • #4
        The STM32 family is a personal favorite of mine. They also have some of the most flexible timers, and lots of them. Critical when you get into multi-period/multi-frequency designs.

        NMOS vs PMOS usually favors NMOS. PMOS peaks at 400-500V whereas N goes to ~1000V and more. For the otherwise same specs, N has lower Rds. Generally lower C's. Wider availability and lower price.

        I suspect in sensing the coil current it will be difficult to reach the performance of traditional PI. Yes, you will need a lot more gain, which probably means waiting for the coil current to die down enough. 12 bits is a bit low, although I have a direct-sampling PI using an STM32 with 12 bits that is performing quite well. Lots of oversampling and averaging, though. ST has some processors (M7 I believe) with native 16b ADCs. One thing I would like to see from ST is a 24b sigma-delta ADC.

        Your Vref generator is going to have a very strong temperature drift. Take a look at the AZ431, it's a 1.2V bandgap shunt regulator you can kick up to 1.5V.

        What you are doing is interesting and I hope you continue it as open-source.

        Comment


        • #5
          Carl,

          Thanks for the reply and tips. The direct coil current was a bust, I'm going to keep it as it does give me good data on charge times (possibly using that to estimate coil characteristics) and how many amps the coil got up too. But also pick off a sense diode like most other PI's do. The picture of the OLED is the ADC reading off of a sense diode. Once it gets past saturation, there are about 17 data points of valid data during the normal deacy (and it's a crappy 200 uH coil I have for testing.)

          The L4 isn't the top of the line, but the M7, H series, etc get into pretty small packages that my old eyes (and hands) have a hard time working with. Although, the NUCLEO packages make them readily accessible in pre-packaged form - and are relative cheap as far as development boards go (and save a person the $40+ for a debugger - as their builtin.)

          The reference circuit was something that was slapped together for the test board, it will get re-vamped for the next revision.

          Thanks again for the input !

          Comment


          • #6
            Interesting and promising!



            ...
            P-channel mosfets have higher On state resistances, comparing to similar specs N-channel.
            Nevertheless, i am also using P-channel mosfet on my "digital" PI.
            At present it is FQP3P50 which i find somewhat better than previous IRF9630.
            ...
            As for Vref... maybe these will be helpful:
            https://www.intorobotics.com/how-to-...-with-arduino/

            http://www.rtos.be/2013/05/stm32f100...ltage-for-adc/

            Comment


            • #7
              Hi

              My project is based on this connection http://www.radiodom.org/index/krot_pro/0-31 the scheme is very simple with literally just a few components and so far I have achieved a very decent range of up to 40cm on a coin with a diameter of 3cm.

              Comment


              • #8
                Originally posted by Marchel View Post
                Hi

                My project is based on this connection http://www.radiodom.org/index/krot_pro/0-31 the scheme is very simple with literally just a few components and so far I have achieved a very decent range of up to 40cm on a coin with a diameter of 3cm.

                "...Прошивка 2 часа работает в режиме демо , после чего попросит ввода ключа..."

                The firmware for 2 hours works in demo mode, after which it will ask you to enter the key ...

                Comment


                • #9
                  This project is paid, I wanted to point only to the connection of the input part, which is very simple and this principle of connection is also used by Xp Deus.

                  Comment


                  • #10
                    Nice project!
                    Can you tell me why you are using an low-side Q2 and high-side Q4 transistor instead of a single one?
                    Is it becasue of lower overall capacitance?
                    The coil does not need to be floating if you design the OPV subtractor correctly.

                    Comment


                    • #11
                      i can send you a material on QED. it will give to you good perfecto start point. ML must cry, again. CRY.

                      write me on [email protected]

                      Comment


                      • #12
                        Interesting project and looking forward to read more.

                        I have done some work on a PIC32MX based PI detector. This has a 10bit ADC sampling at 500kHz.
                        The TX pulse timing and ADC sampling is all done with hardware timers and DMA. Also it sums 4-16 TX cycles to increase ADC resolution and decrease noise. The ADC samples output of preamp from traditional PI circuit. The data of the decay curve is analyzed to obtain the 'TC'. I haven't posted full code since I haven't gotten this to a point where it can be field tested.
                        I have posted some code in the 'Programming' sub-forum.

                        Comment


                        • #13
                          Thanks for the reply Searchy. I only use one or the other. As this was all an experiment, I left it open to use EITHER high side or low side. I'm not actually using both. The low side MOSFET is just a jumper to power side ground.

                          Comment


                          • #14
                            Thank you waltr for the reply.

                            When I started this project nearly 2 years ago, I was torn between the PIC32MX, STM32 and the dsPIC. The PIC parts I liked because it would be possible to use the through hole parts. Some of the dsPIC line have a Programmable Trigger Generator (PTG peripheral) that would've allow the pulse and adc triggering to be done in the background by the peripheral. In the end, I went with the STM32.

                            NOTE - a revision will be made on the next board. The pulse will get driven by TIM1 rather than TIM2. The selected STM32 part allows TIM1 to trigger TIM15, TIM15 has a "repeat count" and can trigger the ADC circuitry, so the entire pulse and capture can be done in hardware with very precise timing. Right now, I have to trigger the ADC capture from an interrupt - which adds some jitter to the start of sampling.

                            Note the jitter is tolerable with a little post processing of the ADC buffer to calculate the TC's at certain points and the relative distance between the points.

                            Originally posted by waltr View Post
                            Interesting project and looking forward to read more.

                            I have done some work on a PIC32MX based PI detector. This has a 10bit ADC sampling at 500kHz.
                            The TX pulse timing and ADC sampling is all done with hardware timers and DMA. Also it sums 4-16 TX cycles to increase ADC resolution and decrease noise. The ADC samples output of preamp from traditional PI circuit. The data of the decay curve is analyzed to obtain the 'TC'. I haven't posted full code since I haven't gotten this to a point where it can be field tested.
                            I have posted some code in the 'Programming' sub-forum.

                            Comment


                            • #15
                              Many thanks

                              Many thanks to all for your comments, input and suggestions. Please feel free to continue commenting.

                              I'll be revising the schematics next weekend (over the Holiday) and create a github site for it at that time. I do have some part substitutions to make - a class D amplifier (with power down) for the audio amplifier and an opamp with a shutdown. I'm hoping to have Rev 1 PCB's ordered by early next week.

                              Again, many thanks !

                              Also, if anyone has any suggestions on how to proceed on the "Open Hardware" front, that would be appreciated. As of right now, putting it on github and declaring it open source is the extent of my plans.

                              Comment

                              Working...
                              X