A wave shaping, filter and residual voltage removing circuit , consisting of: a comparator , a second voltage divider consisting of a series connection of a third resistor (R3) and a fourth resistor (R4) and comprising a first, a second and a third terminal, a capacitor (C1) comprising a first and a second terminal, a fifth resistor (R5) comprising a first and a second terminal, and a first transistor (T1) having a base, and a first and a second terminal, wherein an input of the wave shaping, filter and residual voltage removing circuit is connected to the first terminal of the second voltage divider, the first terminal of the capacitor (C1), and the first terminal of the fifth resistor (R5), and configured to receive a full rectified sine wave signal, wherein the second terminal of the second voltage divider, the second terminal of the capacitor (C1) and the second terminal of the first transistor (T1) are all connected to ground, wherein the first terminal of the first transistor (T1) is connected to the second terminal of the fifth resistor (R5), and wherein the comparator has a first input connected to the third terminal of the voltage divider, which is a node between the third resistor (R3) and the fourth resistor (R4), a second input for connection with a reference full rectified sine wave generator , and an output connected to the base of the first transistor (T1), wherein the comparator is configured to compare the full rectified sine wave signal with a reference full rectified sine wave signal, provided by said reference full rectified sine wave generator , and drive the base of the first transistor so that an output of the wave shaping, filter and residual voltage removing circuit follows the reference full rectified sine wave signal, hence removing a residual charge from the capacitor. a comparator , a second voltage divider consisting of a series connection of a third resistor (R3) and a fourth resistor (R4) and comprising a first, a second and a third terminal, a capacitor (C1) comprising a first and a second terminal, a fifth resistor (R5) comprising a first and a second terminal, and a first transistor (T1) having a base, and a first and a second terminal, wherein an input of the wave shaping, filter and residual voltage removing circuit is connected to the first terminal of the second voltage divider, the first terminal of the capacitor (C1), and the first terminal of the fifth resistor (R5), and configured to receive a full rectified sine wave signal, wherein the second terminal of the second voltage divider, the second terminal of the capacitor (C1) and the second terminal of the first transistor (T1) are all connected to ground, wherein the first terminal of the first transistor (T1) is connected to the second terminal of the fifth resistor (R5), and wherein the comparator has a first input connected to the third terminal of the voltage divider, which is a node between the third resistor (R3) and the fourth resistor (R4), a second input for connection with a reference full rectified sine wave generator , and an output connected to the base of the first transistor (T1), wherein the comparator is configured to compare the full rectified sine wave signal with a reference full rectified sine wave signal, provided by said reference full rectified sine wave generator , and drive the base of the first transistor so that an output of the wave shaping, filter and residual voltage removing circuit follows the reference full rectified sine wave signal, hence removing a residual charge from the capacitor. <EOS>