P098 PWM Motor LimitA and Limit B

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

P098 PWM Motor LimitA and Limit B

#1 Post by Pencraft » 31 Jul 2024, 13:49

Good afternoon. I'm making a roller blind controller using EasyEsp.
I'm using the P098 PWM Motor plugin. The motor is started with the pwmmotorhome and pwmmotorend commands.
Sensors LimitA and LimitB are configured.
When the sensors are triggered, the LimitA and LimitB events are not generated, although the motor stops.
Events are created only if I try to start a motor that is already in the extreme position.
What am I doing wrong?
IMG_1851.jpg
IMG_1851.jpg (900.24 KiB) Viewed 8262 times

User avatar
Ath
Normal user
Posts: 4165
Joined: 10 Jun 2018, 12:06
Location: NL

Re: P098 PWM Motor LimitA and Limit B

#2 Post by Ath » 31 Jul 2024, 14:04

Is the Rules option checked on the Tools/Advanced page? As that's a check before events will be generated.
/Ton (PayPal.me)

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#3 Post by Pencraft » 31 Jul 2024, 14:09

Yes, the Rules option is enabled.

TD-er
Core team member
Posts: 9626
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P098 PWM Motor LimitA and Limit B

#4 Post by TD-er » 31 Jul 2024, 14:57

How long are the cables?
Maybe you can add some capacitor (e.g. 100 nF) over the GPIO pin and GND as close as possible to the GPIO pin.
Problem is that when a switch connects, it doesn't connect at once but will bounce a little.

And maybe for this use case, you might better use a bit stronger pull-up resistors and go for 1k instead of 10k.

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#5 Post by Pencraft » 31 Jul 2024, 15:08

The cable is no more than 10 cm. I will try to reduce the value of the pull-up resistors to 1 kOhm. And yet the sensors are triggered, the motor stops, the event simply is not created.

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#6 Post by Pencraft » 07 Aug 2024, 20:41

Unfortunately nothing worked :(
The scheme is the same as before. Resistors reduced to 1Kohm.
Here are the plugin settings:
1.png
1.png (41.63 KiB) Viewed 7911 times
2.png
2.png (39.7 KiB) Viewed 7911 times
When the sensors are triggered, the motor stops, but the "LimitA" and "LimitB" events are not generated.
If you turn off the "LimitA inverted" and "LimitB inverted" checkbox, then events are created, but after they are triggered, LimitA and LimitB remain at "1" forever and do not allow the motor to start.

TD-er
Core team member
Posts: 9626
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P098 PWM Motor LimitA and Limit B

#7 Post by TD-er » 07 Aug 2024, 21:04

OK, have to check the code to make sure it isn't a bug, as I don't see right now what you're doing wrong here.

User avatar
Ath
Normal user
Posts: 4165
Joined: 10 Jun 2018, 12:06
Location: NL

Re: P098 PWM Motor LimitA and Limit B

#8 Post by Ath » 07 Aug 2024, 21:06

Can you get logging from the serial port of the unit, or have you disabled that? (You are using GPIO 1 and 3, on what seems like an ESP32 Classic, (you haven't mentioned the exact ESP model in use, AFAICS), and that are usually the serial log GPIO pins).

The events (<TaskName>#limitA, <TaskName>#limitB, <TaskName>#positionReached or <TaskName>#encoderTimeout) should be visible in the log, and the serial log is the most reliable way of seeing that, though the info should also be visible in the web-logging via Tools/Log.
Last edited by Ath on 07 Aug 2024, 21:14, edited 1 time in total.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9626
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P098 PWM Motor LimitA and Limit B

#9 Post by TD-er » 07 Aug 2024, 21:11

Also can you try not using PWM, but just sending out a digital pulse (thus not set the mode to PWM) ?

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#10 Post by Pencraft » 07 Aug 2024, 21:18

I'm using ESP32-C3 mini.
IMG_1924.jpg
IMG_1924.jpg (1.47 MiB) Viewed 7895 times
And this is what is visible in the terminal.
4.png
4.png (99.9 KiB) Viewed 7889 times
The same thing happens in NoPWM mode.

TD-er
Core team member
Posts: 9626
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P098 PWM Motor LimitA and Limit B

#11 Post by TD-er » 07 Aug 2024, 21:26

I do see the events in the log you posted, so I don't really know what the problem is.

Or do you also have a switch task assigned to those same pins?

User avatar
Ath
Normal user
Posts: 4165
Joined: 10 Jun 2018, 12:06
Location: NL

Re: P098 PWM Motor LimitA and Limit B

#12 Post by Ath » 07 Aug 2024, 21:42

Can you push one of the limitA/limitB switches before the actual end is reached? To see if that actually stops the motor.
/Ton (PayPal.me)

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#13 Post by Pencraft » 07 Aug 2024, 21:42

The "LimitA" and "LimitB" events are generated only once when saving the plugin settings. In the future, when starting the motor with buttons and stopping it with sensors, connected to the LimitA and LimitB pins, no events are created.

Pencraft
Normal user
Posts: 18
Joined: 05 Dec 2023, 18:54

Re: P098 PWM Motor LimitA and Limit B

#14 Post by Pencraft » 07 Aug 2024, 21:44

The "LimitA" and "LimitB" events are generated only once when saving the plugin settings. In the future, when starting the motor with buttons and stopping it with sensors, connected to the LimitA and LimitB pins, no events are created. When the sensors are triggered, the motor stops, but no events are created.

User avatar
Ath
Normal user
Posts: 4165
Joined: 10 Jun 2018, 12:06
Location: NL

Re: P098 PWM Motor LimitA and Limit B

#15 Post by Ath » 07 Aug 2024, 21:56

The 4 events generated in row is the initial Read that is performed after the TaskInit event, that is generated for nearly all plugins.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests