cancel
Showing results for 
Search instead for 
Did you mean: 

Read voltage sensor ZMPT101B

LimitsBreaker
Visitor

My voltage sensor output shows 0v when actually the load is 222v. Please help me with the code logic.
My current sensor ACS712 30A works well, but voltage sensor ZMPT101B is not showing correct results

 

4 REPLIES 4
Andrew Neil
Super User

Welcome to the forum.

You need to supply some more details - please see How to write your question to maximize your chances to find a solution for best results; in particular

  • What STM32, and on what board?
  • Schematics showing how your sensors are connected 
  • Details of what debugging you've done so far

 


@LimitsBreaker wrote:

My current sensor ACS712 30A 


You mean this: https://www.allegromicro.com/en/products/sense/current-sensor-ics/zero-to-fifty-amp-integrated-conductor-sensor-ics/acs712 ?

 


@LimitsBreaker wrote:

voltage sensor ZMPT101B 


This: https://kunkune.co.uk/shop/arduino-sensors/ac-voltage-sensor-module-zmpt101b-240v/ ?

Have you tested that you are actually getting the expected signal from your sensor at the STM32's ADC input pin?

That page says that the output is, "Sine Wave Output: The module outputs a sine wave signal, with the waveform median being a DC component" - have you allowed for that?

It also says, "Supply Voltage: Operates efficiently within a range of 5-30V" - but STM32s are 3V. So how gave you allowed for that?

These show why we need to see your schematic!

Some good, clear photos could also help.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
LimitsBreaker
Visitor

I am using STM32F401CCU6 (Black pill development board)

I have attached the schematic diagram below.

The current sensor i am using is ACS712 30A, the datasheet link is here - ACS712 pdf, ACS712 Description, ACS712 Datasheet, ACS712 view ::: ALLDATASHEET :::

The voltage sensor is ZMPT101B, the datasheet link is here - ZMPT101B Datasheet(PDF) - Qingxian Zeming Langxi Electronic Devices

Yeah i am getting 1.25v adc input voltage in both the pins which is caused by the voltage divider scaling down 2.50v output to 1.25v i.e adc range(0-3.3v).

ACS712 30A gives 2.50V output at 0A which is the reference voltage, on load, it shows 2A on LCD screen when i connected an electronic appliance for testing which assures current sensor is working as expected.

But, I am not able to clear my doubt over the working logic of voltage sensor, it also gives 2.50V OUT at no load,
but on load also it shows output as 0V. Could you please help me with the logic issues.

 I will share the screenshots of debugging results shortly.


@LimitsBreaker wrote:

 I am not able to clear my doubt over the working logic of voltage sensor,.


You really need to do that before you can start coding anything!

The operation of the sensor has nothing to do with the STM32.

The sensor is not an ST product, so you'll need to go to the manufacturer for support with it.

 


@LimitsBreaker wrote:

it also gives 2.50V OUT at no load,


How, exactly, are you measuring that?

Again, the datasheet states that it is an Sinewave output - so not just a steady voltage.

You'll need a oscilloscope to see what it's giving ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

okay I will look into the working logic of the sensor.

I used a multimeter to test its out, Sorry I forgot about the sinewave output, looks like the output swings centered at 2.5v

Feature Description

Output waveformSine wave centered at VCC/2


Yeah, now I could understand, since stm32 adc cannot read negative values, the sensor output ac sine wave is scaled and shifted to swing around 2.5 which means 

For example:

  • 230V AC input → ~1.5V peak-to-peak waveform at output

Thanks for the clarification!

Please help me with another doubt, should I use continuous conversion mode for adc input sampling, or by simply using timer interrupt. Which one should I use for simultaneous sampling of two adc inputs.