feklee / stm Goto Github PK
View Code? Open in Web Editor NEWSTM for Scanning Tunneling Microscope
STM for Scanning Tunneling Microscope
Typical example (700000 = max. number of steps, 1 = signal to stop at):
> piezo-up 70000
Last signals in reverse (V): nothing recorded
Current signal (V): 0.03; Steps moved: 70000; Piezo position (0-65535): 0; Measured bias (mV): 51.31
(0.00 s)
> piezo-down 70000 1
Last signals in reverse (V): 1.05, 1.00, 0.98, 0.99, 0.98, 0.98, 0.92, 0.95, 0.94, 0.88, 0.78, 0.79, 0.78, 0.79, 0.70, 0.68, 0.70, 0.67, 0.64, 0.66, 0.85, 0.73, 0.82, 0.71, 0.56, 0.69, 0.62, 0.75, 0.76, 0.72, 0.71, 0.76, 0.60, 0.68, 0.76, 0.50, 0.46, 0.37, 0.37, 0.36, 0.35, 0.36, 0.31, 0.27, 0.28, 0.28, 0.33, 0.33, 0.33, 0.37, 0.35, 0.36, 0.33, 0.32, 0.29, 0.27, 0.26, 0.27, 0.25, 0.23, 0.23, 0.22, 0.21, 0.20, 0.20, 0.20, 0.16, 0.22, 0.19, 0.33, 0.32, 0.34, 0.31, 0.27, 0.27, 0.27, 0.26, 0.27, 0.29, 0.29, 0.19, 0.11, 0.10, 0.12, 0.10, 0.10, 0.09, 0.09, 0.11, 0.11, 0.12, 0.11, 0.11, 0.13, 0.14, 0.12, 0.17, 0.19, 0.15, 0.18, 0.12, 0.17, 0.17, 0.15, 0.15, 0.15, 0.15, 0.12, 0.11, 0.13, 0.15, 0.15, 0.15, 0.15, 0.13, 0.04, 0.03, 0.04, 0.02, 0.03, 0.03, 0.02, 0.03, 0.03, 0.03, 0.03, 0.02, 0.03, 0.03, 0.04, 0.04, 0.04, 0.03, 0.03, 0.04, 0.05, 0.04, 0.03, 0.03, 0.02, 0.02, 0.02, 0.01, 0.02, 0.02, 0.02, 0.02, 0.01, 0.01, 0.02, 0.01, 0.02, 0.01, 0.01, 0.02, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.03, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.01, 0.00, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.01, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.01, 0.01, 0.01, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.01, 0.01, 0.00, 0.02, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.01, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.02, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.02, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00
Current signal (V): 2.22; Steps moved: 56129; Piezo position (0-65535): 56129; Measured bias (mV): 52.42
(15.53 s)
> down 0
Last signals in reverse (V): nothing recorded
Current signal (V): 2.23; Steps moved: 0; Piezo position (0-65535): 56129; Measured bias (mV): 52.47
(0.00 s)
The piezo stops in the right moment, i.e. as soon as the signal reaches the
specified threshold. However, according to measurements some time later, the
tip slammed into the surface: 2.2 V is, at of this setup, about the maximum
signal (varies with supply voltage).
Ideas what to investigate:
Measurement with pin A3 (in 16 bit mode) vs. GND, Teensy LC.
Tested:
“Labornetzgerät Typ 5351.0”, “Ausgang 0-32V/0-2,5A” connected to GND and
A3. Simple sketch:
float readVoltageWithTeensyLC(int pin) {
return analogRead(pin) * 3.3 / 0xffff;
}
void setup() {
analogReadResolution(16);
}
void loop() {
Serial.println(readVoltageWithTeensyLC(A3));
}
Results (V) are quite stable:
Simple voltage divider with three 10 kΩ resistors on paritally drained 9 V
batteries: Result of 2.06 V matches closely what voltmeter measures
(2.07 V).
Same sketch as with “Labornetzgerät Typ 5351.0”.
Teensy on circuit, on pin A3 measuring output of opamp behind DAC:
#include <SPI.h>
#define BIAS_CHIP_SELECT_PIN 8
float readVoltageWithTeensyLC(int pin) {
return analogRead(pin) * 3.3 / 0xffff;
}
void setBiasVoltageFactor(float factor /* [0, 1] */) {
const int iMax = (1 << 12) - 1;
int i = iMax * factor;
byte b;
digitalWrite(BIAS_CHIP_SELECT_PIN, LOW);
SPI.beginTransaction(SPISettings(1400000, MSBFIRST, SPI_MODE0));
b = highByte(i);
b &= 0b00001111;
b |= 0b00110000; // activates chip, sets gain to 1×
SPI.transfer(b);
b = lowByte(i);
SPI.transfer(b);
SPI.endTransaction();
digitalWrite(BIAS_CHIP_SELECT_PIN, HIGH);
}
void setup() {
pinMode(BIAS_CHIP_SELECT_PIN, OUTPUT);
digitalWrite(BIAS_CHIP_SELECT_PIN, HIGH);
SPI.begin();
setBiasVoltageFactor(0.1 /* × 5 V */);
analogReadResolution(16);
}
void loop() {
Serial.println(readVoltageWithTeensyLC(A3));
}
Results (mV):
See attachment. What is the source of the noise?
Note: This is not the 50 Hz electric noise that the setup easily picks up from mains.
Ideas for investigation:
See attachment. What is the explanation for the oscillations? Can they be avoided?
Ideas for investigation:
piezo-down 1024 1
to get 1024 measurements)A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.