Hardware

Schematic preview sizeSchematic (click for full size)
The schematic may look complicated, but the EnerJar's electronics are actually quite simple. Power is voltage times current, so we must take these values and provide them to the PIC as inputs, so that it can perform the calculation. There is also a bit of wiring for the LED display.

DANGER: The EnerJar's circuitry involves 120-volt AC line voltage. Improper care can result in potentially fatal electrical shock. Do not attempt this project if you are unsure of proper safety procedures. The plans for EnerJar are provided without warranty and the designers cannot be held liable in the result of property damage, personal injury, or death.

Seriously, the EnerJar does some pretty crazy things with AC voltage. Be careful when building it. Below are some design and building notes. Look for more photos and detailed build instructions in the coming days.

Power supply
In our original prototype, we used an old 5-volt cell phone charger as the power supply. The EnerJar draws almost no current, so any 5-volt DC wall wart will work.
CAUTION: Never solder the circuit with power applied to it. Doing so is extremely dangerous.

Current sensing
The EnerJar uses a very low-resistance shunt to measure the current. Ohm's law states that the voltage across a resistor is proportional to the current running through it. We can exploit this to create a very cheap and effective current-to-voltage converter. The shunt resistor, R7, that we use is a length of about 8 inches of 18-gauge wire. This is actually about the size of the wire in some extension cords, so the voltage drop across it is quite small, so this "resistor" gives off virtually no heat. To amplify the voltage, we use a high-precision instrumentation amplifier (IC3), the LT1167. This mighty chip can amplify many thousands of times with almost no distortion or noise. One of the features we are working on is auto-ranging, where we will use a digital potentiometer as the gain resistor (R8) to provide adjustable gain.

Voltage detection
The voltage is much more straightforward to get into a useable form. A 68:1 voltage divider (R5 and R6) is used to make the peak-to-peak voltage fall within the 5-volt range that the PIC is able to capture. This voltage is then buffered using one channel of our op-amp (IC1-d) before being sent to the PIC. The EnerJar can be modified to work with 240-volt AC simply by changing R6 to 1.5Mohm.

Voltage references
R1, R2, R3, and R4 form a voltage divider with outputs at a nominal 1.5, 2.5, and 3.5 volts DC. These voltages are buffered with the remaining three channels of the opamp, IC1-a through IC1-c. These form reference voltage outputs Vref+ (3.5v), Vref0 (2.5v), and Vref- (1.5v). I know the naming is a little confusing, I pulled an all nighter last night finishing the schematic but I will fix the naming in a future revision. Note that these voltages are nominal, the exact values aren't critical because the PIC has calibration factors that can correct for imprecision. (Currently these values must be hand-coded, so you need a programmer that can rewrite the values on the chip. We plan to develop an auto-calibration mode where you can calibrate the EnerJar to a 60-watt lightbulb, for example.)

Vref+ and Vref- are only used by the PIC as the high and low voltage references for the A/D converter. In other words, a signal at 1.5v or less will be converted to 0x000 by the ADC and a signal at 3.5v or above maps to the maximum value, 0xFFF. This has to be done because the instrumentation amplifier can't output a voltage within about 1.5 volts of its supply rails.

Vref0 is connected to the neutral AC line. This means that the 0VDC power supply rail is about 2.5 volts below neutral and the +5V rail is about 2.5 volts above neutral.

Parts list
Parts list
Under construction. We are continuously adding to the documentation. Let me know if you plan to build an EnerJar in the near future, I can answer questions that may not yet be documented on this site.

Note to those of you with 240 VAC power lines: The only change you are required to make is in R6, which should be increased to about 1.5M ohm. The exact value is not important due to the calibration process.

Not a good idea for europe

This device would be quite a bit dangerous if used in a country that makes no distinction between Live and Neutral, like most european plugs.

Even if the plug is of the grounded variant it can be inserted either way, since it is symmetrical. Only ground is ever guaranteed to be in a specific wire (the yellow-green striped one, unless you live in a house built in the 40s or so, then it could possibly be red).

Further more, there are no standards defined which pin is N and which is L, so you can never be guaranteed to have the live or the neutral in a specific wire, and all devices should be built to cope with this.

In this case, reversing L and N could present dangerous levels of voltage, compared to ground, on the 5V input where the "wall wart" goes.

I would therefore suggest modifying the circuit to tap the 5V from the mains-power internally inside the jar. It's relatively easy to do, even without a transformer. That would make the circuit dangerous to touch anywhere, but I already consider it such, and it should be double insulated and have no connections to the outside world (except for the mains-in and out of course) anyway.

What changes must u make to apply 240v.

wonderful project

Voltage Regulators

