As part of the solar hot water system (view other blog posts) we have been installing onto our home we wanted to be able to keep track of the time the solar water pump is running. To monitor the pump we decided to use a simple mains power supply to switch an opto isolator which then is monitored by the Arduino board and the new logging code which takes a measurement every 15 seconds.
The circuit was initially mocked up using a breadboard and the mains transformer was soldered direct to a mains supply for testing. We used our spare Arduino UNO board to test this circuit as these are much cheaper to replace if we blow one up!
We designed a simple PCB to hold the pump monitor. The circuit is a basic power supply using a small 9v transformer which a bridge rectifier, smoothing capacitor, current limiting resistor and a opto isolator. The low voltage (data) side has a 5V input, Ground input and output pins. The opto isolator input is connected to the 5V line and there is a current limiting resistor for the output line and a pull down resistor to ground.
On the Arduino board this was connected to one of the analogue inputs and a simple sketch was written to check the input value and switch between "Pump On" and "Pump Off" states.