ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Make Your Own Wattmeter With A Microcontroller

Updated on September 8, 2011

Watt Meter Picture

A typical commercially available watt meter
A typical commercially available watt meter | Source
Inside a watt meter. This is the current sense board which converts the current into a voltage which can be interpreted by a microcontroller.
Inside a watt meter. This is the current sense board which converts the current into a voltage which can be interpreted by a microcontroller.
The micrcontroller board inside a watt meter. This circuit performs the logical steps to convert amps and volts to power and displays it on an LCD.
The micrcontroller board inside a watt meter. This circuit performs the logical steps to convert amps and volts to power and displays it on an LCD.

A watt meter, like the Kill A Watt pictured, plugs into the wall and records power usage statistics about the devices which are plugged into it. The exact details of how this is accomplished may differ, since there are many ways one may consider to design and implement such a device, but the basic idea is the same. Opening the Kill A Watt model reveals some of the secrets it employs to make a power measurement.

Electricity is passed from the wall outlet through a fuse and through a current sense resistor. Attached to the current sense resistor is a small circuit which amplifies the very small current coming from the sense resistor into a voltage which can be read by a microcontroller. The microcontroller converts this voltage using an analog to digital converter (ADC) and also takes into consideration the voltage, which is roughly 120 volts, and ultimately computes the power.

At least that is what the Kill A Watt appears to be doing.However, this page is not devoted to this particular watt meter, instead we're here to talk about how to build a watt meter, using our own design, from scratch!

Basic current sense amplifier circuit.
Basic current sense amplifier circuit.

The schematic above revolves around the MCP601 op amp chip wired to function as a high gain amplifier. The light bulb, in the circuit, represents a household type appliance which is the device under consideration by the circuit. As the household's electricity runs through the circuit it powers the light bulb and goes through the very low resistance current sense resistor. The voltage across the low resistance resistor will be very close to zero, but not quite. In fact, the voltage will be proportional to the amount of current flowing through it, but always a small and hard to detect amount. That's where the op amp comes in. It multiplies the small voltage present on the resistor and sends it to an ADC (analog to digital converter) on a microcontroller for reading. The microcontroller takes a voltage from 0-Vcc and converts it to a digital value between 0 and 255 (for an 8 bit conversion) or 0-1023 (for a 10 bit conversion). For this reason, to get a full scale reading requires some sort of scaling circuit (not pictured).

The point of scaling is to determine beforehand what the range of operation the watt meter must accept. The Kill A Watt model I have is rated for up to 15 amps, which is the max rating for the outlet anyway so it's probably enough for our design too. So, we tune the op amp circuit, by adjusting resistor values (a potentiometer works well for this) to enable a certain voltage sweep when reading appliance currents from 0 to 15 amps.

Power is equal to voltage times current, so in other words, watts = volts * amps. Now for many designers, 120 volts may suffice for the pre-programmed calculation for the microcontroller to use. Unfortunately, if more accuracy is needed a voltage sensor will also need to be used to measure the incoming voltage on the AC circuit. Voltage from the power company is not very precise and tends to experience slow fluctuations over the course of the day. When the voltage is lower, appliances will need to draw more current to get the same amount of power. If the watt meter doesn't know that the voltage has changed it will think that suddenly the appliance is more power hungry, which isn't actually the case. Now, one more problem, the main electricity in the home is AC, and about 60 Hz (but not exactly) , in the United States. For more precise calculations, one may even consider measuring the frequency on the line, against a high precision crystal oscillator or atomic clock!

Consider the fact that the voltage on the line is alternating like a sine wave. This means that at any given instantaneous moment, its voltage could be anything from 0 volts to the peak voltage of the sine wave. So why do we say it is 120 volts? It is because it is very convenient to think of AC voltage in terms of averages rather than instantaneous values. 120 volts is the average value of the sine wave of the electricity or its RMS value (root mean square). This means that the peak value is about 170 volts from 0 on the positive side and 170 volts from zero on the negative side. If you take 170 volts multiplied by the sqrt(2)/2, that would give you 120 volts! The difference in way AC current and consequently AC power can be measured may lead to some ambiguities. RMS is almost always implied if not explicitly mentioned.

