Nanosurf Insights
Back to Insights home

FridayAFM - Symphonic AFM


Héctor here, your AFM expert at Nanosurf calling out for people to share their Friday afternoon experiments. Today I use acoustic waves to excite an AFM probe (and show a little bit of coding and automatization along the way). (Thanks David, Daniel, Paul and Pieter for your patience).

People have used all sorts of things to excite cantilevers to do AFM, piezo shakers attached to the probe, piezo attached to the sample and the probe in contact with the sample, photothermal excitation, autoexcitation using piezoelectric cantilevers, electromagnetic coils and magnetic probes... So, why not using acoustic waves? In other words, why not produce noise with a speaker somewhere far away from the probe and sample, at the resonance frequency of the cantilever, and use that as excitation for imaging? (See Ref 1, and if you need a refresher on AFM theory, see our AFM theory section).

euphonic afmThis is what, after quite a lot of discussion, we agreed on calling Symphonic AFM. Don't confuse it with acoustic AFM, which is  done in contact mode and vibration transmitted to the probe through the sample. In this case we are in dynamic mode, with the probe oscillating above the sample.

So this is how I did it. I generated a pure tone with my mobile phone and used the AFM hardware and software to detect the vibration and track the surface sample while the probe oscillates. 

Software-wise everything is controlled using Python. Python sends commands to the AFM using the Nanosurf python library (see more on the scripting interface here), and on the mobile phone side I used an app called phyphox.


Phyphox is a tool to turn your phone in a short of mini laboratory. It lets you get access to sensors, perform acoustic experiments... and lets you record the measurements. It also allows a web interface if you are on the same network, which allows you to see and control the app on your computer browser, and also, using AJAX and JASO, it provides a remote interface to control the app using scripts. 

The Nanosurf Python interface lets you control the AFM like if you were using it, and if you use the low level scripting, it lets you get access to all shorts of additional signals and even reroute things.

symphonic AFM 1


This is the algorithm to sweep the frequency on the phone and read the oscillation amplitude from the AFM.

  1. Start the AFM software, load the probe and align the laser.
  2. Start the phyphox app in the phone and go to tone generator. On the top right corner on the additional options, allow remote access (need to be on the same network as your computer controlling the AFM). Copy the URL address onto the Python code below.
  3. Place the phone inside of the acoustic hood (which will act as a resonant chamber and will prevent you from becoming deaf from the annoying sounds about to happen).
  4. Run the code below.
#Tone generator part#
from urllib.request import urlopen
import time
PP_ADDRESS = "" #This address you have to change it and input what the mobile phone tells you.

url = PP_ADDRESS + "control?cmd=start"
response = urlopen(url) #Tells phyphox to start playing a sound.
#url = PP_ADDRESS + "config?" #Not really needed, it is here for debbuging.
#response = urlopen(url)

#AFM setup part#
import nanosurf as nsf
spm = nsf.SPM()
ll = spm.lowlevel
application = spm.application
opmode = application.OperatingMode
#Here I'm basically defining sa1 as the main lock-in in the AFM. We will read amplitude values from it
sa1 = ll.SignalAnalyzer(ll.SignalAnalyzer.Instance.INST1)
#We want the amplitude of the exciting piezo shaker to be zero.

#Sweep frequency, collect data and plot#
import numpy as np
import matplotlib.pyplot as plot

for k in range(100,24000,100):
    #We put a new frequency on the lock-in and on the phone.
    opmode.VibratingFreq = k
    url = PP_ADDRESS + "control?cmd=set&buffer=f&value="+str(k)
    response = urlopen(url)
    #We interrogate the lock-in to see the current amplitude
    print(f"sa1.current_amplitude.value: {amplitude[index]}")

#After finishing, we plot the results.
plot.plot(freq, amplitude)

The result when I run the code was something very similar to the frequency sweep obtained using the piezo shaker. Although I have to admit that it is several orders of magnitude lower.

freq sweep-1

So, now for the real test. Can we actually capture images in Dynamic mode using this method of probe excitation?

This is the algorithm. 

  1. Nanosurf: We disable automatic frequency sweep in the AFM and set the Free vibration amplitude to zero to disable the piezo.
  2. Phyphox: we output a tone at the resonant frequency of the probe.
  3. Python: We run this script below to set the setpoint in volts. If before, when we did the frequency sweep with the phone, we got 0.4 mV at the peak, a reasonable value for the setpoint is half of that, or about 0.2 mV. The script overrides the software which is designed to fix the setpoint as a percentage of the Free vibration amplitude (which we set to zero and thus will not work to provide us with a reasonable setpoint).
  4. Nanosurf: Approach, start a scan, and fine tune the gains and scan speed.
#Manual setpoint adjustment in V instead of percentage
import nanosurf
spm = nanosurf.SPM()
ll = spm.lowlevel
z_controller = ll.ZControllerEx()

and this is the result:

symphonic images-1Given the small amplitude of the oscillation, and the fact that very likely the AFM structure was vibrating, I think the result is quite impressive. So, the answer is yes, we can use sound to drive AFM probes, but it is a bit unclear how much energy comes through the air, how much through the AFM structure (similar to have a piezo shaker), and how much through the sample also vibrating.

A little bit technical today, but I hope those that love to tinker with the AFM will appreciate this and find it useful as a reference for further tinkering.

If you have suggestions or requests, don't hesitate to contact me.



1 Mokrane BoudaoudYassine HaddabYann Le GorrecPhilippe Lutz; Study of thermal and acoustic noise interferences in low stiffness atomic force microscope cantilevers and characterization of their dynamic properties. Rev. Sci. Instrum. 1 January 2012; 83 (1):013704.




Back to Insights home

Post your comments in the form below: