Logger Device Tracks Amp Hours (Part 1)

Measuring Home Electricity

Setting out to monitor and log electricity usage in his house, Bill built an amp-hour
logger using a microcontroller and a clamp-on ammeter. He gets into the software
development details exploring solutions like mbed and Microsoft Visual Studio.

By William Wachsmann

Like many people I found that electricity costs have been increasing rapidly over the past few years. Where I live, we have smart meters that allow the power company to charge different rates for high usage, moderate usage and low usage times of the day. The bills show how much energy is used during the different periods but only for the dwelling as a whole.

For this project, I used an NXP-Freescale FRDM-KL25Z microcontroller board.

For this project, I used an NXP-Freescale FRDM-KL25Z microcontroller board.

I wanted to know which parts of my house use how much electricity and at what times of the day. With this information, I would be able to see what parts of the house are using how much energy, and I’d even be able to calculate how much it’s costing to run certain appliances. I could then look into the feasibility of supplementing my energy supply with solar or wind, or maybe use a battery storage system that is charged in the less expensive hours for use during peak periods. Or perhaps even some combination of all three.


To measure AC current, you normally use a “Clamp on Ammeter” on either the live or neutral wire in the circuit of interest. These ammeters are readily available but they will only tell you the current at the particular point in time that you are using it. What I needed was one that I could leave connected over a 24-hour period and get a log of the current usage throughout the day and night. If such a device exists, I was unable to find one, so I needed to make my own.

The device would have to monitor currents in 120 V and 240 V AC circuits and be reasonably accurate over a range of 200 mA to 30 A. The price we pay for electricity is based on kilowatt-hours (kW-h) multiplied by the rate— usually specified in cents-per-kWh. In my case, in the fall of 2016 we were paying an average of about $ 0.27 / kWh after all extra charges such as delivery and taxes were included.

Using the data from the amp-hour logger would allow calculation of the number of kWh used in each circuit of my house. Since kWh is a measure of energy I also needed to know what the voltage is at the time that the current is being measured. Then, given that P = VI, I would get a measure of the power being used at a given time. Integrating this over a period of time gives me the energy in watt-hours or—dividing by 1,000—in kWh.

To be really accurate, I should measure the voltage as well as the current but I have found that whenever I check the voltage it is pretty constant at 120 V (+ or – a couple of volts). Therefore, using a nominal value of 120 V (or 240 V for some circuits) should be accurate enough for my purposes. If the amp-hour logger is designed to save current measurements for each minute, that should give a pretty good indication of load changes in the circuit that is being monitored. Also, just adding up the amp-hour/minute readings effectively integrates them and provides the total amp-hours used over a 24-hour period. Multiply this by the voltage and divide by 1,000 and I’ll get the number of kWh used in a day. Great. That’s the theory. Now to make something that will work.

Read the full article in the October 327 issue of Circuit Cellar

We’ve made the October 2017 issue of Circuit Cellar available as a sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.
Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!

NXP to Make Security Chips in its US Facilities

NXP Semiconductors has announced a $22 million dollar program that expands its operations in the United States, enabling the Company’s US facilities to manufacture security chips for government applications that can support critical US national and homeland security programs. Upon completion of the expansion project, NXP facilities in Austin, TX and Chandler, AZ will be certified to manufacture finished products that exceed the highest domestic and international security and quality standards.


NXP R&D manufacturing facilities in San Jose, Austin and Chandler have also undergone a thorough security site certification process to produce Common Criteria EAL6+ SmartMX microcontroller family products. Common Criteria is an international set of guidelines and specifications developed for evaluating information security products to ensure they meet a rigorous security standard for government deployments.

NXP’s SmartMX microcontroller platform is designed for highly secure and fast data transactions. It is ,a proven solution for contact, contactless and dual interface applications. with over six billion ICs deployed in the field. It secures transactions for over one-third of chip-based payment cards in circulation, serving banks all over the world.

More SmartMX info:

  • It serves as the core component in a variety of digital identity schemes and is deployed in nearly 120 out of 145 countries implementing e-Government programs.
  • Used in many sovereign electronic documents such as ePassports, citizen cards, national ID cards, driving licenses, social security cards and health cards.
  • SmartMX is the 6th generation in the market, with NXP holding the most security certificates in the industry.
  • It is the preferred technology for the secure element of NFC-enabled phones.


NXP Semiconductors | www.nxp.com

NXP and Widex Team for Wireless Audio Streaming Hearing Aids

NXP Semiconductors and Widex announced that they have collaborated to develop, test and integrate NXP’s NxH2003 Bluetooth Low Energy (BLE) audio streaming SoC into Widex BEYOND hearing aids. The two companies worked closely together throughout the product development cycle, merging the best of hearing aid engineering and wireless audio streaming semiconductor technology, to deliver hearing aid devices that can stream wireless audio from an iOS device, consuming only 2.8 mA current at 1.2 Volts, which is best in industry. This allows end users to enjoy music directly from their personal devices for prolonged periods of time.


NXP’s state-of-the-art BLE 4.1 certified solution measures only 7.25mm2 and has industry-lowest receive and transmit power levels of 4mW and 7mW respectively. The NxH2003 forms a total solution for ultra-low power wireless audio streaming as it embeds both an M0 microcontroller (running the protocol stack and application), as well as an embedded CoolFlux DSP (running all of the required audio processing including sample rate conversion and audio [de]compression). Furthermore, this advanced IC is highly integrated and can run directly from a Zinc-Air battery as typically used in hearing aids, which minimizes the number of external components and consequently reduces the volume of the end product.

Technologies and solutions for hearing aids and consumer hearables are converging as both markets share closely related use cases while at the same time facing similar end-user requirements and technology barriers. Both markets strive to design smaller and more comfortable end devices exhibiting longer battery life. Additionally, both hearing aid and consumer hearables companies recognize that users desire more functionality from their devices, ranging from the ability to sync with their phones, for calls, music, and games to biometric measurements for health monitoring.

NXP offers solutions for both markets. NXP has been providing proprietary NFMI (Near Field Magnetic Induction) technology to the hearing instrument industry for nearly a decade. And at CES earlier this year, the company debuted its NFMI-based MiGLO solutions with several OEMs in smart consumer hearables. The NXP MiGLO platform is designed to enable long battery life, exceptional audio quality and reliable wireless experiences while enabling the development of smarter, smaller and comfortable truly wireless earbuds or hearables.

NXP Semiconductors | www.nxp.com

Innovative Tech at Embedded World 2016

Attendance at the recent Embedded World 2016 conference in Nuremberg, Germany, increased 17% (30,063 trade visitors) over 2015. Wisse Hettinga was in attendance and took notes on some of the more interesting technologies on display. He writes:

Controllino: Open-Source PLC

Say “ino” and most engineers and electronics enthusiasts will think, “Arduino.” That also goes for “Controllino,” which is a programmable logic controller (PLC) based on Arduino hardware and software. Marco Riedesser started developing this new product after he repaired a coffee machine with parts he designed. His Controllino is intended for the new generation of automation experts who grew up with the Arduino platform. The Controllino is 100% compatible with the Arduino platform and makes use of the SDK. And, perhaps most importantly, it is an open development system. For more information, visit https://controllino.biz/controllino


NXP Semiconductors knows that innovative new technologies don’t appearing out of the blue, which is why it created the Hexiwear wearable development platform. Along with MikroElektronika, NXP is promoting this new piece of hardware to the design community via a Kickstarter campaign. hexiwear

Due to its compact design, you can use the Hexiwear as a watch or, if you need more functionality, you can click it onto the developer’s main board. The open-source Hexiwear’s features and specs include:

  • NXP Kinetis K64 MCU (ARM Cortex-M4, 120 MHz, 1M Flash, 256K SRAM)
  • BLE NXP Kinetis KW40Z multimode radio SoC (ARM Cortex-M0+, Bluetooth Low Energy & 802.15.4 Wireless MCU)
  • NXP FXOS8700CQ 3-D accelerometer and 3-D magnetometer
  • NXP FXAS21002 three-axis digital gyroscope
  • NXP MPL3115A2R1 absolute digital pressure sensor
  • NXP MC34671 600-mA, single-cell li-ion/li-polymer battery charger
  • TAOS TSL2561 light-to-digital converter
  • MEAS HTU21D digital humidity and temperature sensor
  • Maxim MAX3010x heart-rate sensor
  • Haptic feedback engine
  • 190-mAh 2C li-po battery
  • Capacitive touch interface
  • 1.1″ full color OLED display
  • 8 MB of additional flash memory

Intel Edison, What Did You Make?

When the Edison board was launched in 2014, it drew quite some attention from the community of makers. The board was heavy specified, wearable, and IoT ready. It allowed quick prototyping and the close connections with the Arduino world promised a smooth introduction into the world of designers and entrepreneurs with great ideas for the future. The module also came with seriously high price tag.edison

In the first months after the launch, there was a lot of interest. Some projects made it to the headlines, but things eventually quieted down around the platform. Was it the price, or was it the fact that the world of the x86 is different from the world of AVR or ARM? Or perhaps you need Linux knowledge to dig deeper into the system?

Embedded World 2016 in Nuremberg was a good opportunity to learn about the board’s status. According to Intel’s Ken Caviasca (VP in the IoT Group and GM of platform engineering and development), it is clear that Intel is still serious about addressing the makers community with the Edison module. A new board was announced on the Intel Developers Conference and the initiative is alive and well. Intel’s main objective for the Edison board is to get designers involved and to pick up new interest in the x86. Caviasca  confirmed that the Edison project is on target and many makers are using the platform for their designs. With a confident Intel about the future of  Edison, a big question remains: What will you make with it?

µTrace Supports New LPC54100 Series Microcontrollers

Lauterbach has announced its support for the new NXP Semiconductors LPC54100 Series of microcontrollers. NXP recently introduced its LPC54100 series, which achieves industry leading power efficiency and is ideally suited for “always-on” sensor-based products.utrace nxp lpc54100 series microcontrollers

Lauterbach has supported the LPC54100 Series of microcontrollers since the beginning with µTrace, a proven and popular debug and trace tool for Cortex-M-based processors. The tool uses USB 3.0 for connection to the host and connects to the LPC54100 via Serial Wire Debug (SWD) interface. The developer can control the operation of the program and analyze the data in C and C++ by the use of simple and complex breakpoints. An analog probe can be connected to µTrace to read the current and voltage measurements for energy profiling, which enables developers to fine-tune their software for minimal power usage.

The LPC54100 Series features an asymmetric dual-core architecture to enable scalable active power and performance by using a Cortex-M0+ and a Cortex-M4F for different sensor-processing tasks to optimize power efficiency. µTrace fully supports this type of asymmetric multicore processing (AMP) debugging by starting an individual TRACE32 instance for each core.

Source: Lauterbach

NXP LPC800 Microcontroller Challenge

Attention microcontroller users around the world! Ready to enter NXP Semiconductor’s LPC800 Challenge? Getting started is straightforward.

Elektor and Circuit Cellar have partnered with NXP Semiconductors to promote the Challenge. Once you have your LPC800 mini-board and code, you simply register and start working. The rules and complete details are listed on the LPC800 Challenge webpage.

The entry deadline is August 30, 2013. Once all the entries are received, NXP will select the most unique, interesting and funny submissions to receive a LPC800 LPCXpresso development kit.

The LPC800 is an ARM Cortex-M0+-based, 32-bit microcontroller operating at CPU frequencies of up to 30 MHz. The LPC800 supports up to 16 KB of flash memory and 4 KB of SRAM. The peripheral complement of the LPC800 includes a CRC engine, one I2C-bus interface, three USARTs, two SPI interfaces, one multi-purpose, state-configurable timer, one comparator, function-configurable I/O ports through a switch matrix, and up to 18 general purpose I/O pins.

Need design ideas? Check out these microcontroller projects with NXP parts.

Build a CNC Panel Cutter Controller

Want a CNC panel cutter and controller for your lab, hackspace, or workspace? James Koehler of Canada built an NXP Semiconductors mbed-based system to control a three-axis milling machine, which he uses to cut panels for electronic equipment. You can customize one yourself.

Panel Cutter Controller (Source: James Koehler)

According to Koehler:

Modern electronic equipment often requires front panels with large cut-outs for LCD’s, for meters and, in general, openings more complicated than can be made with a drill. It is tedious to do this by hand and difficult to achieve a nice finished appearance. This controller allows it to be done simply, quickly and to be replicated exactly.

Koehler’s design is an interesting alternative to a PC program. The self-contained controller enables him to run a milling machine either manually or automatically (following a script) without having to clutter his workspace with a PC. It’s both effective and space-saving!

The Controller Setup (Source: James Koehler)

How does it work? The design controls three stepping motors.

The Complete System (Source: James Koehler)

Inside the controller are a power supply and a PCB, which carries the NXP mbed module plus the necessary interface circuitry and a socket for an SD card.

The Controller (Source: James Koehler)

Koehler explains:

In use, a piece of material for the panel is clamped onto the milling machine table and the cutting tool is moved to a starting position using the rotary encoders. Then the controller is switched to its ‘automatic’ mode and a script on the SD card is then followed to cut the panel. A very simple ‘language’ is used for the script; to go to any particular (x, y) position, to lift the cutting tool, to lower the cutting tool, to cut a rectangle of any dimension and to cut a circle of any dimension, etc. More complex instructions sequences such as those needed to cut the rectangular opening plus four mounting holes for a LCD are just combinations, called macros, of those simple instructions; every new device (meter mounting holes, LCD mounts, etc.) will have its own macro. The complete script for a particular panel can be any combination of simple commands plus macros. The milling machine, a Taig ‘micro mill’, with stepping motors is shown in Figure 2. In its ‘manual’ mode, the system can be used as a conventional three axis mill controlled via the rotary encoders. The absolute position of the cutting tool is displayed in units of either inches, mm or thousandths of an inch.

Click here to read Koehler’s project abstract. Click here to read his complete documentation PDF, which includes block diagrams, schematics, and more.

This project won Third Place in the 2010 NXP mbed Design Challenge and is posted as per the terms of the Challenge.



Radiant Floor Heating Zone Controller Project

Even if you aren’t interested in designing a radiant floor zoned heating system, you can study this innovative project and apply what you learn to any number of building control and automation applications. Dalibor Zaric’s Radiant Floor Heating Zone Controller is built around an NXP Semiconductors LPC2134 ARM processor that’s connected to an Echelon Pyxos chip. The project won Second Place in Echelon’s 2007 “Control Without Limits” design competition.

The heat zone controller system (Source: Echelon & Dalibor Zaric)

Zaric provides the following details in his project documentation:

“• Power supply to unit is 24VAC and controller has switching power supply to provide 24VDC for Pyxos network as well 5V for logic, there is 3.3V linear regulator as well.

• There are four relay with 24VAC output to power up thermoelectric zone valve on radiant floor heating manifold. These outputs are protected with 1.85A self resetting fuse to prevent overloading. This block has as well 24VAC/DC dry contact to provide a call for heat to boiler or optional zones pump.

• Pyxos power supply filter and Pyxos chip provides Pyxos network connection for future sensors and thermostats. Pyxos thermostat will be more cost effective than regular LONWorks sensors/thermostats.

• RS-485 driver will provide future Modbus connection for local touch screens or smart home systems with Modbus connections. There is end of line resistors enabled with the dip switches beside connector.

• 3150 Neuron board with 64K flash provides LONWorks connection to the controller.”


The heat zone controller diagram (Source: Echelon & Dalibor Zaric)

For more information about Pyxos technology, visit www.echelon.com.

This winning project, as well as others, was promoted by Circuit Cellar based on a 2007 agreement with Echelon.