Denis Periša Posted December 20, 2016 Posted December 20, 2016 (edited) I have some servo motor I would like to start but cannot find any info on how to do it. Is PWM available in Pi PC or Pi Zero? Thanks Edited March 25, 2017 by zador.blood.stained Merged 2 threads with the same topic (Orange Pi Zero PWM)
nopnop2002 Posted December 22, 2016 Posted December 22, 2016 There is /dev/pwm in nanopi. nanopi@nanopim1:~$ ls /dev/p* /dev/ppp /dev/psaux /dev/ptmx /dev/pwm A sample code is here. https://github.com/friendlyarm/matrix/blob/master/demo/matrix-pwm/Matrix-pwm.c http://www.friendlyarm.net/forum/topic/6810
zipzit Posted January 4, 2017 Posted January 4, 2017 There is /dev/pwm in nanopi. nanopi@nanopim1:~$ ls /dev/p* /dev/ppp /dev/psaux /dev/ptmx /dev/pwm A sample code is here. https://github.com/friendlyarm/matrix/blob/master/demo/matrix-pwm/Matrix-pwm.c http://www.friendlyarm.net/forum/topic/6810 I'm trying to understand how you get from point A to point Z via that matrix repository at Github. That repository is intended "Nanopi2/Fire/M2" devices, yet the Orange Pi Zero is an Arm H2 device. Remember the orange pi zero is listed as the topic for this posting. Is the Orange Pi Zero Arm H2 really a Nanopi2 / Fire or M2 device? How do you know that? Are these things the same? (I'd refer to the readme.md sheet at the matrix repository, but alas, that doesn't exist... sigh.) Orange Pi Zero = Arm H2 Quad-core Cortex-A7 1.2Ghz. Raspberry Pi Zero =A Broadcom BCM2835 application processor with 1GHz ARM11 core (Note: no offense intended here.. I'm struggling to understand how to address the pins on the Orange Pi Zero, and I'm more than confused here... Any hints or links to help gain and understanding? Many thanks --Zip)
Denis Periša Posted January 9, 2017 Author Posted January 9, 2017 yup. but I read somewhere that 4.9 kernel should have pwm support for h3/h2 devices. Yet, I don't see it.
zador.blood.stained Posted January 9, 2017 Posted January 9, 2017 yup. but I read somewhere that 4.9 kernel should have pwm support for h3/h2 devices. It has the support, but it's not activated by default since hardware PWM is supported only on PA5 pin, which is used bt default serial console (UART0). So it requires some DT modifications which include moving default debug console to a different UART port.
martinayotte Posted January 9, 2017 Posted January 9, 2017 Just a suggestion : maybe it is better to add small PCA9685 board attached to an I2C bus, you will get 16 PWM 12bits channels for few bucks.
borombo Posted January 10, 2017 Posted January 10, 2017 how about software pwm? found this code in another site: #include <wiringPi.h> int main () { wiringPiSetup(); int t_on, t_off; int d, i; d= 100 ; t_on= 50 *d; t_off= 50 *( 100 -d); for (i= 10 ; i!= 0 ; i++) { digitalWrite( 1 , LOW); delayMicroseconds(t_on); digitalWrite( 1 , HIGH); delayMicroseconds(t_off); } return ( 0 ); }
B.K.O. Posted January 11, 2017 Posted January 11, 2017 this guy figured it out with PCA9685 but what do we have to change to drive servos 1
tcmichals Posted January 11, 2017 Posted January 11, 2017 this guy figured it out with PCA9685 but what do we have to change to drive servos Here is a how-to for servos, yes it is for micro-python, but it provides info on how to set it up and values. https://learn.adafruit.com/micropython-hardware-pca9685-pwm-and-servo-driver/software
Cloud Peng Posted February 24, 2017 Posted February 24, 2017 I could not found pwm folder in the "/sys/class". so, how to enable pwm in orange pi zero?
Igor Posted February 24, 2017 Posted February 24, 2017 https://forum.armbian.com/index.php/topic/2344-pwm-on-allwinner-h3/ And use this search engine to get other posts regarding pwm: https://www.armbian.com/search_gcse/
Cloud Peng Posted February 24, 2017 Posted February 24, 2017 I am orange pi zero (H2+, 26 pin gpio), it as same as other ?
iboguslavsky Posted March 24, 2017 Posted March 24, 2017 There is a new PWM driver available here (uses UART0_RX pin on the UART breakout header): https://github.com/iboguslavsky/pwm-sunxi-opi0.git Have a look at the examples also.
zador.blood.stained Posted March 25, 2017 Posted March 25, 2017 I tested PWM on mainline too, will push a DT overlay to enable it soon.
Sergey Kravtsov Posted February 4, 2018 Posted February 4, 2018 Hi all, I forked PiZyPWM library, so now we got Python PWM library for Orange PI. Tested on Orange Pi Lite with motor drivers. Feel free to use and fork https://github.com/evergreen-it-dev/orangepwm
Recommended Posts