Coder Social home page Coder Social logo

stm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stm's Issues

What causes the needle to slam into surface after slow approach?

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:

  • Is there electronic noise, causing the piezo to drift?
  • Does the piezo slowly drift? (check by monitoring signal afterwards)
  • Is this a mechanical issue?

Teensy measures unstable output of opamp behind DAC

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:

    • 0.5 V: 0.53, 0.53, 0.53, 0.53, 0.53, 0.53, 0.53, 0.53, 0.53, 0.54, etc.
    • 2.0 V: 2.00, 2.00, 2.00, 2.00, 2.00, 2.01, 2.00, 2.00, 2.00, 2.00, etc.
  • 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):

    • 0.1 × 5 V = 500 mV: 499.27, 499.22, 499.72, 499.02, 499.07, 498.86,
      499.17, 499.17, 500.83, 498.76, 497.91, 499.17, 499.12, 499.67, 498.41,
      499.27, 498.81, 498.56, 502.29, 499.72, 498.46, 499.52, 499.07, 498.21,
      499.17, 499.87, 499.32, 499.27, 499.27, 498.71, 499.07, 499.22, 497.35,
      498.21, 497.00, 497.30, 497.20, 498.86, 497.91 (stable)
    • 0.001 x 5 V = 5 mV: 6.45, 5.74, 6.29, 6.80, 6.04, 6.14, 5.99, 5.84,
      6.95, 6.45, 6.09, 5.79, 6.19, 5.79, 6.40, 5.94, 5.69, 6.60, 5.89, 6.95,
      6.04, 9.47, 5.89, 5.89, 5.79, 6.95, 6.34, 5.89, 6.65, 6.19, 7.15, 5.79,
      6.34 (not really stable)
    • Oscilloscope: Looks like there’s too much noise when measuring output of
      opamp behind DAC, set to 5 mV.

What is the source of the noise when approaching?

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:

  • Is the noise also there when just measuring the signal? (it should not)
  • Is the noise also there when moving the piezo down, but not closely approaching?
  • Is the noise also there when running the code for moving the piezo down, but without physically moving it?
    approach_2.pdf

Oscillations visible in approach

See attachment. What is the explanation for the oscillations? Can they be avoided?

Ideas for investigation:

  • Are the oscillations also visible when the tip is not almost on top of the surface? (check with piezo-down 1024 1 to get 1024 measurements)
  • Are the oscillations also visible when the piezo is not moved? (temporarily disable piezo movement in code)

approach.pdf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.