# [sdiy] TB303 Slide

Tom Wiltshire tom at electricdruid.net
Fri Jun 8 22:30:50 CEST 2012

```On 8 Jun 2012, at 18:03, Tim Stinchcombe wrote:

>> Good picture! Could you try delaying that red curve so that
>> it starts at time 18 instead of 0?
>
> Yes (but shift is 15ms):
>
> http://www.timstinchcombe.co.uk/synth/const_time_glide_shift.gif
>
> OK, point taken! I must be looking at it in some cock-eyed way... :-0
>
> Or maybe I *am* being fooled by the 'terminology' - confused now :-/
>
> Tim

The two *are* the same. You can check the maths below, but I think it's ok (plaintext is not ideal for maths). The equation for a cap charging is:

V(1-e^(-t/rc))

Where V is the voltage source, t is the time, and rc is the rc time constant.

Equation for the 0-2V curve:

2(1-e^(-t/rc)) = 2-2e^(-t/rc)

We can work out what the time is when that reaches 1V (e.g. when y=1):

1=2-2e^(-t/rc)

2e^(-t/rc) = 1			(rearrange)

e^(-t/rc) = 1/2 		(divide by two)

-t/rc = ln(1/2)			(natural log of both sides)

t = -rcln(1/2) = 0.015249 (the 15ms Tim found earlier)

Now we can start the 1-2V curve with that time offset. The equation for this is:

1(1-e^(-rcln(1/2)-t / rc)) + 1		(The additional +1 at the end is because we start from 1V not 0V)

2-e^(-rcln(1/2)-t / rc)			(sort out a bit)

We can show that these equations are equal:

2-2e^(-t/rc) = 2-e^(-rcln(1/2)-t / rc)		(assume that they are)

2e^(-t/rc) = e^(-rcln(1/2)-t / rc)			(take two off both sides, multiply by -1)

ln(2) - (t/rc) = -rcln(1/2)-t / rc			(natural log of both sides)

rcln(2) - t = -rcln(1/2) - t				(multiply both sides by rc)

rcln(2) - t = rcln(2) - t					logy(x) = -logy(1/x), so ln(2) = -ln(1/2)

These equations are identical and the curves must be the same.

Tom

```