Controlling Ebike throttle with voltage smoothed PWM output

I've built a sort of robot that rides along a wire. Here's a video

I want to control the throttle with an arduino. I'm a little rusty on electrical circuits. From what I've read, I think I need to build a voltage smoothing circuit for the PWM output. I also have read that I need a capacitor and a resistor. What size capacitor and resistor would I need?

Thanks