mikerr
Posts: 2778
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Driving multiple servos from the RaspberryPi

Sun Feb 08, 2015 4:56 pm

Servoblaster doesn't work with the new Pi 2 , and according to this is a simple change:
joan wrote:Anything which uses userland DMA will require updating above and beyond the peripheral base address move (0x20000000 -> 0x3F00000) to work on the Pi 2.

Looking in servo.d I see

Code: Select all

#define DMA_BASE                0x20007000
#define DMA_LEN                 0x24
#define PWM_BASE                0x2020C000
#define PWM_LEN                 0x28
#define CLK_BASE                0x20101000
#define CLK_LEN                 0xA8
#define GPIO_BASE               0x20200000
#define GPIO_LEN                0x100
#define PCM_BASE                0x20203000
#define PCM_LEN                 0x24
So it should be a matter of editing those to the following and recompiling ?

Code: Select all

#define DMA_BASE                0x3F007000
#define DMA_LEN                 0x24
#define PWM_BASE                0x3F20C000
#define PWM_LEN                 0x28
#define CLK_BASE                0x3F101000
#define CLK_LEN                 0xA8
#define GPIO_BASE               0x3F200000
#define GPIO_LEN                0x100
#define PCM_BASE                0x3F203000
#define PCM_LEN                 0x24
I guess this would make a Pi-2 specific version
Last edited by mikerr on Sun Feb 08, 2015 5:18 pm, edited 3 times in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
joan
Posts: 14259
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Driving multiple servos from the RaspberryPi

Sun Feb 08, 2015 5:15 pm

mikerr wrote:Servoblaster doesn't work with the new Pi 2 , and according to this is a simple change:
joan wrote:Anything which uses userland DMA will require updating above and beyond the peripheral base address move (0x20000000 -> 0x3F00000) to work on the Pi 2.
...
...
So it should be a matter of editing those to the following and recompiling ?
...
Afraid not. With "will require updating above and beyond the peripheral base address move" I was trying to point out there is rather more involved than just changing a number and recompiling.

mikerr
Posts: 2778
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Driving multiple servos from the RaspberryPi

Wed Apr 08, 2015 11:22 am

Richard has posted a new pi-2 version here:

http://www.raspberrypi.org/forums/viewt ... 5&start=47

works for me ;)
Android app - Raspi Card Imager - download and image SD cards - No PC required !

raver79
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am

Re: Driving multiple servos from the RaspberryPi

Fri Apr 24, 2015 8:59 am

Hi

I am having a bit of a problem. I have managed to wire up two servos to create a pan/tilt mechanism for my camera. The servos are both moving although one servo moves to the default position before moving to the position i have requested. If i ask it to go to 50% for example it goes to 0% and then moves to 50%. Anyone got any idea how i may be able to solve this problem?

Dean

User avatar
joan
Posts: 14259
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Driving multiple servos from the RaspberryPi

Fri Apr 24, 2015 9:20 am

raver79 wrote:Hi

I am having a bit of a problem. I have managed to wire up two servos to create a pan/tilt mechanism for my camera. The servos are both moving although one servo moves to the default position before moving to the position i have requested. If i ask it to go to 50% for example it goes to 0% and then moves to 50%. Anyone got any idea how i may be able to solve this problem?

Dean
Is this a one-off initialisation problem or does it happen whenever you change servo position?

Anyhow, check your code. It seems unlikely to be a problem with servoblaster.

raver79
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am

Re: Driving multiple servos from the RaspberryPi

Mon Apr 27, 2015 6:10 pm

Hi

It happens whenever i change the servo position

User avatar
joan
Posts: 14259
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Driving multiple servos from the RaspberryPi

Mon Apr 27, 2015 6:57 pm

raver79 wrote:Hi

It happens whenever i change the servo position
I've not heard of anything like that before.

Which Pi model and which model of servos?

raver79
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am

Re: Driving multiple servos from the RaspberryPi

Mon Apr 27, 2015 7:47 pm

It's the B+ model. The other servo is fine. I have a feeling that one of them is faulty. I have contacted the seller off Amazon. It's a Tower Pro servo

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: Driving multiple servos from the RaspberryPi

Mon Apr 27, 2015 11:32 pm

raver79 wrote:It's the B+ model. The other servo is fine. I have a feeling that one of them is faulty. I have contacted the seller off Amazon. It's a Tower Pro servo
Did you try swapping the connectors over? i.e. drive the 'faulty' servo from the 'good' servo's GPIO?

If the 'good' servo shows the same faulty behaviour, or the 'faulty' servo gets better then you know it's a software problem.

jcg1541
Posts: 2
Joined: Mon Mar 27, 2017 6:33 pm

Re: Driving multiple servos from the RaspberryPi

Mon Mar 27, 2017 6:38 pm

Love it. Just don't put it on the transatlantic 747 plane that I will fly to Paris to visit my wife's family.
Zero * 2 , Zero W * 1

rgh
Posts: 212
Joined: Fri Nov 25, 2011 3:53 pm

Re: Driving multiple servos from the RaspberryPi

Tue Oct 01, 2019 7:25 pm

ServoBlaster updated to support Pi 4B, here: https://github.com/richardghirst/PiBits ... rvoBlaster

Works for me, at least!

Richard

User avatar
clicky
Posts: 387
Joined: Thu Oct 25, 2012 7:34 am

Re: Driving multiple servos from the RaspberryPi

Tue Oct 01, 2019 8:17 pm

rgh wrote: ServoBlaster updated to support Pi 4B, here: https://github.com/richardghirst/PiBits ... rvoBlaster

Works for me, at least!

Richard
:+1:
Thanks :)

User avatar
John_Spikowski
Posts: 1386
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Driving multiple servos from the RaspberryPi

Tue Oct 01, 2019 8:37 pm

I just picked up a RPi Tank and have been thinking about the best method to drive the 4 stepper motors to keep it going in a straight line. This thread will be helpful in that goal.

Here is the current run code that is provided.

Code: Select all

void run(int time){ 
//Left motor advance 
digitalWrite(Left_motor_go, HIGH); 
digitalWrite(Left_motor_back, LOW); 
softPwmWrite(Left_motor_pwm, 100); 
//Right motor advance 
digitalWrite(Right_motor_go, HIGH); 
digitalWrite(Right_motor_back, LOW); 
softPwmWrite(Right_motor_pwm, 100); 
delay(time * 100);
}
Attachments
RPi_Tank.jpg
RPi_Tank.jpg (200.42 KiB) Viewed 313 times

Return to “Automation, sensing and robotics”