Schematic (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.
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.
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.
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.
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.
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.