# Servo's on Node-Red

**URL:** <https://discourse.nodered.org/t/servos-on-node-red/5795>\
**Category:** General\
**Created:** [14 December 2018 08:25 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795 "2018-12-14T08:25:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvarMvl](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@IvarMvl](https://discourse.nodered.org/u/IvarMvl)\
**Post date:** [14 December 2018 08:25 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/1 "2018-12-14T08:25:43Z")

</div>

is it possible to controll a servo with Node-Red

if yes please show me how

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [14 December 2018 08:37 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/2 "2018-12-14T08:37:08Z")

</div>

yes use google and you will find several tutorials

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [14 December 2018 08:56 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/3 "2018-12-14T08:56:08Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [14 December 2018 09:29 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/4 "2018-12-14T09:29:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 December 2018 09:55 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/5 "2018-12-14T09:55:50Z")

</div>

You can use the gpiod node [https://www.npmjs.com/package/node-red-node-pi-gpiod](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).

---

<div class="post-metadata">

**Author:** ![khalil](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@khalil](https://discourse.nodered.org/u/khalil)\
**Post date:** [29 March 2019 13:28 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/6 "2019-03-29T13:28:59Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [29 March 2019 13:36 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/7 "2019-03-29T13:36:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![khalil](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@khalil](https://discourse.nodered.org/u/khalil)\
**Post date:** [29 March 2019 13:41 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/8 "2019-03-29T13:41:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [29 March 2019 13:57 UTC](https://discourse.nodered.org/t/servos-on-node-red/5795/9 "2019-03-29T13:57:30Z")

</div>

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