This is a magic box which will let you monitor the power consumption of your house from anywhere on the Internet! It measures both true power (Watts) and apparent (VA) power, it keeps a running total of electricity units used, and measures mains frequency as a bonus.

The project uses a Particle Core(*) module - a little board with an ARM microprocessor and a Wi-Fi interface - to do all the hard work. To build it, you'll need to be able to solder and follow a simple circuit diagram. At UK prices, total parts cost should be no more than £50.

The project was designed for 230V 50Hz (European) mains circuits, but with suitable calibration ought to work on US or other systems.

* - until a few days ago, Particle were known as Spark. You'll find 'Spark' sprinkled throughout the supporting files for this project - please be assured these are the same thing!

Step 1: Components List

You'll need the following major components:

The Particle Core (a.k.a. Spark Core) module

This comes in a nice little kit with a breadboard and USB lead. You can buy one direct from Particle at https://store.particle.io/, from Adafruit, or in the UK the cheapest I've found is from CPC.

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.

Other components

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.

Step 5: Basic Checks

It's worth performing a few quick tests before putting the Core in its socket. Put a 100 ohm resistor (if you have a 0.5W or higher one, use it) in the socket between pins 1 and 2, then connect the AC input so that the circuit is powered. You should be able to measure 5V between pins 1 (TP2 in the schematic) and 2 (GND). If it's over 5.5V there may be a problem with the regulator (the Core is happy up to 6V).

If all is well, turn the power off, remove the resistor, and insert the Core into the socket. Apply power, and within a few seconds it should connect to Wi-Fi (LED flashing green), then connect to the Particle internet service (flashing cyan), then reach the 'running' state ("breathing" cyan). If no LED comes on within a second or two, turn everything off quickly and check the circuit!

Step 6: Load the Firmware

The firmware for the power monitor is in a single file power_monitor.ino. The simplest way to load this onto the device is:

  • Ensure the monitor is turned on and connected to the Particle Cloud ('breathing' cyan)
  • Open the Particle IDE at https://build.particle.io/ and log in
  • Choose 'Create new app' and give it a title (power_monitor works for me)
  • Now download power_monitor.ino from this page and save it to disk
  • Open it in your favourite text editor, then cut and paste it into the Particle editor window
  • Hit the verify button (the 'tick' shape) and check that it builds properly. (If there are errors, check that all the lines have been cut-and-pasted properly).
  • If all is well, click 'Cores' in the IDE and make sure your core is selected (has a yellow star next to it), and click the 'Flash' button.

Step 7: Give It a Test

When the firmware is loaded, you're ready to connect the sensor to something and give it a test.

The sensor is clipped round one (not both) of the live or neutral conductors carrying the current. I found it useful to build a test adapter which could be plugged between the mains supply and a load which allowed the sensor to measure the current in the live wire (see picture).

The measured values can be read via the Particle cloud API in a number of ways. To get started I've attached a simple program spark_power.py which can run on any computer which has Python installed and an Internet connection.

Download spark_power.py to a suitable folder on your computer, and then open a command line window (see instructions for Windows, Mac OS or Raspberry Pi) and navigate to the download folder using the cd command.

Now, at the command prompt, run:

python spark_power.py MyCoreName

replacing MyCoreName with the name you gave the Core in step 3. The first time you run this, it will ask you for the user name and password for your Spark account:

 Please enter Spark login email address: user@example.com
 Please enter password:

After a short pause, it will display the values it has fetched from the Spark core, something like this:

upTime              : 1508.0
connectTime         : 887.0
wifiRSSI            : -54.0
powerWatts          : 56.7
powerVA             : 57.8
mainsFreq           : 50.0
totalWh             : 2.3
sinPhi              : -0.1

You can re-run spark_power.py a second time, and it will skip the login name and password prompt - it saves a Spark access token in a file (~/.spark/spark.config.json) which can be used for later operations.

The variables you can read are:

upTime: This is the total time since the Core last rebooted, in seconds. You can use this to detect power interruptions (it will be reset to 0 following a power cut).

connectTime: The time in seconds that the Core has been connected to the Spark cloud service. If the connection is lost (e.g. due to a Wifi problem, or Internet outage), this will be reset to 0.

wifiRSSI: The 'Received Signal Strength Indication' value, expressed in dB. This is always negative, with more negative values meaning worse signal strength. In my testing, -40dB was a very good WiFi sign, down to about -85dB when the connection started to fail.

powerWatts: The real power being measured by the meter, in Watts. The reading is updated every second or so.

