The AD829 is not a rail to rail output op amp and so requires a supply voltage significantly above +5V to enable the output to reach +5V.
Gain of amp = (5-0)/(500mV-130mV) = 13.51
Let R1 = 10k which implies that R2+R3 = 125.1k
(125.1k/10k)+1 = 13.51
To calculate the reference voltage:-
(Vref-0V) * (125.1k)/(125.1k+10k) = 130mV
Vref = 140mV
A good improvement - Put a 100uF cap across R4 to smooth Vref and filter out power supply noise.
You may wish to consider the circuit below as an improved version of the 2.5V reference generator now that you have the circuit working. It does away with the pot and 100uF cap. You may not even need the buffer, IC1a.
The advantage of the potentiometer base Vref generator circuit is that you can precisely set the DC level of the output waveform (currently it's set to 2.5V). The circuit below will enable a finer (more precise) adjustment to the 2.5V Vref level but bear in mind that the LM358 saturates at a few mVs above ground (with a 0V -ve supply voltage). If you need to get the -ve excursion of the output waveform exactly to 0V then you'll need a -ve supply rail for the op amps. This can easily be generated using a ICL7660A (note the 'A') which will convert the +12V to something approaching -12V.