Step 1: Components list
The Particle Core (a.k.a. Spark Core) module
There are two versions of the Core – one with a built-in ‘chip' antenna, and one with a u.FL socket for an external antenna. I've found the built-in antenna is fine anywhere in my house where there is normal (“two or three blobs on an iPod”) Wi-Fi reception. The external antenna would be better for poor signal areas (e.g. an outbuilding) but you'll have to add the cost of a separate Wi-Fi antenna and a u.FL ‘pigtail' lead.
AC Current Sensor
This is a small magnetic device which clamps over a current-carrying mains conductor, and produce an output voltage which is proportional to the current flowing in the wire. The one I used was for an Owl home energy monitor, but you can search Amazon, eBay, etc, for ‘AC Current Sensor' for a variety of alternatives. Make sure you choose one with enough maximum current capability for the load you're wanting to measure (e.g. 30A = 7kW approx). Please note – you don't want to use a ‘current shunt': these are not isolated from the mains itself and cannot be used in this design.
AC output mains adaptor
The circuit needs an AC power input of between 6V and 12V (RMS). I found a 9VAC adapter for an old modem in my junk box; power consumption is low (3W or less), so pretty much any adapter will work. Note that a DC adapter won't work, because the monitor needs timing information from the mains to measure real power consumption accurately.
5V output DC-DC converter
My original plan was to use an old car USB charger to provide a step-down regulator to provide 5V to the Spark module. Sadly it proved faulty, so I designed a circuit based on the MC3063 IC. You can build this, or for simplicity you could use a ready-made module. A variety of modules based on TI's LM2596 chip are readily available from Amazon, eBay, or elsewhere.
The passive components used in the circuit are:
- C1 1000uF 25V electrolytic
- C2 100uF 10V electrolytic
- C3 100n ceramic
- C4 220u 25V electrolytic
- C5 470p ceramic
- D1-D4 1N4001
- Q1 2N2222A
- R1 10K
- R2,R7 1K
- R3 22K
- R4,R5 47K
- R6 220R
All resistors can be 0.25W, 5% tolerance or better. Metal film is preferable to carbon types, as they have lower noise.
You will also need:
- Connector for power input (and optionally the current sensor)
- An enclosure (I used an ABS box approx 14cm x 8cm x 4cm)
- Prototyping board (pad board or strip board)
- 2 x 12-pin 0.1″ socket for Spark module
- Nuts, bolts and spacers for mounting
Step 2: The Particle Core module
You'll need to be familiar with the basic operation of the Particle Core in order to connect it to a network and load firmware onto it.
The best place to start is Particle's own guide at http://docs.particle.io/start/. You don't need to have built anything at this point, as the Core can be powered via its USB connector.
Following the tutorial, make sure that:
- You have set up an account (user name and password) to access the Particle developer site.
- You have given the Core a name and connected it to a Wi-Fi network (using the Particle app on an iOS or Android device).
- You're familiar with the web IDE (build.particle.io), and are able to download simple programs (e.g the ‘Blink an LED' example) onto the Core.
Step 3: Build some hardware!
Next, you'll need to assemble the circuit onto the prototyping board. The schematic is available as Spark-power-meter-main.pdf (see below) – you may find it useful to print it out and mark off components as you go.
The main circuit blocks are:
- D1-D4, C1-C3: AC rectifier and power supply
- R1-R3, Q1: 50Hz timing signal generation
- R4-R7, C4, C5: current sensor signal conditioning
Try to keep the last block relatively compact and close to the Core, as long wires will pick up unwanted noise and reduce the measurement accuracy. C5 should be wired as close to the Core pins as possible. The DC-DC converter should be kept separate.
If you are using a different current sensor, you may need to adjust the value of R6 later. It's a good idea to put this somewhere where it's not too difficult to unsolder it.
If you want to build the simple 5V DC regulator circuit, the schematic for this is given next.
Step 4: (Optional) Discrete DC-DC converter
The 5V regulator circuit I used is shown above; the schematic is in attachment NCP3063-converter.pdf . The required parts are as follows:
- C1 2.2nF ceramic
- C2 100nF ceramic
- C3 180uF or 220uF low-ESR type
- D1 1N5819
- IC1 NCP3063P
- L1 100uH, 1A current rating, high-frequency type
- R1-R3 1 ohm
Again, it pays to keep the layout compact as the switching regulator generates a certain amount of high-frequency noise. I soldered the 3063P IC straight into the board, to assist with heat dissipation.
For more detail: Internet-connected home energy monitor