0-100% Duty cycle PWM

I’ve started a small project to add some external LED lighting. It’s based on these LED drivers: NLDD-H-LED Driver Power Supply Solution - MEAN WELL

The LEDs draw 50 Watts at full power, so it would be great if the dimming function of the LED driver could be leveraged using one of the PWM outputs from the Navigator/RPi.

Question: Is there a way to set one of the Navigator outputs to duty cycle PWM as opposed to RC-based PWM.

The output would need to be 5vdc@ 100-1kHz 0-100% duty cycle.

I’ve tried to look for an off the shelf converter but haven’t had much luck.

Cheers

Hi @k-deboer,

Assuming I’m understanding you correctly, you can change the Navigator’s output PWM frequency using the RC_SPEED parameter. I believe different firmware variants use different defaults, but you should be able to use up to 400 Hz or so and still be fine to work with ESCs (if this is even on a vehicle).

From there you can set up one of the outputs with relevant SERVOn_MIN and SERVOn_MAX values for the duty-cycle range you want.

As an example, if you set a frequency of 100Hz, there is one pulse sent every 10ms, so for 0-100% duty-cycle support you would need to set the minimum pulse-duration to 0µs, and maximum to 10000µs.

In terms of actually controlling that, if you want joystick button control you could use a lights or actuator servo function for the pin, and if you want on-screen buttons or a slider in Cockpit you could set the servo function to disabled and send DO_SET_SERVO MAVLink commands via a Custom Action.

Awesome Eliot!

I’ll give that a shot, and let you know how it goes. My plan is to use one of the existing light functions for this high power upgrade

Hey guys!

My requirements are almost exactly the same as the original post. My BLDC motor controller accepts a 5 V logic signal and uses 0–100% PWM duty cycle for speed control at 100 Hz–1 kHz, with a separate input for direction. You mentioned that the Navigator should be able to output around 400 Hz, which falls directly within my controller’s accepted range :smiley:

I’ve also been looking at ArduRover’s BrushedWithRelay mode (MOT_PWM_TYPE = 3), since it seems to provide exactly the interface my controller expects: duty-cycle PWM for speed and a separate direction signal. The motor itself is brushless, but the BLDC controller uses those inputs.

Would BrushedWithRelay be the appropriate way to configure this on the Navigator, and can it operate at around 400 Hz? Or would you recommend keeping the normal output mode and adjusting RC_SPEED and SERVOn_MIN/MAX as you described above? For reference, here is the link to the motor controller manual. https://www.bldc.com/images/uploaded/BLDC-BD50-BD100-bldc-motor-controller-user-manual.pdf

I’ll handle the Navigator’s 3.3 V → 5 V level conversion separately.

Thanks!

For reference, I ended up keeping the Navigator settings default and installing one of these multifunction converters. Worked great!

Amazon.com: NOYITO Multifunction Signal Converter Module Servo Signal to Voltage and PWM Signal, Pulse Signal To Analog Voltage PWM Converter For Servo Test Signal Calibration : Industrial & Scientific

Hi @pariaamini, welcome to the forum :slight_smile:

Is your motor intended as a peripheral that you want direct control over (like for a gripper or brush or similar), or is it for motion control of the vehicle?

The MOT_* parameters are specifically for vehicle motion control.

Thanks Eliot and k.deboer! These motors are for vehicle motion control.

There are two 48 V BLDC motors driving the left and right helicoids, and differential control of the two motors will be used for propulsion and steering. Each motor has its own BLDC controller, with a 0–100% duty-cycle PWM speed input and a separate direction input.

So in this case, would MOT_PWM_TYPE = 3 (BrushedWithRelay) be appropriate for generating the speed + direction signals?

Thanks!

I believe so, yes (though it’s not a configuration I’ve tried).

You could also potentially use higher frequencies for the control signal, but doing so would then prevent being able to use a servo-style PWM signal for other peripherals (if you have any attached).