EmbDev.net

Forum: µC & Digital Electronics Motor with non-directional encoder arduino library


von Fasaso H. (fasaso)


Rate this post
useful
not useful
Hello all,

I bought the following actuator on the internet:

https://de.aliexpress.com/item/4000374091344.html?gatewayAdapt=glo2deu&pdp_ext_f=%7B%22sku_id%22:%2210000001530238467%22,%22ship_from%22:%22%22%7D&gps-id=pcStoreJustForYou&scm=1007.23125.137358.0&scm_id=1007.23125.137358.0&scm-url=1007.23125.137358.0&pvid=3541ffb2-6450-4523-9788-89953e9fbd28&spm=a2g0o.store_pc_home.smartJustForYou_825606946.1

There are the following pins: M+, M-, GND, C and A. By changing the 
polarity of M+ and M- I can control the direction of the motor.
At C I give 5V, GND is clear and at A I simply measure 0V or 5V 
depending on the position of the motor. I would like to drive the motor 
with a L298n module. Most PID libraries I have seen use an encoder with 
2 pulses to determine the direction. But since I define the direction of 
the motor with the H-bridge circuit of the L298n I only need 1 pulse for 
the speed (I don't have any more anyways). Now my question: is there a 
library which makes it easy to control a motor with a non-directional 
encoder?

Thanks for your answers

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.