Go to the link above provided, also learn of zero crossing , google it and then learn how to slice the voltage by using it.