Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

NodeJS lib servo.move for a 180° angle

The Servo PWM Pi is a 16-channel, 12-bit PWM controller for driving LEDs and RC servos on the Raspberry Pi

04/12/2018

Posted by:
yann

yann Avatar

Hi,

I'm working with a Rapsberry and a Servo PWM Pi Zero extension card.
I have just try your example servomove.js, it work fine but the servo moves between 0 to 250 only make a 120° angle.

When the servo motor (Futaba s3003 or HKing HK 15269) is not connected, I can move it from 0 (left side) to 180° (right side).
When I launch the program servomove.js witch ask the servo to move fromt position 0 to position 250, my servo start at 30° and stop at 120°. So the move only make a 120°, I'm loosing 30° before position 0 and 30° after position 250 ...

I've try to change servo.setFrequency(50,0) to servo.setFrequency(42,0), so the servo start at 0° but at postion 250 it's only a move to 90° ...
Do I have to change the steps too ?

Thanks for help

Regards
Yann

05/12/2018

Posted by:
andrew

andrew Avatar

Hello Yann

To increase the distance your servo can move you will need to adjust the upper and lower limits in your code.

When you create a new servo object in node js there are two parameters for low limit and high limit which are preset to 1.0ms and 2.0ms.


servo = new Servo(0x40, 1.0, 2.0, true);


Try reducing the 1.0 value in 0.1 increments until you reach the lower limit of your servo and then increase the 2.0 value in 0.1 increments to get the upper limit of your servo.

You can also set the limits for individual channels using the setLowLimit(low_limit, channel) and setHighLimit(high_limit, channel) functions.

The readme file on our GitHub page for the Servo Pi node js library contains more details on how each of the functions can be used, you can find it at NodeJS Libraries for the Servo PWM Pi.

05/12/2018

Posted by:
yann

yann Avatar

Thanks Andrew, I'll try this !

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout