# Homeydurino and servo

**URL:** <https://community.homey.app/t/homeydurino-and-servo/67319>\
**Category:** Questions & Help\
**Created:** [August 13, 2022, 7:57pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319 "2022-08-13T19:57:04Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 13, 2022, 7:57pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/1 "2022-08-13T19:57:05Z")

</div>

Hey Guys!  
I have succeded to blink an led with the flow card. but when i connect the servo PWM to where i have the led connected the servo does not move.

the servo is connected to 5+ and - and here i have a ground from the esp card allsow

any idea how to get the servo to work?

---

<div class="post-metadata">

**Author:** ![Mike1233](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mike1233/32/20991_2.png) [@Mike1233](https://community.homey.app/u/Mike1233)\
**Post date:** [August 13, 2022, 10:28pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/2 "2022-08-13T22:28:40Z")

</div>

Maybe you can share some flows so other people can have a look at It and maybe can help you.  
And maybe some pictures of youre build.

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 13, 2022, 11:04pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/3 "2022-08-13T23:04:32Z")

</div>

The problem is the code not the flow . it works to light a led but not to move a servo

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 13, 2022, 11:38pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/4 "2022-08-13T23:38:59Z")

</div>

You need to include and use a library for the servo, it generates a PWM signal (pulse width modulated) for the third wire of the servo. Have a look at [Randomnerdtutorials.com](http://Randomnerdtutorials.com) for example scetches.  
[ESP32 Servo Motor Web Server with Arduino IDE | Random Nerd Tutorials](https://randomnerdtutorials.com/esp32-servo-motor-web-server-arduino-ide/)

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 14, 2022, 6:03am UTC](https://community.homey.app/t/homeydurino-and-servo/67319/5 "2022-08-14T06:03:57Z")

</div>

> [@Densvenske](#):
>
> the servo is connected to 5+ and -

Can your power supply provide enough power for the servo? Also, since you’re using an ESP board, can your servo handle 3.3V I/O?

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 15, 2022, 4:14pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/6 "2022-08-15T16:14:24Z")

</div>

Yes it worked fine with an arduino uno but i have now seperet + - to the servo

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 15, 2022, 4:15pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/7 "2022-08-15T16:15:27Z")

</div>

Yes but i can´t seam to figure auto how to involve this in to homeys code

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 15, 2022, 4:39pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/8 "2022-08-15T16:39:38Z")

</div>

> [@Densvenske](#):
>
> Yes it worked fine with an arduino uno but i have now seperet + - to the servo

An Arduino Uno has a very different MCU and has 5V I/O, whereas the ESP’s have 3.3V I/O, hence the question if your servo accepts a 3.3V PWM signal.

I would suggest getting the servo-part working first (standalone), _then_ the Homeyduino part.

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 15, 2022, 5:16pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/9 "2022-08-15T17:16:28Z")

</div>

> [@Densvenske](#):
>
> how to involve this in to homeys code

Don’t understand what is the problem, is it the connections, or is it the code,  
as Robert says, first make the conections and drive-code to the servo working and then the Homey-duino code.  
Also you did not tell what ESP you are using.  
If your code is not working, show your code.

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 15, 2022, 5:37pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/10 "2022-08-15T17:37:45Z")

</div>

@robertklep Yes i will try that. But do you think i need to drive it trough esp cardet?

@JPe4619 The card i use is Lilygo® Ttgo T-display. i will do as suggestet and try standalone code on de card too se if it moves the servo

edit: Standalone code is moving the servo.

Then i need help to get it moving when flow is active

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 16, 2022, 12:18pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/11 "2022-08-16T12:18:24Z")

</div>

You can start with the description from Athom, at:

> **[GitHub - athombv/com.athom.homeyduino: Homeyduino is an Homey app which...](https://github.com/athombv/com.athom.homeyduino)**
>
> Homeyduino is an Homey app which allows you to easily connect your own Arduino projects to homey - GitHub - athombv/com.athom.homeyduino: Homeyduino is an Homey app which allows you to easily conne...

And view this YouTube presentation:

[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/e/2e318037c7d1d9073479444f3de00f47b121dee5.jpeg "Using Servo Motors with ESP32") ](https://www.youtube.com/watch?v=zxBC1ivOVfM)

then combine both into your sketch using:

```auto
 Homey.begin(hostName);
  Homey.setClass("windowcoverings");
  Homey.addCapability("windowcoverings_set", doServo); //"type": "range", "min": 0, "max": 1, "step": 0.01

  myServo.attach(8, 550, 2500); // 544-2400=def.?.. Attaches the servo on pin to the servo object

```

Also a very good instructor is RNT: [ESP32 Servo Motor Web Server with Arduino IDE | Random Nerd Tutorials](https://randomnerdtutorials.com/esp32-servo-motor-web-server-arduino-ide/)

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 16, 2022, 2:19pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/12 "2022-08-16T14:19:42Z")

</div>

thanks for good replays! 🙂 I am new to the coding scene and i thought it would be easyer. like i got a code working with digitalwrite and to turn on a led and thats with homeyduino code. and tought that it would work with the servo. like easy on off on the servo

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 16, 2022, 3:11pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/13 "2022-08-16T15:11:35Z")

