NodeJS lib servo.move for a 180° angle
1459 Views - Created 04/12/2018
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
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 https://github.com/abelectronicsuk/ABElectronics_NodeJS_Libraries/tree/master/lib/servopi
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.