Pi servo control

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Pi servo control

Post by bombix »

Hi,

Im building a raspberry project to make robot that uses a pi camera, some brushed motors and some servos.
In the future i would try to add some other sensor.
Ive looked at the diferent boards to control the servos but i dont know witch would be better.
Could you give me a hand?

Thanks in advance

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Pi servo control

Post by adafruit_support_bill »

If you need to control more than one or two servos, the servo hat would be a good choice. It can control regular servos and continuous rotation servos. It can also control brushless motors via an ESC. https://www.adafruit.com/product/2327

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Hi,

Will hi have any problems (lack of connector, space) connecting the pi camera?
In the mini pan tilt camera stand (1967) can i place the pi camera? Is it possible to make ir rotate at least 270 degrees?
Thanks in advance

Thanks in advance

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Pi servo control

Post by adafruit_support_bill »

The pan/tilt unit is easily modified to mount various types of cameras. Here is one mounted using a custom 3D printed bracket: https://blog.adafruit.com/2014/10/03/fr ... pberry_pi/

The micro-servos that come with the unit have about 180 degrees of travel. I do not know of any micro-servos that will do 270 degrees.

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Hi,

Thanks for the reply, what about the servo hat space?

Thanks in advance

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Pi servo control

Post by adafruit_support_bill »

what about the servo hat space?
I don't understand the question. What do you want to know?

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Using the servo hat will hi have any problems (lack of connector, space) connecting the pi camera?

Thanks

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Pi servo control

Post by adafruit_support_bill »

There is a slot for the camera connector:

Image

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Hi,

I have done all the soldering, including the capacitor.
I comfortable programming but my electronics is still a little basic so i couldnt understand how the control of the servos works.
Could you point me for some information?

For example how do i tell that the servo 0 as to move like 30º?

Thanks in advance,

Fernando

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pi servo control

Post by adafruit_support_mike »

This tutorial shows how to work with the Servo Hat: https://learn.adafruit.com/adafruit-16- ... spberry-pi

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Hi,

I followed that tutorial but in the "Library Reference" i cant undertans how those two functions control the servo movement.

Thanks in advance,

Fernando Ferreira

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pi servo control

Post by adafruit_support_mike »

The signal that controls a servo's position is between 1ms and 2ms long. A 1ms pulse tells the servo to go all the way to one side, a 2ms pulse tells the servo to go all the way to the other side. The pulses arrive about 50 times per second, so the pulse period is about 20ms wide.

The PWM controller on the Hat counts from 0 to 4095 during every pulse period. Each count is called a 'tick', and at 50Hz, each count is about 4.9 microseconds long. That makes a 1ms pulse about 204 ticks wide, and a 2ms pulse about 408 ticks wide.

The difference between the "go high" and "go low" times determines the width of the pulse, which determines the position of the servo.

User avatar
bombix
 
Posts: 20
Joined: Sat May 30, 2015 11:06 am

Re: Pi servo control

Post by bombix »

Hi,

Thanks for the help.
From what i get, setting the frequency asnt any utility. Only the duration of the pulse maters, right?

Another question, the power suppy of the hat can be connected and disconnected while keeping the raps on?

Thanks in advance

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pi servo control

Post by adafruit_support_mike »

The frequency is important to the servo. Its internal control system expects to get an update about every 20ms. If it doesn't get pulses at the correct rate, the horn will move erratically.

WRT the servo power supply: yeah, you can connect and disconnect that while the RasPi is running. The PWM power is independent of the RasPi's power system.

User avatar
PeterLawrence13
 
Posts: 3
Joined: Mon Jun 22, 2015 5:42 pm

Re: Pi servo control

Post by PeterLawrence13 »

Hi,
I have one of your "Servo/PWM Pi HAT" boards. In the picture of the board (above in this thread) in the upper right is a 24C32F EEPROM IC. Is there any info on using that and/or any Python code available? I looked through what is posted on Github for Adafruit products and couldn't find anything related to the EEPROM. Also, there was a statement that a schematic for this product would be available. I can't seem to find that either.
Thanks.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”