DC Pwm to Analog signal with different voltage range

Hi,
I need to control a 500w 36v brushless ebike motor with its controller with an Arduino UNO.
The controller takes as input a 1v-4.2v analog signal (given by a throttle), which I'm willing to control with Arduino 5v digital PWM signal instead of the throttle.

My idea was to step down the signal from 5v to 3.1v with a buck converter and then adding a bias of 1.1v.
Then I thought of putting an MCP4725 DAC, but from my understanding, it converts the signal from 0 to x voltage (am I right?)

Any better ideas on how to achieve this?

Thank you all!

You can put a low pass filter on the PWM, that will basically convert it to DC. You could buffer this output using a NPN transistor in the emitter follower configuration. You might want to preload the emitter with a resistor. If you are not using the pins of the Arduino you can make a R2R DAC with a few resistors. There is a lot on the internet about using the resistors as a DAC.

The controller takes as input a 1v-4.2v analog signal (given by a throttle), which I'm willing to control with Arduino 5v digital PWM signal instead of the throttle

Do you know the PWM frequency ?
step-1: reduce the 5V arduino PWM to 4.2V with a voltage divider
step-2: insert an RC LPF comprised of a 4.7k ohm resistor and a 4.3uF cap between the arduino pwm with the
resistor connected between the arduino and controller and the cap from the resistor on THE CONTROLLER side
to GND.
Write a program to change duty cycle in 55 steps and delay 1 minute to allow you to measure the analog voltage on the cap.
Plot the results in Excel to check linearity.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.