WARNING: You should prevent the powered device from pulling more power then it can handle. This can be done with a fused setup. I am not going to cover this in the tutorial. Also not that working with mains and AC house current IS DANGEROUS. Proceed at your own risk. I also have no protection for maximum draw in the example below and this could lead to a fire if you overload the circuit! Putting some kind of fuse in line would be a good upgrade.

If you have not taken a look at the SainSmart input section go take a look there first.

 

The wiring for the outlets is rather simple each terminal on the right side gets its own wire. The left sides are tied together and then a single lead exits the box.

Outlet Wiring

This image shows all four of the black leads headed to their own relay. One for each outlet.

Output from SainSmart

Lastly take four more leads (I used red). I took red out of the common terminal of the relay and they are wire tied together and then into the black lead coming from the AC power cable. The white chord coming from the AC cable gets wire tied into the white lead coming from the outlets. I am not using the ground wire as my house does not have  a ground. This would be fairly simple to hook up as well. It would be similar to the white wire but going into the ground terminals.

Wiring to Cord

Overview shot of the wiring.