Hi,i just wanna know if it is possible to use a 9-volts battery,of course connected to a voltage regulator to give me 5 volts,coz i kip on buying 5 volts battery,and they run out so quickly.Also S/Africa where i live in,uses a 220V + or - 5% tolerance,so i wanna know if it is still possible to use a 1.5Mohms resistor.Thanks

lcd

is it possible to use the an LCD instead of the led display?if so any advice?

How to measure power factor?

the Enerjar is very interesting project...how to modify the circuit in order to measure power factor?

thank you...

hey... good work... it is interesting to investigate those consumptions.. and i'm gonna go green.

thank you...
keep it rollin...

voltage divider ratio

Hi,
Was there a particular reason for using a 68:1 voltage divider? That would measure voltage +/-170V. In US, AC is a max of 127V. Just wondering if a different ratio would make the meter more accurate.

127V ac != 120Vp-p

AC in the wall is 120Vrms which is actually 1/sqrt(2)*Vpk-pk. In otherwords a 120V rms voltage would actually be 1.414*120 or about 170V peak-to-peak. Thats where that number comes from.

-Glen

No clock crystal?

I've been scratching my head over this one: can you really run the PIC without an oscillating crystal?

Re: no crystal

Of, course. It has an internal RC oscillator.

question

Sorry , but i don't understand! Where is this OSC. within the pic 16f877a ?! I checked the datasheet, but didn't find it!

Does Ground connect to 0 VDC?

Sorry if it's a dumb question...

PowerBox

A couple of Cornell students were inspired by the EnerJar. They simplified the design, added some features, and made it safer. Here is their writeup.

240V: suggest two Rs in series for R6

Great project! One note about 240V operation. The repetitive peak voltage across R6 would be around 340V, and the maximum working voltage rating for carbon resistors is typically 250V. I'd suggest replacing the single 1.5M resistor with two 750k resistors in series, so that each will see only 170V.

circuit board

I have been over the article several times. Where is the info on the circuit board?. Assembly says to solder to the board but I cant find board info. Where to get one.

Re: circuit board

At this point we do not have PCB's made. Expect to see a layout and most likely boards for sale/for free this summer. Stay tuned!

-Matt

How low does it go?

I have devices that should be drawing 0.35W at 120V. Can the EnerJar measure this small power consumption?
Nice project!

Re: How low does it go?

Hi Bob!
Great question. The design, as posted, would not be able to measure such small power draw. However, if you are building it with the intent of _only_ measuring small currents, you can make R7, the current sensing resistor, much larger. Aim to make the maximum voltage across R7 in the range of 5 mV. if R7 is 1 ohm, the maximum power that the circuit can measure is about 0.6 watts (if my calculations are right).

Best regards,
Matt

I'm not the greatest at

I'm not the greatest at electronics and was trying to understand how the hardware works in this project. What is the purpose of the opamps to form the reference voltages? Is it merely to show a high-impedance load to the voltage divider, and keep the reference voltages stiff?

enerjar

I like it, I have used the kill-a-watt and liked the features on it. Would it be possible to have the frequency, volts, and amps be displayed separately as well? I liked using the kill-a-watt for calibrating generators, however the units I had died.

joe

Schematic mistake?

Looking at http://www.enerjar.net/files/enerjar-schematic.png seems to have an error:
Seems to me that IC-1d input voltage divider (R5 and R6) have the "Neutral" and "AC Live"
inputs reversed!!

Re: Schematic mistake?

I had originally designed the hardware to be referenced to the live AC line, my logic being that the current reading would be inaccurate if it were being measured on the neutral line, because of possible ground wire leakage. It was pointed out in a comment on another page that there should never be a significant amount of current in the ground wire, in fact, it would be unsafe if there were current flowing in it.

So yes, you are right. My initial design was unduly dangerous, and I just updated the schematic to make it neutral-referenced. Thanks for keeping me honest!

-Matt

Safety?

How about the electrical safety?

The mechanical construction example uses a metal lid on the jar, and metal bolds to connect the PCB to the metal lid.

I would propose using a plastic lid and isolated stand-offs.
Please add this to the construction pages.

If it's metal, ground it

The standard safety rule would be that if you use a metal lid, it should be grounded. It would be easier to use a plastic-lid jar (or tupperware).

there are cheap hall effect

there are cheap hall effect sensors that can sense the current without using a resistor and will isolate everything else from the AC line. I wonder if there is a simple way to implement power factor measurement too.

Great Idea

Lets work it out!

Hall devices are notouriously difficult to use

Hall devices are notouriously difficult to use and to calibrate and keep calibrated. The measurement accuracy will be low.
The mechanical construction becomes an important factor, as coupling to the power conductor and de-coupling to the environment are important.