Back to digital electronics... Before the AC voltage can be worked with, it must be converted to a lower DC form. Since DC cannot take on multiple ambiguous values, you must decide which measurement of the AC you're taking before converting to DC. If the RMS value is to be used, which is recommended, then the DC value converted from the AC will have to be proportional to the 120 volts RMS value. Of course, 120 volts is too high for any microcontroller to handle, so it will need to be scaled down to an appropriately low level. Also, once again, just as for the current readings, the designer must decide the tolerable range of voltage that the device can adjust to work with. One approach might be to accept any RMS voltages from 100 to 150 volts, this would work in all conceivable cases in the US for standard household 120 volt circuits. This 50 volt window (100-150 volts) must be converted to a microcontroller safe value of, for example, 0 to 3.3 volts. Assuming proportionality, using this scheme, the microcontroller would read a value on the ADC of about 1.32 volts when the original AC input was 120 volts. The microcontroller would then register this digitally as 410 (in a 10 bit system).

I'm skimming over many of the fine details, but that's the specifics that would make the design your own! This article is intended as a strategy for how to go about designing such a device. Anyway, a little more about the microcontroller, which is, after all, the brain of the system.

The microcontroller has to have at least two ADCs to make the current and voltage measurements. Internally, the microcontroller represents these readings as a digital value from between 0 and 1023 (for the 10 bit ADC). It's important to remember the conversion factors to convert these digital seemingly arbitrary values back to the voltages and amperages they represent. In my previous example, a reading of 410 resulted from a voltage of 120 volts so the conversion factor would simply be 0.292. Multiplying this factor by the digital value stored by the ADC will result in the actual voltage. The current measurement would likely have a different factor, but the same process would be used, and when the values are de-mystified, they would be multiplied together, at run-time, by the microcontroller, and the result would be the power (in watts) that the particular external appliance was consuming.

Now... the fun part. The power meter's job is to display this final piece of information (watts) in a human usable form. The end product may have button's which connect to the microcontroller's I/O pins and be programmed to change modes depending on which buttons are pressed. For my own design, I chose to output the information using a multiplexed multidigit LED display. But LCD, would have been a more energy conservative approach. Many microcontrollers, like the PIC18F2525, for example, have an internal EEPROM memory bank, which is non-volatile, and can be used to store periodic power usages over the course of a few days to help the user evaluate the long term power usages of their household devices. Data logging features are a must have for any serious power watt meter.


    0 of 8192 characters used
    Post Comment
    • profile image


      6 years ago

      What if I wanted to measure DC current and voltage and my load is a DC light bulb?

    • ckimani profile image


      8 years ago from Kenya

      thanks a lot am doing a project on obtaining the power of a load and this info of help

    • npolynomial profile imageAUTHOR


      8 years ago

      Hey Tim,

      In simple direct current circuits power would be equal to volts * amps.

      In a single phase AC circuit, one can measure the effective average voltage or current (which assuming a sinusoid wave) would involve measuring the peak instantaneous voltage (or current) and multiplying it by the (square root of 2 ) / 2, which would yield approx. 0.70711. Multiplying the peak by this, would yield the average value. The trick then with this circuit is to measure the instantaneous voltages and currents at a high enough sampling rate to determine accurate average values. By this method, whether the supply was sinusoidal, square wave, triangle, white noise, etc... the circuit will still accurately determine the total power transmission.

    • profile image


      8 years ago

      Er, last time I checked, P = V*I*powerfactor

    • profile image


      8 years ago

      Very good post, thank you!

    • profile image

      Final year project presentation 

      9 years ago

      I was lucky to find this hub , searching for a long time...thanks..


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)