logo elektroda
logo elektroda
X
logo elektroda

ESP32 PWM Control Issues with Graupner Speed Profi 40R BEC ESC

prem111 2061 15
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18710262
    prem111
    Level 5  
    Hello, I have a problem with controlling a controller for brush motors using PWM in esp32.

    A regulator like this:
    https://rc-team.pl/regulatory/35491-graupner-regulator-speed-profi-40r-bec-7196.html

    
    led = machine.Pin(2)
    led_pwm = machine.PWM(led)
    led_pwm.freq(50)
    led_pwm.duty(100)
    
    .

    I try duty ranges from 0 to 1020.

    Zero response...
  • ADVERTISEMENT
  • #2 18710424
    jrk13
    Level 15  
    How is it connected? I found nothing on the web about the control of this regulator - does it definitely have PWM control? .
    Have you checked the waveform at the output of the ESP with an oscilloscope?
  • #3 18710464
    prem111
    Level 5  
    The signal to the PWM is connected normally, plus and minus, the connection is OK. On a raspberry pi on pwm this controller works without any problem.
  • ADVERTISEMENT
  • #4 18710505
    lukaszd82
    Level 31  
    Then fill in the gaps:
    1. wiring diagram
    2. photos of real implementation
    3. full code.
    Well, because if you only load what you have given then it has the right not to work.
    If you are expecting someone's help then you need to make a bit of an effort and provide everything necessary.

    This pin2 is GPIO2 or pin2? You say everything is ok, but it doesn't work. Without a wiring diagram it's hard to say anything.
    The same without full code and check with an oscilloscope what we actually have on the port.

    ESP32 PWM Control Issues with Graupner Speed Profi 40R BEC ESC ESP32 PWM Control Issues with Graupner Speed Profi 40R BEC ESC .
    ESP32 PWM Control Issues with Graupner Speed Profi 40R BEC ESC .

    For example, on this board GPIO2 is connected to the LED on the PCB.
  • #5 18710526
    prem111
    Level 5  
    Thanks for your reply. I am attaching a diagram of what it looks like. PIN 2 actual pin. When I connect a servo with the same code on it - it works without a problem.

    The code is of course micropython give full:

    [syntax].
    import machine
    import time

    esc = machine.Pin(2)
    pwm = machine.PWM(esc)
    pwm.freq(50)


    while True:
    for i in range(1020):
    pwm.duty(i)
    print(i)
    time.sleep_us(5500)
    [/syntax].

    Zero response...
    Attachments:
    • ESP32 PWM Control Issues with Graupner Speed Profi 40R BEC ESC Zrzut ekranu 2020-05-22 o 12.01.03.png (27.17 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #6 18710535
    lukaszd82
    Level 31  
    micropython - I don't know, so I can't comment.
    Doesn't GND have to be connected?
    What is PIN2?
  • #7 18710543
    prem111
    Level 5  
    According to the diagram of GPIO 2. Plus and minus is from the battery, the regulator is powered correctly.
  • #8 18710550
    lukaszd82
    Level 31  
    Simple test, hook up an LED instead of the regulator with a suitable resistor, change the fill and see if it works.
    As far as I'm concerned the ground of the ESP and the power supply of the regulator should be connected.
  • #9 18710554
    prem111
    Level 5  
    I connect the servo - and it works.
  • ADVERTISEMENT
  • #10 18710564
    lukaszd82
    Level 31  
    And do you also power the servo as in "your diagram" or directly from the ESP?
  • #11 18710603
    prem111
    Level 5  
    No, I power the servo from the ESP, just now I checked that when I connect it as from the zchemat it does not work. But I don't understand one thing - on the raspberry I had identically connected in the sense from an external power source and it worked ?. Okay, but the regulator is powered by 12v, and in the wire that comes out of the regulator together with the signal (3 wires) goes 3.5v so I can't connect that to the esp either....
  • Helpful post
    #12 18710613
    lukaszd82
    Level 31  
    Connect the ground of the battery from which you are feeding the motor to the ground of the ESP and it should work.
    The regulator and ESP generating the PWM signal should share a common ground.
    Just don't mix up the poles or there will be smoke....
  • #13 18710626
    Anonymous
    Level 1  
  • #14 18710632
    lukaszd82
    Level 31  
    Maybe you could give us a scan of the documentation for this regulator? because without that it's hard to say anything more. I had the ground connected and not input "some" voltage/supply from the regulator because I don't know what it is.
    Without documentation it's always a risk that you'll burn something.

    I've searched the internet, but so quick no documentation of this wonder.
    And a description/description of this 3pin plug is needed.
  • #15 18710653
    Anonymous
    Level 1  
  • #16 18710694
    prem111
    Level 5  
    lukaszd82 wrote:
    Connect the ground of the battery from which you are powering the motor to the ground of the ESP and it should work.
    The regulator and ESP generating the PWM signal should share a common ground.
    Just don't mix up the poles or there will be smoke...
    .

    Thanks - it works ! :)

Topic summary