</div>

Well, if you do understand all what you did with a LED and Homeyduino, this is just the next step, just cut and paste 👍

---

<div class="post-metadata">

**Author:** ![Densvenske](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/densvenske/32/3840_2.png) [@Densvenske](https://community.homey.app/u/Densvenske)\
**Post date:** [August 16, 2022, 3:32pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/14 "2022-08-16T15:32:12Z")

</div>

Yee that i understand. but i can´t understand where to put it in the homeyduino code. i understand the arduino setup and loop but not where in homeyduino code.

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 16, 2022, 4:20pm UTC](https://community.homey.app/t/homeydurino-and-servo/67319/15 "2022-08-16T16:20:15Z")

</div>

You can P.M. me the source that you already have, we can try to find out what you need.

---

<div class="post-metadata">

**Author:** ![Rijckholt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rijckholt/32/17914_2.png) [@Rijckholt](https://community.homey.app/u/Rijckholt)\
**Post date:** [February 6, 2024, 8:15am UTC](https://community.homey.app/t/homeydurino-and-servo/67319/18 "2024-02-06T08:15:13Z")

</div>

Hi there,

I am researching how to make my old “pull bell” work with a my video doorbell (unifi g4 pro). I can trigger a homey flow on a “doorbell push” event. I would like to use a servo motor to pull the wire of my old bell and have it ring when a person rings the g4 doorbell. Thought an ardruino i.c.w. a servo would be a possible solution.

There are many examples of code to control the servo from a stock ardruino. I am wondering what extra code is needed to control it from a Homey flow.

Any suggestions? I have a non wifi ardruino r3 uno, but think it’s better to go for a wifi version so (i hope) i can directly control it from homey.

Thanks in advance for your time and effort.  
Onno

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [February 6, 2024, 11:09am UTC](https://community.homey.app/t/homeydurino-and-servo/67319/19 "2024-02-06T11:09:46Z")

</div>

Better use an ESP32 and read the description here above.

You can also use a DC-Motor to ‘ring’ your bell:

> **[ESP32 with DC Motor - Control Speed and Direction | Random Nerd Tutorials](https://randomnerdtutorials.com/esp32-dc-motor-l298n-motor-driver-control-speed-direction/)**
>
> Learn how to control the direction and speed of a DC motor using an ESP32 and the L298N Motor Driver. Learn how the L298N motor driver works, and how to use it to control the direction and speed of a DC motor using the ESP32 and Arduino IDE.

---

<div class="post-metadata">

**Author:** ![Rijckholt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rijckholt/32/17914_2.png) [@Rijckholt](https://community.homey.app/u/Rijckholt)\
**Post date:** [February 8, 2024, 10:02am UTC](https://community.homey.app/t/homeydurino-and-servo/67319/20 "2024-02-08T10:02:54Z")

</div>

OK i did get an esp32 and have been able to control the servo (need to spend more time here)

My approach from here would be:

1. Get the correct code to make the servo sweep 5 times with the correct angle and speed
2. Add to this code the part so i can control it from Homey - a flow starts the 5 times sweep once

Plenty of example for part 1 as i can quickly see. Not so for part 2.

Any example you can share?

Thanks in advance for your time and effort  
Onno

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [February 8, 2024, 11:49am UTC](https://community.homey.app/t/homeydurino-and-servo/67319/21 "2024-02-08T11:49:54Z")

</div>

Have a look at [homey-arduino-library/examples/Example projects/Automatic\_plant\_waterer at master · athombv/homey-arduino-library · GitHub](https://github.com/athombv/homey-arduino-library/tree/master/examples/Example%20projects/Automatic_plant_waterer)

The way the pump is controled is also usable for your purpose.
