XU4 using GPIO pwm by wiringpi?

Moderators: odroid, mdrjr

XU4 using GPIO pwm by wiringpi?

Unread postby kosh07 » Thu Dec 08, 2016 4:09 pm

Hi everyone.
I'm trying to use pwm to control servo by wiringPi python library
which GPIO port I could use as pwm port?

and when I control DC motor with motor drive
Is this mean that I dont need pwm port?

My questions are maybe dumb
but I'm a beginner :)
please help me :geek:
kosh07
 
Posts: 37
Joined: Tue Dec 06, 2016 12:10 pm
languages_spoken: english, korean
ODROIDs: XU4

Re: XU4 using GPIO pwm by wiringpi?

Unread postby odroid » Thu Dec 08, 2016 6:15 pm

Give me a link of the motor driver specification and I will review it.

XU4 has no hardware PWM port.
Software bit-bang PWM has very inaccurate waveform since there is no DMA GPIO driver.
It can't control the servo motors.

So consider using an I2C-PWM board via level shifter on I2C bus.
http://www.ebay.com/itm/PCA9685-16-Chan ... 2072404693
User avatar
odroid
Site Admin
 
Posts: 21218
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 using GPIO pwm by wiringpi?

Unread postby kosh07 » Fri Dec 09, 2016 3:16 am

I don't have Servo motor driver and
maybe DC motor driver is L298N I guess
its sad that there is no PWM port :(
I think i should do what irying to do( Serial connection with Arduino and motor shield)

Thanks for information!
kosh07
 
Posts: 37
Joined: Tue Dec 06, 2016 12:10 pm
languages_spoken: english, korean
ODROIDs: XU4

[SOLVED] Re: XU4 using GPIO pwm by wiringpi?

Unread postby nmshaikh » Fri Feb 10, 2017 5:14 am

odroid wrote:Give me a link of the motor driver specification and I will review it.

XU4 has no hardware PWM port.
Software bit-bang PWM has very inaccurate waveform since there is no DMA GPIO driver.
It can't control the servo motors.

So consider using an I2C-PWM board via level shifter on I2C bus.
http://www.ebay.com/itm/PCA9685-16-Chan ... 2072404693


Hi Odroid,

I was hoping you could answer a few questions to help me out with my project :D I'm using the Odroid XU-4 as the brains for a small autonomous car, and I need to control the steering servo. I understand that hardware PWM is not possible, so I was considering three options:

1.You've mentioned that software PWM is really inaccurate. Is there no way I can use that to control just one servo over GPIO? I've found an example by Pi4J to implement softPWM on the Odroid XU4 using Java:
https://github.com/Pi4J/pi4j/tree/master/pi4j-example/src/main/java/odroid/xu4
Can I not use something like this?

2. I'm considering using the I2C-PWM board that you've mentioned and I know that I need to supply 5 V for the servo and 3-5 V for the breakout board itself. But what if I powered these externally? Then I'd only use the SDA and SCL pins from the XU-4. Is this possible? Below is a picture of the PCA9685 I2C-PWM board:
PCA9685.JPG
PCA9685 breakout board
PCA9685.JPG (41.04 KiB) Viewed 86 times

Does the "Logic: 3-5V" mean that I still need to level shift the XU-4 pins?

3. Can I connect the USB I/O board provided by hardkernel to generate a PWM output?
http://www.hardkernel.com/main/products/prdt_info.php?g_code=G135390529643

Your answers would be most useful. Please advise. Thanks in advance :D
Last edited by nmshaikh on Sat Feb 18, 2017 1:01 am, edited 1 time in total.
nmshaikh
 
Posts: 4
Joined: Thu Oct 27, 2016 6:06 pm
languages_spoken: English, Urdu

Re: XU4 using GPIO pwm by wiringpi?

Unread postby odroid » Fri Feb 10, 2017 10:06 am

1. The softPWM on the rpi platform is accurate thanks to the GPIO DMA.
But the Exynos platform has no such GPIO DMA and system timer based PWM can't be used for servo motor application.

2. Supply 5V to the PCA9685 board for your servos.
But, you need a level shifter for 1.8V to 5V interface something like this.
http://www.ebay.com/itm/New-IIC-I2C-Log ... 2136733964

3. The USB IO can control several PWM outputs accurately.
But you will meet several milliseconds latency between XU4 and the IO board due to the USB interface.
So I don't recommend it for the time critical application.
User avatar
odroid
Site Admin
 
Posts: 21218
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

[SOLVED] Re: XU4 using GPIO pwm by wiringpi?

Unread postby nmshaikh » Fri Feb 10, 2017 7:07 pm

Alright, I've placed an order for the level shifter that you've mentioned. I'll let you know how it goes. Thanks a lot for the helpful advice! :D
Last edited by nmshaikh on Sat Feb 18, 2017 1:00 am, edited 1 time in total.
nmshaikh
 
Posts: 4
Joined: Thu Oct 27, 2016 6:06 pm
languages_spoken: English, Urdu

[SOLVED] Re: XU4 using GPIO pwm by wiringpi?

Unread postby nmshaikh » Fri Feb 17, 2017 9:35 pm

Hi Odroid,

Just to update, I've managed to connect the XU-4 to the PCA9685 using the level shifter and run a simple test code on my servo. Everything works and I can move on with my project. Thanks a lot for the help! Really appreciate it :D
Last edited by nmshaikh on Sat Feb 18, 2017 1:00 am, edited 1 time in total.
nmshaikh
 
Posts: 4
Joined: Thu Oct 27, 2016 6:06 pm
languages_spoken: English, Urdu

Re: XU4 using GPIO pwm by wiringpi?

Unread postby rooted » Fri Feb 17, 2017 10:50 pm

Could you add solved to the title please, it makes it easier to distinguish from ongoing issues.

Hope your project goes good.
User avatar
rooted
 
Posts: 3119
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 3 guests