Hi all, i would like to convert the PWM signal generated from the Arduino Mega 2560 of 0 to 5V to an analog signal of -10 to 10 V to input into my servo valve that is controlling my cylinder. Anyone can help to advise if there is such component and any recommendation?
Hmm... the PWM is not generating a "real" analog voltage. You need a DAC for that. PWM works for stuff like motors because it sees an "average" voltage becuse of the duty cycle. Digital circuitry would just see pulses. The ATMega2560 does not have an on-board DAC, so the cheapest method is to build one out of a R2R ladder using several pins but the results will not be linear. There are also DAC chips you can use with only a couple pins. The DAC chip would allow you to set your - and + voltage values.
Another route is to use opamps with proper feedback to scale your voltage to the +- voltages.
Getting a DAC chip is the easiest way.