Big Changes to ESP32 effort

Over the summer, what with the rainy New England weather this year, I spent quite a bit of time on the ESP82 prototype. Those that follow this blog know that I’ve been teasing an ESP32 version for a couple of years now, and although I have had a pretty good working prototype for about that long, several developments caused me to question major parts of it.

It all started when I could no longer get the AC reference transformers that I’ve been selling for a couple of years. That, coupled with all the ZMPT101B craze in the IOT world, and a little inspiration from recently release OEM power supply that uses it, got me to evaluating the feasibility of integrating one or three of them directly into the IoTaWatt PCB.

Unfortunately, I could not get the thing to work as accurately as I would like across a wide voltage spectrum (100V-277V). While the ratio of input current to output current is fairly steady, my experience is that the power consumed by the sample resister shown up as additional source current, and so the calibration is not a simple gain+offset calculation. Moreover, I found unacceptable variance between the ten samples that I got.

After spending quite a lot of time on redesigning the sampler to use three onboard voltage sensors, I could not revert to a simpler design. So, I started to look for something better. I believe I found it.

Texas Instruments has a new chip, the AMC131M03. This chip provides reinforced isolation of the analog side and sports three 24 bit Sigma-Delta ADCs. Moreover, it will sample all three voltages simultaneously and continuously. The chip is a variation of the ADS131Mnn family of 24 bit Sigma-Delta ADC chips that can have up to 8 simultaneous differential inputs.

So a few weeks ago, I got some evaluation kits for these things. I find that I can sample voltage directly with about 0.1% accuracy. On the current side, the ADS132Mnn chip takes a differential input from the CTs, obviating the need for any bias voltage and completely isolating each CT from the others.

All of the ADCs would sample at the same time (Oh, except for slight timing offsets to compensate for CT phase shift), and the ESP32 appears fast enough to read the voltages and as many as 32 CT inputs at 16K samples/second. Very exciting.

These chips are pretty much designed for use in high accuracy electric meters. Cost is higher than the MCP3208 ADCs used in the old design, and more are needed, but it’s not prohibitive given the accuracy possible.

While I was at it, I have upgraded from using the ESP32 WROVER to the newer ESP32S3 which offers a lot more resources. I believe Ethernet will be possible as well.

All of the back-end improvements remain the same with the datalog, web-server, and query subsystems. With the continuous sampling, one second resolution data should be highly accurate and so possibly an MQTT stream will be added.

With much reduced time spent selling the 8266 units, I’m really enjoying getting back to R&D. I’ll post more as I get these ADCs working in the prototype.

16 Likes

Sounds like some very promising enhancements! Thank you for sharing the update. Looking forward to seeing some comparison data between the existing ESP8266 platform and this new ESP32 based solution.

1 Like

This sounds exciting!! Thanks for the effort Bob - we are all looking forward to you reaching a point where we would be able to use it as well!

1 Like

Project update.

Have been working hard at getting a proof of concept working. Have integrated the new ADC evaluation boards with an ESP32-S3 Devkit and have sampling with three input voltages and four current inputs.

The ADCs run continuously producing a set of synchronized samples for all three voltages and all input channels 16,000 times per second. One of the ESP32 processors is dedicated to reading and processing the ADC data and passing a summary to a post processing task running at a high priority on the other CPU.

Here’s a pic of the setup. The ESP32 Devkit and SDcard are on the main breadboard. The two green PCBs are the ADC evaluation boards.

You can see the logic analyzer probes. That tool was critical not only to get it working, but is providing invaluable information to optimize timing of the sampling processor and determine capacity with respect to sample rate and ADC resolution.

Here’s a snapshot of 500 microseconds in the life of the sampling CPU that shows about 6 sets of samples being collected from the two ADCs. A new set comes available every 62.5 usec. The orange trace shows the SPI clock as it reads each of the two ADCs. You can see that there isn’t a whole lot of time remaining and it may not be possible to sustain 32 channels (4 x 8 channel ADCs) at this sample rate. I’m reasonably confident it will be able to do 24 channels (3 x 8 channel ADCs). Development on that is ongoing.

Next week I intend to start investigating connecting SPI based Ethernet. Should know pretty soon if that’s going to work.

Next will come laying out a PCB.

10 Likes

Congrats!

Will be really nice to see such a device running on ethernet and being able to communicate through mqtt as well.

I know this has been something you have said is a non starter, so I am very happy to see it may now be an option. Would this open up the option of POE? So much easier to deploy if possible, but I do have one electrical panel that would still need to be wireless.

Keep up the amazing work! I cant wait to see a working ESP32 version 24 channels would also be great.

Is this the right place to let you know what I feel would be really cool improvements?

  1. if it gets an ethernet port, POE
  2. More CT inputs. For instance in our main distribution cabinet (right english name?) I need like 34 CTs.
  3. possibillity to use mV instead of mA input (for instance Rogowski coils. I have a few places where I cannot use CTs due to space constraints). As far as I am aware that is already possible, but soldering required (und thus loss ov CE and everything). It would be really great if input can be switched for each channel by setting a jumper.

But still, the iotawatt is a great product!

POE is really moot. The new unit connects directly to the L1 and optionally L2 and L3, providing both power and voltage reference. The voltage reference is a requirement and the DC power comes free with that.

Right now shooting for 32 (16 + 16 add on), but still not sure there is enough bandwidth to sample that many. There are some subtle issues that create worse case scenarios.

That is possible, but even adding jumpers on each input increases cost and complexity. At present, thinking of a DIY kit anyway with no CE or UL, so it could be an assembly option.

2 Likes

That is even better.
Then maybe add DIN-Rail mountable?

Is there already a timeframe when you think new units will be available?
I am currently considering buying 25 iotawatts (industry, not for private use), however I could still wait a bit.

1 Like