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?
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.
The problem is the code not the flow . it works to light a led but not to move a servo
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 for example scetches.
ESP32 Servo Motor Web Server with Arduino IDE | Random Nerd Tutorials
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?
Yes it worked fine with an arduino uno but i have now seperet + - to the servo
Yes but i can´t seam to figure auto how to involve this in to homeys code
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.
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.
@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
You can start with the description from Athom, at:
And view this YouTube presentation:
then combine both into your sketch using:
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
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
Well, if you do understand all what you did with a LED and Homeyduino, this is just the next step, just cut and paste
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.
You can P.M. me the source that you already have, we can try to find out what you need.
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.
Better use an ESP32 and read the description here above.
You can also use a DC-Motor to ‘ring’ your bell:
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:
- Get the correct code to make the servo sweep 5 times with the correct angle and speed
- 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