powerVA: The 'apparent' power currently being measured by the meter. The apparent power will be greater than the real power for 'reactive' loads (e.g. a computer power supply, or some types of motor) - see e.g. this paper for an explanation.

mainsFreq: The currently measured mains frequency, in Hertz.

totalWh: The total number of Watt-hours (of 'real' power) measured by the meter since it was booted. 1 Watt-hour is 1/1000th of a kWh, the standard "unit of electricity" read by your meter.

sinPhi: Shows whether the current load is resistive (=0.0), inductive (-1.0), capacitive (1.0), or somewhere in between. This is useful to know during meter calibration (see below).

Step 8: Calibration

With the circuit as shown and the suggested current sensor, the firmware should not need much adjustment. However, there are a couple of values you can adjust for best accuracy with a variety of different components.

For calibration, I used an electric kettle connected via my test adapter. This is a simple (purely resistive) electrical load, it gives a nice strong signal on the sensor, and has a known (or easily measured) power consumption. Electrical heaters or incandescent lamps are also good for calibration.

Timing calibration

For accurate measurement of 'real' vs 'apparent' power, the meter needs to get timing information from the AC mains (via the circuitry around Q1). You can adjust this using the cal_PhaseTrim value in the firmware.

When using the kettle, or other resistive load, the sinPhi value read from the meter should be as close to 0 as possible, and powerWatts should be equal to powerVA. If this is not the case, reducing the cal_PhaseTrim value will make sinPhi more negative, and increasing it will make it more positive. Change the value in the firmware by a small number and re-flash the Core. After a few tries you should find an optimum setting.

Setting absolute accuracy

The cal_Scale value is used to calibrate all the power reading values (powerWatts, powerVA and totalWh) read by the meter. You can adjust it so that the measured power matches a power reading you know to be accurate (e.g. measured with a plug-in mains power meter). The power readings are directly proportional to the cal_Scale value, so if it is over-reading by, say, 15%, dividing cal_Scale by 1.15 will put it right.

Changing full-scale sensitivity

The meter will read up to approximately 10kW full scale using the component values shown. It is possible to change the maximum reading (or adjust for different sensors) by increasing or reducing the value of R6, and re-calibrating cal_Scale afterwards. Lower values of R6 will increase the maximum reading, at the expense of lower accuracy at lower readings. To maximise sensitivity (at the expense of a lower maximum reading), R6 can be increased, up to a maximum of about 1k.

Step 9: Go Collect Some Data!

Once calibration is complete, the complete kit can be installed. The photo shows the current sensor attached to one of the mains supply cables in my house.

The spark_power.py program can be used to take periodic readings, and produce output suitable for importing into a spreadsheet program. To do this, use the -c option to produce "CSV" (comma-separated-value) output, and the -t option to specify a number of seconds to wait between readings. For instance, you can run:

python spark_power.py -c -t 20 MyCoreName powerWatts powerVA mainsFreq

This will produce output similar to this:

17/05/15,20:35:06,943.8,974.9,50.0 17/05/15,20:35:29,916.7,971.5,50.0 17/05/15,20:36:03,999.0,1019.1,50.0 ...

The first two fields are the date and time, and the next are the powerWatts, powerVA, and mainsFreq values as requested.

After that, it's up to you!

Useful links

