A ramp voltage with 50s or 100s ramp time

My professor asked me to generate a ramp voltage with 50s or 100s ramp time by Arduino uno 3 so the ramp rate is about 5v/50s=0.1v/s or 5v/100s=0.05v/s. However I'm a little confused about whether it can be achieved. Do you have some suggestions or basic ideas or codes about this project? thx

Please do not cross-post.

The Uno cannot output voltages between 0v and 5v just 0v and 5v. So your first problem is to find a way of overcoming this limitation. Now as your the student.......

Mark

thx for your reply.not having 5V is ok, I can amplifer it. now I don't know how to code it to make every steps keeping (50/256)s (let's say 8bit for 50s ramp time)

zhyf1991:
thx for your reply.not having 5V is ok, I can amplifer it. now I don't know how to code it to make every steps keeping (50/256)s (let's say 8bit for 50s ramp time)

I think you fail to understand. An arduino simply cannot directly generate a true variable analog output voltage. There is no way for you to directly have a pin output say a +2.5vdc voltage level. What you can do with external circuitry is to use the PWM outputs and wire up a low pass filter and possibly a buffer amp which will then simulate generating a true analog output voltage within the 0 to +5vdc range. Will your Prof allow such external circuitry?

Lefty

thanks. yes I know this, my original plan was to build a DAC (resistive ladder)to achieve it. Is this feasible? I'm new to Arduino and my main problem is coding I guess...

zhyf1991:
thanks. yes I know this, my original plan was to build a DAC (resistive ladder)to achieve it. Is this feasible? I'm new to Arduino and my main problem is coding I guess...

Sure an external DAC would work fine. As far as the programming goes, it's just a matter of spacing the time internals to increment the DAC output values. The mills() function is a handy method of keeping track of elapsed time within your running program.

LEfty

thx a lot! I will try this one

I don't want to do your homework for you (then you wouldn't have any fun!) however an RC circuit with a buffer will help get the voltage out of the PWM output. Example: