1
\$\begingroup\$

I want to make a PCB that has an ESP32 on it, and the ESP sends a PWM signal to the motor driver. I want to indicate if the PWM signal is being sent or not by LED, without interfering with the PWM signal.

Is there any particular sensor or way in which I can do this? Prior to this, I tried putting an SMD LED parallel to the PWM signal, but there was some problem the frequency of the PWM that doesn't work with LED.

I have a project that uses all the pins of esp, and the pwm trace goes from one pcb to another via header pins, so I need to make sure that pwm is coming through the headers. Sometimes there may be some mechanical error(in wiring) that might block PWM signals.

I am using sign-magnitude mode to drive the motor, so I would be using 0-100% PWM to drive the motor, so adding any element directly in the PWM wire should not drop the voltage, because it would reduce the resolution of my drive mode(lets say voltage drop is 1v, so i would get the speed resolution of 1-4volt only on pwm to control the speed of motor) enter image description here

\$\endgroup\$
7
  • 3
    \$\begingroup\$ Why would the LED not work with a PWM? The easiest would be to just use one pin of the ESP to activate the LED, if the ESP sends a PWM. The software should know wether or not it is sending a PWM. \$\endgroup\$
    – jusaca
    Commented Sep 11, 2023 at 13:54
  • 1
    \$\begingroup\$ Agree. Unless you are up into the MHz it should work fine. Just remember to use a series current limiting resistor. \$\endgroup\$
    – colintd
    Commented Sep 11, 2023 at 14:14
  • \$\begingroup\$ so basically, I am using SMD LED that generally has a voltage rating of 2-3 volts at max, and based in my pwm signal, led will also glow and dim, so i don't want any of this, i just want to completely lit the led based on the presence of PWM signal \$\endgroup\$ Commented Sep 11, 2023 at 14:25
  • 1
    \$\begingroup\$ Easy, use another pin from the ESP for the LED. control it in the PWM routine. \$\endgroup\$
    – MiNiMe
    Commented Sep 11, 2023 at 14:36
  • 1
    \$\begingroup\$ Please modify your question and add in that information. \$\endgroup\$
    – winny
    Commented Sep 11, 2023 at 14:57

2 Answers 2

1
\$\begingroup\$

If you want to implement this without using the ESP, one solution would be to charge a small capacitor via a diode with the PWM and use an constant current driver to drive the LED with a constant current.
An easy to use CC would be a CRD (Current regulating diode), which is a simple 2-pin component you can place in series with your LED. One example for a constant current of 2mA would be the S-202T from Semitec.

schematic

simulate this circuit – Schematic created using CircuitLab

The following simulation in LTspice shows a 20 kHz PWM with 7.4V charging the cap and an ideal constant current source driving the LED with 2mA. Duty cycle is only 1% in this example, to show that the current peaks through D1 might be critical. Choose R1 to achieve a high enough voltage on your cap for the lowest duty cycle you want to detect. enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ I appreciate the circuit you made, but I have to accommodate 4 LEDs on my PCB and it would be hard to do it, on the size of the PCB I am working on right now, I did a little research on this topic and I think we can use current sensor IC's to make a switch, but yeah i will have to think about it's working \$\endgroup\$ Commented Sep 11, 2023 at 17:45
0
\$\begingroup\$

It sounds like you want an external way to ensure that a PWM signal is actually present, rather than trusting the ESP software. Sure, so you could route to the PWM signal to a second GPIO as well and set up an interrupt on that pin. Use a third GPIO to turn the LED on/off, and do something like setting the LED pin low if a certain amount of time passes without the interrupt triggering.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I don't have extra pins, but yeah good idea \$\endgroup\$ Commented Sep 11, 2023 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.