As mentioned in an earlier post
I'll try to do one small PCB project every week and then send for PCB's of it every Monday.
Last week I did the PAW6 Game Of Life -board (viewtopic.php?f=56&t=5034
) plus an extra PAW X1 breakout/utility board (viewtopic.php?f=56&t=5053
) since Seeedstudio gave out vouchers for a free PCB order during the weekend.
This week I'll just finalize and order a board that I started on earlier. It's the sensor board for the mains (wall power) logger that will collect statistics about voltages and exact frequencies over a period of time.
The project will be split up to two pcb's. The first board is this PAW - the sensor board that makes the actual measurements and sends the data to the second board. The second board that I'll do in a later PAW will handle the storing, calculation and display of the received data.
The sensor unit will be built on a SoB DP5050 boards and will be powered by the mains using a transformerless power supply. Since this means that the entire board will have dangerous voltages on it so the data will be sent over an optocoupler so the second board will be isolated and safe from the mains power.
The schematic is rather simple:
To the left is the capacitive-style transformerless powersupply that is able to deliver up to about 30 mA.
D5,R2,R3,R8 is a half wave rectifier and voltage divider to scale down the 230 volt RMS to a voltage that the microcontroller can read with its ADC1 -input.
R4 and R7 is limiting the current into the frequency sense input pin. The internal clamping diodes in the microcontroller can safely clamp 230 volts to 5 volts as long as the current is below 1 mA.
And to the right the optocoupler is connected in series with an indicator led that will flash at each data transmission.
The firmware will measure the peak voltage during 50 or 60 cycles and then transmit the value over the optocoupler to the logging board. Since there are no variable timings or evil operating system that will disturb the timing the second board can use the beginning of each transmission as a 1-PPS (One Pulse Per Second) to accurately measure the mains frequency - the second board must have a very stable reference clock to do this, but that is another problem for another day.