Work backwards. The relay takes 30 mA. The transistor gain is around 100, but for firm saturation you want to overdrive it. The rule of thumb is 10:1; for 30 mA collector current you want 3 mA base current, but that rule is from the 1950's. Your relay will operate just fine with a base current of 1 mA, so let's use 1.5 mA (20:1). This is the current through the HCPL817 output transistor.
The ratio of the 817's input LED current to its output transistor current is called the CTR (Current Transfer Ratio). To get 1.5 mA of output current, the input current must be 1.5 mA at 100%, 3.0 mA at 50%, 7.5 mA at 20%, etc. The 817 has a range of CTR values depending on the operating conditions, from 50% to 600%. Looking at the datasheet chart, it has a typical CTR of 100% at 2 mA. 2 mA in, 2 mA out, we need only 1.5 mA, sounds good. ... But wait.
To charge up C1 and drive Q1 with base current takes more than the 1.5 mA. A rough calc puts it at around 5 mA for a 4.7 uF cap. A look at the chart indicates that at 4 mA input current the CTR is around 130%, for an output current of 5.2 mA. Reducing C1 to 2.2 uF cuts this in half. Charging up the cap completely in the first half-cycle prevents the relay contacts from chattering if the cap is charged up incrementally over a number of cycles. This is important only at turn-on because the capacitor is not completely discharged every half-cycle.
For now I'd go with a 2.2 uF cap and 2 mA input current. I'll chew on this more later today.
ak
The ratio of the 817's input LED current to its output transistor current is called the CTR (Current Transfer Ratio). To get 1.5 mA of output current, the input current must be 1.5 mA at 100%, 3.0 mA at 50%, 7.5 mA at 20%, etc. The 817 has a range of CTR values depending on the operating conditions, from 50% to 600%. Looking at the datasheet chart, it has a typical CTR of 100% at 2 mA. 2 mA in, 2 mA out, we need only 1.5 mA, sounds good. ... But wait.
To charge up C1 and drive Q1 with base current takes more than the 1.5 mA. A rough calc puts it at around 5 mA for a 4.7 uF cap. A look at the chart indicates that at 4 mA input current the CTR is around 130%, for an output current of 5.2 mA. Reducing C1 to 2.2 uF cuts this in half. Charging up the cap completely in the first half-cycle prevents the relay contacts from chattering if the cap is charged up incrementally over a number of cycles. This is important only at turn-on because the capacitor is not completely discharged every half-cycle.
For now I'd go with a 2.2 uF cap and 2 mA input current. I'll chew on this more later today.
ak