Servo's on Node-Red

#1

is it possible to controll a servo with Node-Red

if yes please show me how

0 Likes

#2

yes use google and you will find several tutorials

0 Likes

#3

I don't think there is a pre-built node to do this directly on something like Pi.
[edit] Not tried it but dceejay suggestion looks like a way to do it [/edit]

Most solutions require either a hardware i2c add on (PCA9685 based) or using a microcontroller (Arduino/ESP8266) device attached to the servo and sending control messages (via MQTT or other methods)

0 Likes

#4

As Simon said - you can use Arduino or ESP8266.
I have successfully used WeMos D1 Minis flashed with ESP Easy to drive servos.
I just "talk" to them via MQTT. In fact I rigged-up a simple dashboard (in Node-RED) with a slider that was used to control the servo's postion.

Note:
The only thing that tripped me up was.. you need a decent power supply for the servo, preferably a separate PSU - not the one that's powering the WeMos.
If you do this - just remember to join the "Grounds" together.

0 Likes

#5

You can use the gpiod node https://www.npmjs.com/package/node-red-node-pi-gpiod
to drive servos direct from a Pi.

(Though they are electrically "noisy" so yes to the decent power supply suggestion above if possible).

1 Like

#6

Hi. i used the gpio nod to control the servo motor after puting the value of the PWM it works well but i would like to change the direction of rotation instead of right rotation i want the left one. How can i do that ?

0 Likes

#7

Change the arm on the servo so that what is now 0 position will be the 100 position and then use 100-0 instead of 0-100

0 Likes

#8

i am sorry but i dont understand what exacltly to do ... should i write "100-0" or "0-100" in the frecency value to change the direction ? i ve just tried this but it still turning on the right direction

0 Likes

#9

Better yet, put a range node before the gpio node and map the input 0 to 100 to become 100 to 0

1 Like