# Measuring current with ESP32 and Seeed board

1. ## Measuring current with ESP32 and Seeed board

Hello!

I have a project where I have to reads the current of a compressor. It has a nominal current of 4,5A and the maximum of the board is 5A:
https://www.seeedstudio.com/Grove-El...sor-p-777.html

My doubt is when the compressor kicks in, the inrush current can burn the input of the ESP32?

Is there a way to prevent it?

2. ## Re: Measuring current with ESP32 and Seeed board

It says right there : maximum current, 5 amps. What’s your question?

If you exceed the PLAINLY STATED manufacturer’s spec, you’re on your own. Maybe it will be ok, maybe it won’t. You don’t even state your inrush; 5.1 A? 1000 A? 1 microsecond? 100 ms?

•

3. ## Re: Measuring current with ESP32 and Seeed board

Sorry, perhaps I was misinterpreted! I was referring that the inrush current will induce a voltage greater than 3,3V at the input of the ESP32. I’m afraid of burning the microcontroller.
I know that it is rated for 5A as nominal current, and I will have a current greater than 5A on the current transformer, but it will be for 100ms, in theory, because it is a 3-phases compressor. So, I will have a voltage greater than 3,3V (7x greater) in the input of the ESP32.

•

4. ## Re: Measuring current with ESP32 and Seeed board

Your attachment tells us nothing, other than the physical dimensions of the transformer and that there are a 330 and 470 ohm resistors on the secondary. What's the current transfer ratio?

If what you say is true, that you'll have 23 volts on the input of your ESP32, I'd be VERY concerned.

•

5. ## Re: Measuring current with ESP32 and Seeed board

Yes, I'm concern. But at the moment I cannot know the voltage spike that will occur. Perhaps a zener+resitor in parallel will avoid the voltage go above 3,3V?
Perhaps, I will change my question to: What I can do to avoid the input going above 3,3V on the ESP32?
The datasheet that I sent is the one that the seeed has available. I know it uses the TA12-200 current transformer.

6. ## Re: Measuring current with ESP32 and Seeed board

Why a resistor in parallel? That will just change the voltage scaling.

7. ## Re: Measuring current with ESP32 and Seeed board

If I understand the original post - the MEASUREMENT is for the load current range up to about 5A but the load may have a brief surge much higher than that and you don't want the surge measurement to exceed that of 5A.
If I'm right, you have two options:
1. increase the attenuation so the surge voltage does not exceed 3.3V, which will also decrease the available range in normal operation
2. arrange the attenuation so it can measure 4.5A at near full scale so you get best accuracy but also clamp the input voltage so it doesn't exceed 3.3V.

The clamp can be a simple Zener 3.3V diode but beware of it's dynamic resistance allowing too much voltage if the surge pushes too much current through it. I think as a fairly sharp cut-off voltage is needed, an active Zener clamp might be the simplest solution. An NPN transistor with a 2.7V Zener diode between base and collector and a 100K resistor between base and emitter will give a 2.7V +Vbe = 3.3V clamping and a lower dynamic resistance than a Zener alone.

Brian.

8. ## Re: Measuring current with ESP32 and Seeed board

Taking in consideration the comments I have layout a a circuit. That will give a 3,3V protection of the input? What should be the wattage of each device? And whats the best option of the NPN transistor?

•

9. ## Re: Measuring current with ESP32 and Seeed board

I think you probably want full scale reading to be 3.3V, not 5V as you will not be able to measure greater than 3.3V anyway. However, a more fundamental problem is the voltage from the transformer is is AC and the ESP32 can't measure below 0V. You should consider converting it to DC first or else raising the zero crossing voltage to 3.3/2 = 1.65V so the peaks fall between 0V and 3.3V and doing an AC analysis from multiple ADC measurements.

Brian.

--[[ ]]--