Component recommendations: Rotate a servo using signal from a linear encoder



  • Greetings all. I'm looking for some help on what components to start with for a small project. Details below:

    ( I've played around with Raspberry Pi, and am a proficient Python coder but a beginner a beginner on the M5Stack system. )

    1. I read a signal from a vernier calliper in real time using a setup like this:
      https://www.instructables.com/Caliper-Data-Interface/
      This signal represents a real time measurement of linear displacement of a machine component.

    2. The signal feed from the calliper is passed to a Python function (currently on a Raspberry Pi) to work out the displacement D in mm.

    3. A function f is and applied to D to return an angle R; R = f(D). This happens in the Python code (currently on a Raspberry Pi).

    4. Finally a small 9g micro-servo (~3V) (in fact, a prism mounted on the servo) is rotated by the angle R.

    The setup works on a Pi but is a mess of wires and breadboards. I'd like to use M5Stack to make a portable and field-usable device.

    Some requirements:

    1. System should have a screen and button interface to select different functions f and various modes (calibration, operation etc). Once of the cores, but not sure which one. Happy to go with the most powerful one.
    2. System should have a battery module with enough to power the servo. System should be rechargable, and once charged, should not require external power in operation. Which battery module?
    3. Do I need any other components to read the encoder signal or generate the servo signal?
    4. What kind of wiring? Encoder has a 4 wire ribbon, and servo has a 3 wire ribbon.

    Would appreciate your help to get me started.

    Many thanks,

    Zed Bee



  • For a Start M5Stack uses Micropython and so you already know how to program it

    What kind of Linear encoder are you thinking of



  • @ajb2k3 said in Component recommendations: Rotate a servo using signal from a linear encoder:

    For a Start M5Stack uses Micropython and so you already know how to program it

    What kind of Linear encoder are you thinking of

    Many thanks @ajb2k3.

    Linear encoder: it'll be a set of digital vernier calipers with a 4-pin data output - very similar this post by Martin Thalheimer: https://shorturl.at/anNRU

    Level shifting: Same as in Martin's post, my encoder outputs a 1.5V signal, while microcontrollers typically require a higher voltage input 5V(?). Ideally, I'd like an M5Stack component to handle the level shifting, rather than making another circuit board dangling between the devices .

    Updated question

    • Have a linear encoder with a 1.5v signal output similar to https://shorturl.at/anNRU
    • Have a 5v micro servo
    • Need to read the displacement d on the encoder, and rotate the servo by an angle a = f(d)
    • Need help selecting the correct M5Stack components that:
      -- includes a microcontroller, screen & buttons interface, and rechargeable battery (one of the cores. Which one?)
      -- reads the 1.5v signal from the encoder and handles the level shifting internally (or doesn't need level shifting?)
      -- runs a Python script that applies the transformation a = f(d) (the core)
      -- rotates servo by angle a (servo controller).