Need to write the code to implement the DC motor controller which can control the motor direction using the H-bridge, also attache encoder logic to observe the motor position update after turning of the motor.

I have gone through one example "servo_motor" using PWM method to control motor direction, but that seems little different from what I want to develop.

I am having nRF5340 + DC motor + Encoder + H-bridge(L293D)

I want to start the motor on request from other device/microcontroller

  • Hello,

    I don't have much experience with motor drivers like this, as it falls a bit outside of Nordic specific applications. But I believe that tese types of drivers usually takes one GPIO input as direction, and one as "on/off". Perhaps if you want better control, you can use a PWM signal and input it into the on/off, so that you can set e.g. 50%, by using a PWM signal with 50% duty cycle. 

    Please be aware that the QDEC on the nRF is not intended for motor control, as it is not fast enough. For lower speeds it may work, but the QDEC is intended for computer mice scrolling wheels. 

    Best regards,

    Edvin

Related