Besides that, the line voltage needs to be measured too, so that defeats the isolation advantage. Or you would have to go for a transformer solution, but that reduces accuracy and increases costs and volume.

Hall effect devices are not

Hall effect devices are not "notoriously difficult" to use. Allegro makes plenty of calibrated units for a few dollars. It just happens to be that, yes, we need to measure the voltage as well so we don't care if it's isolated.

A 240V meter

You are doing a great job! I want to have one now!

For those in Europe who don't want to wait for the EnerJar, I googled for a 240V alternative to the Kill-a-Watt that someone pointed to, and some guy recommended "Energy Monitor 3000" (around 60 USD) or the smaller "Energy Check 3000" (around 40 USD). Once you find that one, you will find many others too.

Have you considered a DC version?

Have you considered a DC version?

It would be really handy to have a DC version that could be used with 5-24vdc.

Thanks! doc

Stick to AC!

DC power measurement is easy, just multiply measured Voltage and Current.

AC power measurement is a chalenge due to cos-phi and power-factor; the phase difference between current and voltage and the non sine form of currents many devices generate.

This project appears to do the AC measurements the right way. Keep up the good work.

Computer interface

Having a visual output of power usage is a good idea. I'd really like to see a serial or USB interface so this data can be collected automatically and easily reported. Is this a part of your plans for the EnerJar?

Power sensing and reporting should be standard features for electrical sockets. Having a meter on the side of one's house that shows total usage is nice, but a complete report of when and where power was used would be the easiest way to curb energy waste. Providing a computer monitor of power usage can keep an energy budget on track more easily than waiting for the power bill. The trick is to make the sensors cheaper than the amount of energy that can be saved (and that's a problem mass production can handle).

Great work so far!

How about reporting data over the AC lines?

I'm very interested in this project, but particularly if it can be interfaced with a computer. I'd like to build a few dozen and put them into power strips, behind my fridge, etc. Then have them all report data periodically via the power line. Since the PIC already knows when the zero-crossing happens, it shouldn't be too terribly hard to add an X10 (or X10-like) capability. We'd then need a node that handles the power-line interfacing to the computer (probably opto-isolated serial)

Taken one step further, the PIC could also control a small solid-state relay to control the load. This would allow the module to not only read power and report it remotely, it could be used for automated control.

Thoughts?

Re: Computer Interface

>> I'd really like to see a serial or USB interface so this data

If my reading of the description is correct, then connecting this device to a computer would be dangerous. Since the "ground" reference for the circuit is actually the "hot" line from power outlet, then touching the circuit with anything (your finger, a USB cable, whatever) will yield a nasty shock, and probably destroy any grounded device you connect to it.

Not that it's impossible to build such an interface, just probably a bit expensive.

Optiocouplers. No need for

Optiocouplers. No need for wireless or any other stupid solution. Nice and simple.

Why not wireless?

Instead of a wired PC connection, the ultimate would be a wireless solution (802.1x or Bluetooth). I'm not sure how much energy it takes to do a wireless transmission. To save energy it might be smarter to do burst transmissions once and a while. Another option would be to have the jar data log usage which could be offloaded via USB memory stick once and a while. Keep up the good work.. projects like this inspire confidence that we will be able to overcome our energy problems.

Wireless with XBee

You could use a pair of Digi XBee modules to stream the samples wirelessly for data logging. These modules can operate in a mesh network so you could have an entire farm of these around your home for logging power consumption over time.

I see that pins 16 and 17 of the PIC are unused, which are the USART ports of the PIC. It would be a very, very simple exercise to configure the modules to transmit everything they receive from the PIC transparently over the network and organize the data on a PC.

I love this project though! Cool design for sure!

It would indeed be dangerous

It would indeed be dangerous to connect directly to anything outside the jar, so you'd use opto-isolation. It's not difficult, but it's also not trivial to design the layout so that the correct "creepage and clearance" distances are maintained between anything live and anything that connects out of the jar. These distances will be larger for 240V, so this needs to be designed in from the start, including things like a slot in the PCB under the opto-isolator to increase the creepage distance between the live and isolated pins.

Of course, as the jar is glass, you could use that as the isolation and do your own Opto- by having LEDs inside which send the data, and a photo-receptor on the outside to pick it up and send it to a PC, but light interference makes this less easy than buying an opto-isolator chip.

Here in the UK you can get plug-in meters that do the sort of thing that the EnerJar does, but also just display the information. Adding a PC interface to the EnerJar would make it unique, and to people like me, *very* useful.

Heep up the Good Work! :-)

Wireless Simplification

