Coarse approach


I recently motorized the coarse approach mechanism on my STM. The coarse approach is done by first fully extending the Z-piezo (reasonably slowly) to search for the surface. If it doesn’t find the surface, it fully retracts, and a stepper motor, which drives the rear fine-pitch screw on the STM, takes a few steps to move the tip close to the sample. The distance it moves is somewhat less than the Z-piezo travel. After moving the motor, the Z-piezo fully extends again to search for the sample surface. This process repeats until the piezo finds the surface. When this happens, the Z-piezo retracts one more time, and the motor adjusts the piezo height above the sample so that, when the scanner extends one last time, it will find the sample at about the center of its travel range (just to give it some room to drift in either direction). Once the sample surface is found the Z-feedback loop switches on, and scanning begins.

Here are some images zooming in on a gold surface taken after doing a motorized coarse approach. Note the lack of craters! I’ve applied some lighting effects in Gwyddion to help make the edges of the atomic terraces more apparent. No luck resolving individual atoms on metals yet though… I believe the issue is acoustic noise. Time to build a sound-proof box…

This technique is called the “woodpecker” approach, and it prevents vibrations from the motor from crashing the tip, since only the Z-piezo brings the tip and sample into contact. Since the hard part is done by the piezo, the motor step size only needs to be smaller than the piezo range, although it’s nice to have a smaller step size to be able to center the scanner in its travel range before beginning the scan.

My scanner has about 700 nm vertical travel. Creating steps much smaller than this with a stepper motor is really no problem at all, especially since we don’t care about backlash. I used the 28byj-48 stepper motor to drive the rear fine-pitch screw on the STM. I milled a slot in the end of the screw’s plastic knob that fits over the motor shaft, while allowing the screw to move up and down. The 28byj-48 motor is very cheap and is geared down to about 2048 full steps/revolution. The fine screw moves 250 um/revolution, and the STM body’s lever reduction reduces the motion by a factor of about 20. This gives a step size of 250um/2048/20 = 6 nm.


There are a few subtleties that came up here: when the Z-feedback is switched on, the integral term first must be initialized to the current Z-value. Otherwise, the feedback will cause a small jump in the Z-piezo when it’s switched on, which crashes the tip! Took me a while to figure out why I was still seeing craters in my scans! Another issue is thermal drift. The motor produces a substantial amount of heat, which can cause the scanner to drift out of range within minutes. The solution is simply to turn the motor off when it’s not moving, i.e. when the piezo is extending and when the scan starts. This means that we can’t use microstepping, which is I used a geared motor in the first place. I’m also running the motor on 3.3V rather than 5V to further reduce heating.

