EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: typematrix on May 31, 2018, 01:37:42 pm

Title: Raspberry Pi Motor Library : A python 3 library for various motors and servos to
Post by: typematrix on May 31, 2018, 01:37:42 pm
Hi

TWIC

Raspberry Pi Motor Library : A python 3 library for various motors and servos to connect to a raspberry pi

https://github.com/gavinlyonsrepo/RpiMotorLib

Overview
--------------------------------------------
* Name: RpiMotorLib
* Title: Raspberry pi motor library.
* Description: A python 3 library for various motors and servos
to connect to a raspberry pi.
There are three categories in library.
Stepper motors , Dc Motors and Servos. The following is a list of tested parts

1. Stepper motor
    * Unipolar 28BYJ-48 Stepper motor controlled by ULN2003 driver module
    * Bipolar Nema 11 Stepper motor controlled by L298N H-Bridge Motor controller module.
    * Bipolar Nema 11 Stepper motor controlled by A4988 Stepper Motor Driver Carrier
    * Bipolar Nema 11 Stepper motor controlled by DRV8825 Stepper Motor Driver Carrier
    * Bipolar Nema 11 Stepper motor controlled by A3967 Stepper Motor Driver  "easy driver version 4.4"

2. DC motors
    * DC brushed motor controlled by L298N Motor controller module.
    * DC brushed motor controlled by a transistor.

3. Servo GPIO PWM
    * Tower pro Digital SG90 micro servo
    * Hitec HS422 servo
    * Tower pro MG996R Servo

The end user can import this library into their projects
and then control the components with short snippets of code.
The library is modular so user can just import the section they need.

Regards
 :)
Title: Re: Raspberry Pi Motor Library : A python 3 library for various motors and servos to
Post by: james_s on June 01, 2018, 11:45:12 pm
Neat, I'll file that away in my things to play with folder. Thanks.
Title: Re: Raspberry Pi Motor Library : A python 3 library for various motors and servos to
Post by: Ian.M on June 02, 2018, 02:37:38 am
Oh dear: it imports GPIO and uses  GPIO.PWM(), which is software PWM.   If you've ever scoped a  GPIO.PWM signal or even set the frequency to within the audio range and listened to it on a speaker, you'll be aware how rough the result is, as other threads vary the CPU load and this the latency of the PWM thread.   I'd have to hook up a servo to be 100% certain, but I bet the servo is excessively twitchy.

Personally I've moved away from using the GPIO module and switched to using the pigpio library, which is much much better at generating low-jitter waveforms.  http://abyz.me.uk/rpi/pigpio/python.html (http://abyz.me.uk/rpi/pigpio/python.html)


Title: Re: Raspberry Pi Motor Library : A python 3 library for various motors and servos to
Post by: typematrix on June 02, 2018, 06:12:39 pm
Oh dear: it imports GPIO and uses  GPIO.PWM(), which is software PWM.   If you've ever scoped a  GPIO.PWM signal or even set the frequency to within the audio range and listened to it on a speaker, you'll be aware how rough the result is, as other threads vary the CPU load and this the latency of the PWM thread.   I'd have to hook up a servo to be 100% certain, but I bet the servo is excessively twitchy.

Personally I've moved away from using the GPIO module and switched to using the pigpio library, which is much much better at generating low-jitter waveforms.  http://abyz.me.uk/rpi/pigpio/python.html (http://abyz.me.uk/rpi/pigpio/python.html)

Ya, I am aware the servo twitching issues with RPIO , I mention it in documentation.
RPIO is  ok for some applications and methods. It is an issue If you need slow precise  steps.
At certain delays and step sizes there is twitching of the servo position.
I will look into a change over from RPIO to pigpio at next update for the servo function, add it to my TODO list.