You are inside a transparent glass jar. Forget building your own crazy opto scheme, just use an IR Transmitter (which could be appropriately salvaged from an old remote control to save on waste) and beam stuff to the nearest IR receiver. It may not be the newest, hipest thing on the block, but it is unmatched in price and simplicity. If I remember correctly, most common IR protocols are standard serial that the unused USARTs ought to be able to handle natively. You could even make a jar that automatically shuts off a tv when you use too much energy (which, in my book, is the minute it turns on)

Enerjar PCB

I'm inspired by your open energy meter, and want to contribute. Would you care to have a PCB designed for it? It may make it easier for less skilled hobbyists to build it.

Thanks for your interest in

Thanks for your interest in the EnerJar! We are considering making PCB's available, if we can find a fab house that is cheap enough. Another concern we have is the environmental waste that is the biproduct of circuit board printing. Once the design is finalized, we will look into different options and decide if we think it's worth it to have PCB's made.

PCB

What I was offering was to do the PCB layout for you. Then all you need is the low cost PCB fab. I'd suggest not getting it made in China or India, as their environmental record is somewhat tarnished. It will cost a little more to do it in the US, Europe or Australia, but at least there are environmental controls.

My guess is around $5.- for the PCB.

DONT JUDGE

DONT JUDGE THE BOOK BY ITS COVER!!
be cautious,you are not worth to judge INDIA or CHINA !

just... wow

caution usually indicates a threat to life or happiness,
"be cautious about the heavy machinery." You really oughtn't threaten strangers on the Internet, if that is indeed what you were doing.

China and India both have terrible records on environmentalism, both for different reasons, but the result is the same. Perhaps one shouldn't judge a book by its cover, but judgment really ought to start somewhere. I'll address Chinese issues, b/c they're the most terrible. Recently, China was struck with the possible extinction of its river dolphins. It wasn't too much cleanliness and order that brought about their sad demise.

What about total carbon emissions in China? They really deserve to be the target of a healthy outpouring of international outrage. The PRC hides behind low per-capita carbon emissions, but their total number of citizens makes this statistic a joke.

What you seem to be asking is that westerners withhold judgment until well acquainted with the people and their practices. You're really asking that the world turn a blind eye to the mass industrial poisoning going on all over China.

Now as for judgment, you indicate that the above individual is not "worth(y) to judge." If not he than who? It ought to be the right of everyone to judge whatever they see fit to, for without discrimination, life is void of meaning and ability. Please, the internet is a scary enough place without you advocating for two-bit despots on building their empires on the bones of the dead.

India at least has environmental laws and a freely elected parliament, and a desire to try.

don't feed the trolls :)

don't feed the trolls :)

More good ideas...

This DIY is great to educate people on energy usage, but it's mainly preaching to the choir, as anybody with the means and will to build the thing is most likely both aware and able to prevent excess electrical use already.

Since you have so much electrical knowledge, how about creating DIY products that will actually prevent excess usage?

I would love to know how to build a powerjack for my house, that has a remote control. It would completely shut down all electronic usage in my house, unless i am actually present. By attaching a motion sensor or remote-control cut-off switch to a powerstrip, excess power drain is actually stopped when there's nobody around.

Or how about a capacitor, that would allow me to set a target for total electrical output for a day for my house. You would set the capacitor for the amount of energy you want allowed, and when that limit is reached, the power would turn off-- true self-imposed energy rationing. "Sorry kids! No more TV, we've used up all our energy for the day.."

preventing excess usage

Anonymous wrote: "how about creating DIY products that will actually prevent excess usage?"

The easiest solution here is to use the product between your ears! :)

powerjacks and capacitors?

Powerjack:What about food in your refrigerator and having to reset (non-battery) electric clocks - if you shut everything down?

Maybe some reading on capacitors (like at http://www.wikipedia.org) might be helpful. Not sure they would help in this application.

Capacitors

I get the impression that he's using the capacitor as the core for a timing circuit. Might be better to have a PIC count KWH's though, and then shut everything down. In this application a capacitor would be a bit inconsistent.

Power Factor

One thing that you need to be careful of when measuring AC power is that the voltage and current are not necessarily in phase. So simply calculating volts x amps will not give you the actual power consumed. Cheap PC power supplies are notorious for this. You may see some supplies marketed as "power factor corrected", which means they try to keep the current draw and voltage in phase.

If you are using a purely resistive load, like an incandescent lamp or a resistance heater, you will be fine. But a PC power supply, a cheap fluorescent ballast, or a compact fluorescent will give incorrect readings due to phase shift.

Check Wikipedia Power Factor Entry for a far better explanation than I can give.

There's a relatively cheap device called a Kill-a-watt that Amazon carries for about $20 that will do measurements that account for the power factor, and will accumulate data as well.