27 thoughts on “Coarse approach

  1. (I hope this doesn’t double post.)
    Thank you for this amazing project!
    I’m trying to replicate this project and I’d like your feedback on some of the tweaks I’m considering.

    I’m thinking of using an ESP32 instead of a Teensy, do you think that would cause any issues (besides needing to modify the code)?

    In a comment you said:
    “If you’re looking to save some cost on the electronics too, I still get good performance with all the op-amps (except for preamp) replaced with TL07x.”
    I assume you were referring to the TI Op-Amps like the TL072.
    Is it okay to instead use the STMicroelectronics TL072? (I’m looking at getting the boards pick-and-placed by JLCPCB, and they only have the ST ones.)

    Is the ADS8681 a decent replacement for the LTC2326? (It’s cheaper and has higher sample rate)
    The only LTC2326 I could get on Digi-key is such a tiny chip I worry about my ability to solder it.
    I see you mentioned the ADS8517 in another comment, so, I assume that’s also a possibility.

    In another comment you said:
    “Yes, the second op-amp connected to each DAC channel provides a gain of two
    and shifts the output range to bipolar by subtracting the 10V reference.”
    Am I understanding this correctly?:
    So, because of the gain of two, this results in 0V to 20V, then minus 10V, which gives it the range of -10V to 10V?
    Wouldn’t a gain of three give the full -15 to +15V range, or does it get increased by a later OP-Amp?
    Or does the voltage summing (X + Z) end up pushing it over the limit to +-20V?
    Wouldn’t it make sense for the X/Y to be limited to +5V/-5V and the Z to +10V/-10V. (Since it sounded like the z-axis range was more important.)

    How often does the Bias voltage need to be adjusted? Is it once per scan/sample?
    Or can it be run off a low precision microcontroller DAC (8-bit) or a potentiometer?
    I ask because I want to instead use the fourth DAC output as a fine-tune Z-axis in addition to the other z-axis output.
    Do you think that would be reasonable?
    Ex. If I have the fine-tune one go through a 300k Ohm resistors while the normal Z goes through the same 3kOhm resistors, wouldn’t that give it 1/100th the displacement? I guess I could do something crazy like 3-Million Ohm to get 1000 to 1 reduction, but that’d be overkill right?

    Because of these tweaks, I’ve recreated the PCB design, it’s still influenced heavily by your design.
    If I get it all working well, is it okay if I Open-Source all my files (derivatives from your design)?



  2. Really cool! really interested!!
    How much would be the total approx component cost?
    What things you would have done differently if would start again today?
    How would you rate this great setup in comparison to the commercial one?
    Appreciate it!!

    Liked by 1 person

  3. Hi Dan,
    Wonderful build, and great blog! Thanks for sharing.
    Needed to clarify a few issues.

    1. You speak of a “STM body lever reduction” that gives you reduction of a factor of 20, I can’t see the lever reduction stage in your build’s or probably I’m missing something. As I see the STM has a geared stepper motor coupled to a screw for the coarse stage.

    2. I remember reading that you etched the piezo buzzer with nitric acid, I can’t locate that page now. Do you remember the concentration of nitric acid. I’m unable to get good etches, looks like the nitric acid eats away the whole piezo buzzer.

    3. Are you still working on improving your build with an upgraded version.

    Thanks in advance.


    • Hi Kurt,

      1. The rear approach screw is 20 mm away from the scanner, and the two front screws are ~1 mm away along the front-to-rear axis, so the tip is moved ~20X less than the rear screw when the rear screw is turned.

      2. I haven’t tried etching in nitric acid, but I know others have. I’m not sure about concentration, but something like ~10% might be a good starting point.

      3. Yes! I’m working on a few upgraded versions including an AFM.



  4. Hi Dan,

    I’m working on my own DIY STM project, and I think you did a great job with your course approach mechanism and the project in general. However, I can’t justify to myself spending a total of $50 on three screws and three bushings – I’d prefer to put my money towards other parts of the project! Do you know of any alternatives that might work at a more reasonable price?

    Thank you in advance,


    • Hi Aidan,

      You could try using regular screws instead, ideally with as fine a pitch as possible. Those expensive screws are 1/4-80, and give ~6 nm average step size with the motorized coarse approach described here. 6 nm is overkill, and really you just want a step size that’s decently small compared to the scanner’s Z-range. If you used 1/4-28 screws instead, the step size would be only ~3X larger. You’ll have to think about how the screws will contact the base since they won’t have ball-points.

      McMaster-Carr also has ball-point screws with regular threads that are a bit cheaper, and you wouldn’t need bushings for them:

      If you’re looking to save some cost on the electronics too, I still get good performance with all the op-amps (except for preamp) replaced with TL07x.



  5. I love your project and it has inspired me to build my own to help me with my research. Thanks for all the work you have done. I hope one day I can inspire people just as you have.

    I was wondering, knowing what you know now what would you change or improve on to get better accuracy or make it easier to use? You had listed some other options for op amps and said you were using better DACs now. What are important features I should be looking out for (besides bias) when choosing an op amp or DAC or ADC for that matter. I wanted to go with 24bits since it seems in every STM project the builder lists that as a barrier. Another question is do you think it would be better to split the Analog electronics (sensing and drive) onto 2 boards or will the wiring just create unnecessary noise?

    I am sure you have seen the project on Hack a day that implements your guard ring suggestion in the pre-amp. My plan right now is to use that design for the pre-amp.

    I have found some 50-60mm piezo discs I was hoping would increase the range of movement for the tip due to their larger size. I will probably need to adjust the driving voltage too just as the voltage needs to be higher with the piezo tubes. Do I need to make sure they have a certain frequency or is that not so important? I also want to automate the coarse movement but I would like to use the sample stage for the coarse movement. I will be building the frame large enough that I can get more distance between the head and the stage to make it more accessible without knocking into things.


    • Hey Martin,

      There are plenty of things I’m currently working on to make it easier to use, mostly on the software side though. For driving the scanner, you mainly need to look for low noise. I’m currently using TL07x which are dirt cheap and perform just fine since the SNR is still adequate for atomic resolution scans on HOPG. Op-amp noise isn’t the limiting factor for me even with these. The scanner DAC should also have low noise and low glitch energy. The DAC’s voltage reference needs to be filtered to reduce noise. Some audio DACs will probably work well, I’ve experimented a bit with PCM1798 and have a design in progress using those. It’s 24-bit with very good SNR.

      The preamp performance is more important the ADC’s. You don’t as much resolution with the ADC since the tunnel current signal is so sensitive already. I don’t think there’s much benefit to separating the sensing and drive onto separate boards since the signal coming in has already been amplified by the preamp.

      I’m also using a guard ring on my preamp now, just make sure to clean all the flux off the board after soldering or you might get huge leakage currents!

      A larger piezo disc will probably give you a larger range of motion with the same drive voltages, but the resonant frequencies are lower so they might be more vulnerable to vibrations and won’t be able to scan as fast.



      • Wow thanks for the quick response. So much information. I was looking over your parts list and I was wondering what voltage caps you were using (16v?) and what %? Is there a reason for the different sizes you used for some of the Tantalums when the same specs are available or did you just have those on hand?

        Thanks again,


      • The caps should be rated for significantly higher voltage than what they’re being subjected to, so don’t use 16V caps for 15V power supplies. Use something like 25V instead. For ceramics, I usually use 50V rated caps for 15V supplies because their capacitance can vary with the applied voltage. You can avoid this effect by choosing ceramic caps with significantly higher voltage rating than what you’re applying.

        The smaller tantalum caps in the design are used on 5V and 3.3V supplies and they are rated for lower voltages (probably 10V but I can’t remember).



  6. I would like to ask how did you move the tip(or the platform) to achieve scanning for rows and columns? Did u use servos or piezoelectric? Or u just simply tilt the scanning pin? Thx!


  7. Hi Dan,
    I’ve been wondering for a while and I would like to know how did you manage to assemble the sample holder.
    Do you use a metal base with the wire soldered and attach the sample with conductive tape or you have another method?


    • First, here’s a piece of thin glass (microscope coverslip) glued to the aluminum base of the STM to insulate the sample from the grounded base. There’s a steel nut glue on top of that as a spacer and a magnet glued on top of that. The bias wire is soldered directly to the magnet. Make sure to use a nickel plated NdFeB magnet and make the solder joint quickly to avoid depoling the magnet.
      To mount a sample, I glue it to a magnetic disc or coin and use a small blob of conductive ink to make an electrical connection between the disc and the sample. Then just place it on the magnet. This way you can easily swap out samples.


  8. Nice blog, Thank you verry much to create guiline to make STM,
    I’m developer recently create software on HF STEM,
    Now I’ll to make a STEM on my own and your blog is verry useful.

    Greate day.

    Liked by 1 person

  9. hey dan! kar here, postdoc working on UHV and STM system. I and my friend are trying to construct an STM project based on your homemade STM. Hope we can do it.


    • Hi Matthias,

      Looks great, nice job on the acoustic isolation! Since the resonant frequency of the structure is so low, I don’t think there’s any need for magnetic damping (and the way I implemented mine is really not optimal), as long as the scan head is rigid.

      I’m working on several upgrades and hopefully will post some updates soon.



  10. Hi,

    Is the heat of the motor transferring to the scanner through the aluminium rods used to secure it or through the brass rotating end or it’s neither of them.
    In the first case, you could just secure the motor to some sort of frame that isn’t connected to the scanner head.



    • Hi Thomas,
      The motor couples to a plastic knob on the screw, so it’s probably mostly transferred through the aluminum standoffs. I should have used plastic.
      The motor in my case does need to be mounted to the top part of the scan head, because that part can tilt.


  11. Hi Dan,

    i`m quite impressed! It seems to work very nice and yet its very simple constructed! Are you going to use one or still three stepper motors in your upcoming design? Im kind of surprised, that the motor heating is becoming an issue, i wouldnt never expected that. I´m still planing to use three of them, so we`ll see if i can solve this problem sufficiently.
    Regarding the piezo drivers, i´m currently prefer to use some high voltage op amps in a bridge configuration (e.g. Apex PA240, Apex PA340 or Apex PA443 (dual)). This makes the whole story quite easy to handle and especially the PA443 offers very good noise characteristics.
    Due to some time demanding events at my phd thesis i wasnt able to find enough time to create a hackaday-project, but this will come.



    • Hi Matthias,

      I’ll probably stick to 3 motors in the upcoming design, because they’re so cheap, and that design eliminates manual adjustment and tilting of the head.

      The PA240/PA340 have too much noise, but the PA443 actually looks pretty good! And the price isn’t too bad either. I hadn’t seen that one before, looks like a new product. The best thing out there is probably the PA95, but the PA443 isn’t far behind in terms of noise. Doing a quick estimate, looks like this will give about ~3 pm p-p noise at 10 kHz bandwidth for the tube I have, with 1 um Z travel. I’d say that’s good enough! I’ll probably go ahead and use this amp too, just to simplify the design.

      EDIT: whoops, I meant 3 pm, not fm.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s