<p>Hi</p><p>Thanks for an interesting and well presented article. Im not much of an electrical engineer, but Im starting a project like this to measure power consumption in our home which has a three phase supply. Is there any reason why I cant duplicate your design to monitor each of the 3 phases I have? Do you think there would be issues with timing signals?</p><p>Id be grateful for your thoughts.</p><p>Thanks</p><p>Phil</p>
<p>I'm not a circuit expert and am looking to build a small plug-in monitor for a dorm room. Can someone simply clarify what happens without the 6-12V AC input? I've used the EMON circuit here: <a href="https://openenergymonitor.org/emon/buildingblocks/how-to-build-an-arduino-energy-monitor-measuring-current-only" rel="nofollow">https://openenergymonitor.org/emon/buildingblocks/...</a></p><p>and it just uses the clamp alone. How far off are our measurements without monitoring the frequenzy? I believe we are assuming US 120V and 60Hz in the EMON code to get RMS and real power in the EMON code. I'm just having a hard time finding 6-12V AC power supplies for a bunch of small dorm submeters we want to build.</p>
<p>The firmware I've written won't work without a mains-frequency timing signal at the D2 input pin, which is derived from the AC input. You could, in theory, rewrite the firmware to simply measure the AC RMS current (and therefore calculate the 'VA' apparent power being drawn) but I wouldn't recommend it. </p><p>Without the timing signal it can't distinguish very low power-factor loads from ordinary resistive ones. You'll find that - for instance - many computer power supplies appear to be taking tens of watts in 'standby', where in fact the real power they're consuming (and therefore what you're paying for) is much less, because they have a low power factor. Some LED bulbs behave the same way. As it happens, I developed this design only after first building a 'current clamp only' system and being dissatisfied with its performance.</p><p>I don't think AC power supplies should be too hard to buy. If you're in the US, you can check out Newark's range: </p><p><a href="http://www.newark.com/ac-ac-wall-plug-in-power-supplies" rel="nofollow">http://www.newark.com/ac-ac-wall-plug-in-power-sup...</a></p><p>Or Digikey's, at:</p><p><a href="http://www.digikey.com/product-search/en/power-supplies-external-internal-off-board/ac-ac-wall-adapters/590573" rel="nofollow">http://www.digikey.com/product-search/en/power-sup...</a></p><p>They might be a little more expensive than e.g. Amazon, but you can expect them to come with all relevant safety certifications, which I'd strongly recommend.</p><p>Thanks</p><p>Ian</p>
<p>Great Instructable. I'm currently teaching myself a bit of electronics as a hobby, I've studdied Capacitors, Diodes, Transformers etc. at Physics A Level, but they don't really teach practical uses like bridge rectifers. I just have a few questions about the circuit if that's okay? </p><p>Did you integrate capacitors in to your power supply (DC-DC) to smooth the 'bumpy' signal it recieves or am I misunderstanding the circuit diagram? </p><p>What is the purpose of R1, R2 and Q1 in this circuit? </p><p>And if you have time, could you explain the purpose of the components surrounding the current sensor? If this is too much answering of my questions would be greatly appreciated, many thanks! </p>
<p>C1 is the main 'smoothing' capacitor in the circuit. The AC power input is rectified by D1-D4 to give a 'bumpy' DC signal (google &quot;full wave rectifier&quot; for more info). C1 charges up during the peaks, and discharges (keeping the circuit powered) between the peaks.</p><p>The DC-DC converter also has a smoothing capacitor C3 - in simple terms, the IC switches the input power on and off very quickly, and L1 and C3 filter this on-and-off waveform to give a smooth 5 Volts.</p><p>R1, R2 and Q1 are provided so that the Core can sense the mains input frequency - Q1 switches on (pulling the D2 pin low) when the mains input on J1-1 is high enough, once in each AC cycle. More importantly, the Core needs to sense the _phase_ of the mains input relative to the current through the current sensor - this lets it distinguish 'reactive' loads (which don't actually consume power) from 'resistive' ones (which do). Search for 'power factor' for more info.</p><p>Finally - ! - the other components (R4-R7, C4) are there to convert the voltage from the current sensor into a range that the Core's ADC can process. The current sensor gives an AC output, with positive and negative values. The ADC (A0 pin) needs a value in the range 0 to 3.3V. R4,R5 and C1 give a DC voltage of roughly 1.65V, which is added to the current sensor voltage. So if the sensor is giving, say, -0.1V to 0.1V, the ADC input will be 1.55V to 1.75V. R6 is a 'load' resistor which reduces the current sensor output to be in a comfortable range, and R7 is just for safety, to protect the Core input pin if there's an overload (or miswiring) in the current sensor.</p>
<p>Great Instructable. I'm currently teaching myself a bit of electronics as a hobby, I've studdied Capacitors, Diodes, Transformers etc. at Physics A Level, but they don't really teach practical uses like bridge rectifers. I just have a few questions about the circuit if that's okay? </p><p>Did you integrate capacitors in to your power supply (DC-DC) to smooth the 'bumpy' signal it recieves or am I misunderstanding the circuit diagram? </p><p>What is the purpose of R1, R2 and Q1 in this circuit? </p><p>And if you have time, could you explain the purpose of the components surrounding the current sensor? If this is too much answering of my questions would be greatly appreciated, many thanks! </p>
<p>Sadly, since I originally wrote this, the Core module has been withdrawn by Particle and replaced by the Photon. It's cheaper and generally better than the Core, but sadly not compatible, as the microcontroller is slightly different.</p><p>If anyone's thinking of building this you'd do well to get a Core before stocks run out. I'm sure the Photon port is quite simple, if anyone wants to volunteer...</p>
<p>Nice tool, but what happens when the mains voltage changes? In my area it fluctuates between 229V and 248V depending on load so if I do the calibration at a low incoming voltage the meter would be out when the line voltage goes up?</p>
<p>I got the same question. Does this circuit cater for changes in voltage?</p>
<p>No, it doesn't.</p><p>In theory you could detect changes in mains voltage by measuring the voltage on C1 (via a suitable divider). The main problem with this approach is that the C1 voltage also depends on the current being drawn by the circuit (particularly the Wi-Fi transmitter) and the load regulation of the mains transformer (which will vary from one type to another). These factors (and the near-impossibility of actually controlling the mains voltage during testing) mean that calibration would be too tricky to get right.</p><p>We could, alternatively, have a second AC transformer just to measure the mains voltage (like OpenEnergyMonitor does), but it adds to the cost and is, to be honest, a bit clunky. I rejected anything fancy like building an opto-isolated voltage sensor on safety grounds.</p>
<p>I tried looking for a circuit and program that would allow me to measure the mains voltage using a second AC transformer so that I could integrate it together with your circuit, but so far I did not find anything, at least not for the Particle Core. Do you think you can help me there?</p>
<p>Would I end up blowing something if I plug this circuit to the computer's USB (given the circuit has it's own power source)? The reason I want to do it is to be able to read the serial so that I can see what is going on inside.</p>
<p>It will be fine provided that the AC mains adapter has an output which is isolated from mains earth - it should be, but you could double-check by connecting a continuity meter between the earth pin and the output terminals. </p><p>I used a USB connection when developing the circuit - the Core has a power switching circuit of some form so that it doesn't try to feed 5V power to the USB host. (Actually, I connected it to my Mac via an external USB hub, as it would be a lot cheaper to replace if I screwed it up...)</p>
<p>I just got myself a spark/particle just because of this project. A few questions:<br>Can, I substitute the 1N4001 with 1N4004?<br>Also, I am having trouble find the NCP3063P from where I was planning to buy the components (rapidonline.com) can you recommend an equivalent?<br><br>Can I replace the whole DC-DC circuit with this?<br><br>http://www.rapidonline.com/electrical-power/r78-5v-0-5a-single-out-converter-sil-84-2554</p>
<p>Why is there a pull-down resistor in the base of the 2N2222A transistor?</p>
<p>It's a voltage divider which has the effect of making the 'sync' pulse narrower. I'd originally hoped this would be accurate enough that no timing/phase calibration would be necessary, but in practice that wasn't the case.</p><p>I could have saved 5p by feeding the AC input via R1 straight into a digital input pin, but that would feed a signal with a strong 50Hz component straight into the chip, which is exactly the wrong thing for accurate measurement of the 50Hz sensor signal.</p>
<p>Great job, would be more interesting if you could do the Voltmeter a little bit more self explained and also if you could use some isolation circuit, or other system to isolate everything just for safety.</p><p>I love to build one for my house. But im afraid to burn my own house cause of that kind of things. </p><p>Im surprise nobody else haves write you, cause your job its awesome. Maybe if you just used Arduino more people will join this instructables. But what its interesting its your circuit is Arduino friendly.</p><p>Regards for this usefull instructable.</p>
<p>The circuit is fully isolated from the mains: the AC adapter provides isolation for the power input to the circuit. If you buy a ready-made unit with the correct approvals (CE / UL marking, etc) for your region it will be no more unsafe than any other consumer electronics.</p><p>The current clamp sensor attaches to the outside of a mains wire - it doesn't make contact with any conductor. Again, if you buy a unit which is designed for the purpose it will not pose a safety risk.</p><p>Obviously, I would not recommend dismantling anything to gain access to the mains wiring, and if you're not confident in what you're doing it would be wise not to build it.</p>
<p>This looks like a nice simple circuit to make up and I'm looking to do something similar myself. Could this be expanded to have more power sensors using just the one Core module? I am looking to add 5 or 6 sensors if possible to monitor different circuits in my house (lights, sockets, heating etc). I've been closely watching the OpenEnergyMonitor project which looks perfect but their largest device only accepts 4 sensors and is a bit more pricey than I'd like.</p>
<p>Yes, it could be expanded - there are 8 analogue inputs on the Core, each of which could be connected to a sensor. You'd have to duplicate the R6,R7,C5 circuit for each sensor, but they could all share the R4/R5/C4 network. You'd also need to change the firmware to switch between analogue inputs - at the minute it's fixed at measuring A0.</p>
<p>Interesting project!</p><p>Congratulations!!</p>
How would I go about adapting this to work in the United States and would I be able to clamp it onto both phases or would I have to build 2 and monitor them separately?
<p>There should be no problem working at 60Hz instead of 50Hz, nor at 110V instead of 230V, although you will need to calibrate the output as described.</p><p>I'm not sure what you mean by 'both phases'. The normal arrangement is that there will be a pair of conductors - Live and Neutral - which supply mains power. The current in the Live conductor will be exactly matched (unless there's a major fault!) by a return current in the Neutral one so there is no need for two sensors - measuring one conductor is all you need.</p><p>If I've misunderstood and you somehow have two /pairs/ of Live-and-Neutral coming in, then, yes, you'll need something more complicated like two monitors.</p><p>Thanks</p><p>Ian</p>
I must have missed the calibration part. I'll have to reread the instructable <br><br>In the US, we have 2 120V phases and 1 neutral coming into the panel. If something needs 240V, it is connected to 2 breakers-one from each phase, but everything else can get 120V from either phase. (America's power is stupid, I know...) <br>Here's a diagram and some more detailed explanation: http://www.wphey.com/inside-main-breaker-box/ <br>Do you think it would be as simple as a 2nd current sensor and a line of code to add the values together? <br>
<p>I learn something new every day :-) </p><p>The simplest possible thing would be to have two current sensors (each with an R6 load resistor across it), one on 'Hot1' and one on 'Hot2', and wire them in series (so that the voltages are added by good ol' analogue electronics!). This would give you a single total reading without changing the rest of the circuit or the firmware.</p><p>Note - you'll also need to install the current sensors the 'right way round', so that loads connected across the '240V' connection produce sensor voltages which add together rather than cancel each other out.</p><p>Building two completely separate units and adding the power readings together would also work, if you wanted to readings for each phase as well as the total power. </p><p>The last option would be to connect a second sensor to the A1 input on the Core (via its own copy of the R6/R7/C5 network), and get the firmware to alternate between the channels on each measurement cycle. This needs more firmware hacking than I can describe in this post, though.</p><p>Thanks</p><p>Ian</p>
<p>&gt;The simplest possible thing would be to have two current sensors (each with an R6 load resistor across it), one on 'Hot1' and one on 'Hot2', and wire them in series (so that the voltages are added by good ol' analogue electronics!).</p><p>I'd like to say I would have come up with that, but it probably would have taken an embarrassingly long time :p</p><p>Once the Photon is released, I'll have to give it a try. Thanks for your help!</p>
<p>Great article, thank you!!</p><p>You could save some money using a ESP8266 module and the Lua programing language! The NodeMCU Development kit looks very similar to your Particle.</p><p>http://www.banggood.com/NodeMcu-Lua-WIFI-Development-Board-For-ESP8266-Module-p-976440.html?currency=USD&amp;createTmp=1&amp;utm_source=google&amp;utm_medium=shopping&amp;utm_content=saul&amp;utm_campaign=Electronic-xie-us&amp;gclid=Cj0KEQjwvuuqBRDG95yR6tmfg9oBEiQAjE3RQMFgmFuvvXQsMJo6jNMbLUvZ2Uo8cG_bIVO5TN_GkHoaAt378P8HAQ</p>
<p>Thank you very much for this write up! I just had SolarCity install panels on my house and I was trying to get into their monitoring system to see my panels, this will solve my problem so much easier I think.</p>
<p>Nice work - I've been thinking of doing something similar for ages.</p><p>I notice you specified 20s samples in the last step but the resulting samples appear to be generated rather irregularly and slower than requested. I have a commercial meter and that samples only every 15s or so, which always annoyed me because I really wanted to be able to spot things turning on and off briefly, etc., if I could only get the data out. What is the maximum sample rate you could get out of this, do you reckon? Does the chip take a few seconds to process each sample?</p>
<p>The code itself makes a new measurement every second (it's averaging the samples it takes over that second to get an accurate reading) - the '20 second' figure is the interval between fetching those readings using the Spark, sorry, Particle API. You can use a lower time interval if you need more data.</p><p>The limiting factor in fetching data using the example Python program is the need to make a new HTTPS connection for every variable being fetched; if you're fetching a lot of variables this will add up to several seconds each time. (This is why there are more than 20 seconds between results in the example).</p><p>I imagine it would be possible to open one HTTPS connection to the Particle web server and make lots of requests using it, but I've not got code for that yet. I don't know whether Particle have limits on the amount of data they'll let you pull through the system, and whether requests get throttled if they get too busy.</p><p>If you want to directly attach the meter to another computer, the code also outputs data to a serial port, once per second. You can attach a serial lead (3V3 levels only) to the 'TX' pin - the data being sent is described in function oneSecondUpdate().</p><p>Cheers</p><p>Ian </p>
I really like this.

About This Instructable




More by TheSpodShed:Pringle Can MIDI Drums Mega Power Bank Super cheap Ethernet for the Raspberry Pi 
Add instructable to: