After successfully building the single-phase energy monitor with the ATM90E26 there has been lots of interest in the 3-phase version. Being an open-hardware project, many people have created remixed and derived versions as well. After a while I started receiving requests to assist with the code for ATM90E36, the 3-phase version of the Energy Monitor chip. However I did not have the hardware to test the code, so I put together this basic devkit to access the SPI bus and easily inject voltage and CT signals to take the ATM90E36 through its paces. This is the first board I have designed based purely on user demand rather than to scratch my own itch, since I don't have 3-phase supply at home.
Design station for Energy Monitor PCB
I ended up making a 12V AC targeted design like my single-phase version with stereo jacks on board for directly connecting current transformers. The test PCB also has few LED's to show energy pulses and is basically a low voltage version of the 3-phase 4-wire Atmel/Microchip reference design. I restricted the size of the PCB to 5x5 for hackvana's specials category. These can also be obtained from PCBs.io if you want to send some credits my way. The final touches to the design were put in my shed drawing power from my solar panels and marine battery during a now notorious Adelaide blackout.
Logic analyzer SPI protocol analysis
This chip uses the 16-bit SPI mode while most Arduino compatible CPU's only implement an 8-bit SPI mode, so bit of SPI sequencing was necessary to get the results. A cheap Saleae compatible logic analyzer went a long way to pinning down the protocol and getting the right values. You can see the protocol analysis fot the ATM90E36 in the logic analyser screenshot.
Test rig with Teensy and logic analyzer
The ATM90E32 and ATM90E36 share the same footprint you can choose either chip when building the board. The ATM90E36 has slightly more functionality including data dumping over DMA with the chip in SPI-master mode.The unused pins on the ATM90E32 can be grounded when using the board. My library for the ATM90E36 should work for the ATM90E32 as well with meaningless results for the CRC check code. I am re-writing the library specifically for the ATM90E32 while I design some featherwing hardware around it as well.
I took the whole thing for a test to the Hackerspace in Tonsley who graciously provided me a set-up involving a 3-phase variac, an isolation transformer and a 3-phase load bank with wire wound resistors. The test set-up can be seen in the video below. I actually managed to blow up the load bank by pushing 12V AC through a 2ohm load rated for only couple of amps, maths failure there. Just excited to be able to play with the 3-phase at an isolated low voltage. While the load ran it gave nice readings on the monitor which I had previously calibrated using a single phase at a time.
For the next test to have a safer and more controlled conditions I am trying out several DAC's to simulate Voltage and Current waveforms with relevant phase shifts. That is another blog post and project altogether.
I admit to being a tiny bit obsessed with monitoring utility bills and gathering data on my usage patterns blow-by-blow. The energy monitoring has reduced my electricity bills, so I wanted to have a go at the water usage. Granted a lot of the water bill is fixed supply costs and sewerage charges which I can't do much about.
DS1682 Grove Breakout
A while ago I made some pulse counting breakouts with the DS1682+ RTC. I have finally got a chance to put them to good use interfacing with my mechanical water meter. The water meter has a spinning permanent magnet and in principle this can trigger a reed switch and generate pulses for accumulation by the RTC.
My collection of Sparkfun ESP8266 boards
As a processor board I am using the Sparkfun Blynk development board. It not only has an i2c port, but also sports a well placed pad to solder the deepsleep enabling resistor between GPIO16 and Reset pins. You can see this connection illustrated with a Nodemcu below. The deepsleep is super important in this battery operated set-up to conserve power. The DS1682+ RTC consumes uA's in standby mode and in deepsleep the ESP8266 power consumption comes down to similar levels. The duty cycle is pretty low. The ESP8266 wakes up for around 10s every 5minutes to do a registration onto my WiFi guest network, DHCP itself an IP, perform a DNS look-up of my custom Blynk server and send a custom message with RTC count. More details on the code here.
NodeMCU deepsleep hack
Since the unit will be operating outside without proximity to power for extended periods of time I wanted to make it solar powered. So I scavenged some solar cell + lipo packs I had acquired a while ago at the markets in Salmanca and did not quite live up to the task of powering a phone and had horrible soldering on the switches and USB connectors which had all but broken off. Surprisingly the lipo still had charge and the solar cell did an okay job keeping it topped up. It actually has a nice lipo charger circuit which deals with the variable output from the solar cell without too much fuss, and a boost converter to supply 5V for phone charging. I by-passed the boost for added effciency and soldered directly to the lipo, and the USB connector for the boost port was broken anyway.
El-cheapo solar
Battery charging and 5V boost
Solar panel as substrate
To count pulses I made up a probe with a simple reed switch from Jaycar encapsulated in a bit of heat shrink. Putting some hot-glue on it before heat shrinking makes a nice weather tight sealed probe which slots into the meter. Proper ones pre-sealed in weather proof ABS cost similar amount on eBay and I have ordered a couple on slow-boat from HongKong.
Hacked up magnetic pulse counter with reed-switch
Water meter pulse counter install
The host the data and visualise the water usage I wanted to try something new. So I decided to give setting up a custom Blynk server a go. I have plenty of experience with AWS, so I spun it up on a t2.nano instance for a trial and IP locked it to my home IP. The blynk app on Android can authenticate against this instance of Blynk server and push applications and fetch data. Since I have this tiny server all to myself I can choose very high frequency updates or very low in this case.
Blynk time series of water usage
Data shows up on the Blynk app as a time series without any hitch and I can clearly spot the 3 family showers and a dish washing session, with me being guilty of the longest shower. Oh well, at least we have a baseline to improve on. The only remaining concern is that the meter reader considers that I am tampering with the meter like this guy who hid a magnet in a wheelie bin, better contact SA Water proactively and plead my innocence. This might also have other uses such as leak detection in farms.