✨ The discussion revolves around issues with controlling a Graupner Speed Profi 40R BEC ESC using PWM signals from an ESP32. The user reports that while the connections are correct and the ESC works with a Raspberry Pi, it fails to respond when controlled by the ESP32. Various suggestions are made, including checking the wiring, ensuring a common ground between the ESP32 and the ESC, and verifying the PWM frequency settings. Ultimately, the user resolves the issue by adjusting the PWM frequency to 1 kHz, leading to successful operation of the ESC.

FAQ

TL;DR: ESP32-to-ESC no-response is usually wiring, not code; "According to the documentation it is supposed to be 1 kHz." Share ground and verify PWM to resolve it fast. [Elektroda, khoam, post #18710653]

Why it matters: For makers wiring an ESP32 to a Graupner Speed Profi 40R BEC brushed ESC, this fixes the common "no response" problem.

Quick Facts

How do I fix my ESP32 not controlling the Graupner Speed Profi 40R BEC ESC?

First, connect the ESC battery ground to the ESP32 ground. Then verify your PWM output and frequency. Quick How-To: 1. Tie grounds (ESC GND to ESP32 GND). 2. Test PWM with a servo or LED. 3. Reconnect the ESC to a clean GPIO and retry. The original poster confirmed success after sharing ground. [Elektroda, prem111, post #18710694]

Do I need a common ground between the ESP32 and the ESC battery?

Yes. Without a shared ground, the ESC cannot reference the signal, so it won’t respond. "The regulator and ESP generating the PWM signal should share a common ground." Tie grounds carefully and double-check polarity. [Elektroda, lukaszd82, post #18710613]

What PWM frequency should I start with for the Graupner Speed Profi 40R BEC?

Start at 1 kHz if your unit matches the cited documentation. One member noted, "According to the documentation it is supposed to be 1 kHz." If unsure, try 1 kHz, then test servo-style 50 Hz if needed. [Elektroda, khoam, post #18710653]

Can I use GPIO2 for the ESC signal on ESP32?

Prefer a different pin. On many boards, GPIO2 drives an onboard LED, which can distort PWM or interfere at boot. Use a free PWM-capable pin instead, and reserve GPIO2 for the LED if present. [Elektroda, lukaszd82, post #18710505]

How should I wire the ESC’s three-wire lead to the ESP32?

Connect the ESC signal wire to a PWM-capable GPIO. Connect the ESC ground to ESP32 GND. Leave the positive BEC lead disconnected unless powering accessories. "Just don't mix up the poles or there will be smoke." Verify polarity before powering. [Elektroda, lukaszd82, post #18710613]

Is 3.5 V logic on the ESC signal safe for an ESP32 GPIO?

Yes. ESP32 inputs are safe up to 3.6 V. As one member put it, "Up to 3.6v is still safe for the ESP32." That makes a 3.5 V servo-type signal acceptable. [Elektroda, khoam, post #18710626]

My servo moves, but the ESC stays silent—what should I check?

Check for a common ground first. Many no-response cases resolve once grounds are tied. Then confirm your PWM frequency and any arming behavior. The reported fix came from sharing ground between the battery and ESP32. [Elektroda, prem111, post #18710694]

How can I test my PWM output without an oscilloscope?

Use an LED with a suitable resistor on the signal pin. Change duty cycle and watch brightness vary. This confirms PWM is present. You can also swap in a known-good servo to validate timing quickly. [Elektroda, lukaszd82, post #18710550]

Do I need a scope to diagnose this?

A scope helps confirm amplitude, frequency, and duty cycle. At minimum, verify the waveform at the ESP32 pin before suspecting the ESC. The thread explicitly asked about checking the output with an oscilloscope. [Elektroda, jrk13, post #18710424]

Why did it work on Raspberry Pi but not on ESP32?

When powering the ESC from a separate battery, the ESP32 may lack a common ground. The Pi setup may have shared ground through its supply. Tie the grounds between ESC and ESP32, then retest. [Elektroda, lukaszd82, post #18710613]

What MicroPython settings were used in the thread example?

The example used machine.PWM at 50 Hz on GPIO2 and swept duty from 0 to 1020. Typical MicroPython duty uses approx. 0–1023 steps, so that sweep covers the range. Re-test after fixing wiring. [Elektroda, prem111, post #18710526]

Is it safe to power the ESP32 from the ESC’s BEC output?

Avoid connecting the ESC’s BEC to ESP32 Vcc without documentation. "Without documentation it's always a risk that you'll burn something." Confirm voltage and current before tying supplies together. [Elektroda, lukaszd82, post #18710632]

What if I can’t find documentation for this Graupner ESC?

Proceed carefully and confirm the three-pin mapping before wiring. A contributor noted documentation was hard to find and requested a 3‑pin description. Lack of docs increases risk of wiring mistakes. [Elektroda, lukaszd82, post #18710632]

Any critical gotchas before powering up?

Yes. Ensure a shared ground and correct polarity; reversing leads can cause damage. Double-check the signal pin choice and boot behavior. Keep an eye on GPIO2 if an onboard LED is present. [Elektroda, lukaszd82, post #18710505]
ADVERTISEMENT