Issues with Reading AC Voltage from Parallel Piezo Electric Elements

Hello everyone,

I'm facing some difficulties reading AC voltage from multiple piezoelectric elements connected in parallel. I'm using an Arduino MKR 1010 WiFi board and an LTC3588 energy-harvesting IC to extract energy from footsteps. My goal is to measure the AC voltage generated by the collective output of the negative and positive terminals of 100 piezo discs.

The problem I'm encountering is that I cannot obtain a stable reading of the piezo voltage. Despite connecting the piezo elements in parallel, the measurements fluctuate and lack consistency. I have attempted various methods to mitigate this issue but have not yet achieved the desired stability.

Currently, I'm measuring the DC voltage using a 100 Farad capacitor with a voltage rating of 16 volts. However, I plan to switch to a 3.7-volt, 850mAh battery for improved performance.

In my code, I have implemented the calculation of joules, milliamps, and coulombs. Here is the code I'm currently using:

#include <Arduino.h>
#include <WiFiNINA.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <ArduinoHttpClient.h>
#include "secrets.h"


const char* host = "api.thingspeak.com";
const char* apiKey = "API KEY"; // your ThingSpeak Write API Key

WiFiClient wifi;
HttpClient client = HttpClient(wifi, host, 80);

unsigned long counter = 0; // counter for the number of times data is sent
const int ledPin = 5; // LED connected to digital pin 5
void setup() {
  Serial.begin(115200);
  delay(2000); // Allow time for MKR WiFi to boot

  pinMode(ledPin, OUTPUT); // set the LED pin as output

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
        Serial.println("Connecting to WiFi...");
   digitalWrite(ledPin, HIGH); // turn on the LED
    delay(500); // wait for half a second
    digitalWrite(ledPin, LOW); // turn off the LED
    delay(500); // wait for half a second
  }

  digitalWrite(ledPin, HIGH); // turn on the LED when connected

  Serial.println("Connected to WiFi");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    digitalWrite(ledPin, HIGH); // turn on the LED when connected

    int capacitorPin = A0;   // Analog pin connected to measure voltage across the capacitor
    int piezoPin = A1;       // Analog pin connected to measure AC voltage from the piezo
    const int numReadings = 20;

    float totalCap = 0; // the running total for capacitor readings
    float totalPiezo = 0; // the running total for piezo readings
    // take numReadings readings and add them to the total
    for (int i = 0; i < numReadings; i++) {
      totalCap += analogRead(capacitorPin);
      totalPiezo += analogRead(piezoPin);
      delay(200); // short delay between readings
    }
    // calculate the average
    float capacitorVoltage = totalCap / numReadings * (5.0 / 1023.0);
    float piezoVoltage = totalPiezo / numReadings * (5.0 / 1023.0);

    float cap_value = 100;  // Capacitance value in Farads
    float resistor_value = 1000000; // Resistance value of the resistor in the voltage divider

    float energy = capacitorVoltage * capacitorVoltage * cap_value;
    float joules = energy * 3.6;
    float coulombs = energy / (3.6 * 1000.0);

    Serial.print("DC Voltage across capacitor: ");
    Serial.print(capacitorVoltage, 5);
    Serial.println(" V");

    Serial.print("Energy stored in the capacitor (Joules): ");
    Serial.print(joules, 5);
    Serial.println(" J");

    float current = capacitorVoltage / resistor_value;
    float milliamps = current * 1000;

    Serial.print("Current flowing through the resistor (milliamps): ");
    Serial.print(milliamps, 5);
    Serial.println(" mA");

    Serial.print("Charge stored in the capacitor (Coulombs): ");
    Serial.print(coulombs, 5);
    Serial.println(" C");

    // Add a buffer line for easier reading in the serial monitor
    Serial.println("---------------------------------------");

    Serial.print("AC Voltage from piezo: ");
    Serial.print(piezoVoltage, 5);
    Serial.println(" V");

    // Add a buffer line for easier reading in the serial monitor
    Serial.println("---------------------------------------");

    String url = String("/update?api_key=") + apiKey +
                 "&field1=" + String(capacitorVoltage, 5) +
                 "&field2=" + String(joules, 5) +
                 "&field3=" + String(milliamps, 5) +
                 "&field4=" + String(coulombs, 5) +
                 "&field5=" + String(piezoVoltage, 5);

    client.get(url);

    // read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String response = client.responseBody();

    Serial.print("Status code: ");
    Serial.println(statusCode);
    Serial.print("Response: ");
    Serial.println(response);

    counter++; // increment the counter
    Serial.print("Data sent to ThingSpeak ");
    Serial.print(counter);
    Serial.println(" times.");
  } else {
    digitalWrite(ledPin, LOW); // turn off the LED when not connected
  }

  delay(1000);
}

I would greatly appreciate any insights, suggestions, or advice regarding this problem. Has anyone encountered a similar issue when reading AC voltage from parallel piezoelectric elements? If so, how did you overcome it? I'm open to any recommendations, circuit modifications, or alternative approaches to help me achieve a stable and accurate AC voltage measurement.

Additionally, I'm considering purchasing a 30A Current Sensor Module and a Max 25V Voltage Sensor Module. These modules are designed for current and voltage measurements and may provide more accurate readings. Do you think it will help if I invest in these modules for my project? Has anyone used similar sensor modules with Arduino for measuring AC voltage in parallel piezo configurations?
You can find my project on GitHub, where I have shared more details: GitHub Link

Thank you in advance for your assistance.

piezo tiel connected in parallel with the LTC: image

Link to the Ltc 3588-1 - https://www.analog.com/media/en/technical-documentation/data-sheets/35881fc.pdf
link to the piezo that I bought - https://www.amazon.co.uk/gp/product/B0C68Q6N8B/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1
link to generic piezo datasheet - https://www.cuidevices.com/product/resource/ceb-27d44.pdf

Link to the Voltage Sensor Module - https://www.amazon.co.uk/gp/product/B09F6CT827/ref=ewc_pr_img_1?smid=A1SIE5VFG4T3WE&psc=1

Image of the tile that I made :

At first look, sounds strange.

Please a link to the datasheet of that sensor.
Please post schematics.

Can't be done without offsetting it to positive values.

Please post links to their datasheets

Please post information here. Digging down in projects is not accepted by all helpers.

1 Like

Do you connect the piezos directly in parallel?
And what about the piezoelectric effect? :thinking:

1 Like

Piezos do put-out voltage in both directions (AC) depending on which direction they are flexed.

In parallel (or series) they need to flex together in the same direction or they will add & subtract randomly.

You can't charge a capacitor with AC. If there is some bias (if it goes more positive than negative)or vice-versa) you could get some charge but it will be charging about half the time and discharging about half the time. You need a diode (or bridge rectifier) and a Schottky diode will have less voltage drop (loss) than a regular silicon diode.

Without a diode the piezo will "suck" power out of the capacitor when it returns to its original position or when it's flexed in the opposite direction.

If every piezo has it's own diode they can work efficiently in parallel.

[quote]
The problem I'm encountering is that I cannot obtain a stable reading of the piezo voltage.
[/quote]It's not "stable". It's not a battery or continuous generator. It can put-out a stable-continuous AC voltage if it's continuously flexed back-and-forth or continuously vibrated, but footsteps are not doing that. But an AC wave is continuously changing.

A meter gives a constant reading because it's showing RMS. The Arduino is sampling the voltage for an instant each time you read and AC will "look random". AC is positive half the time and negative half the time and the average is zero. RMS squares the values so the results aren't negative.

100 Farads or 100uF? It would probably take a year to charge a 100F capacitor with piezos!

Thanks for your comments. I added all the links for the datasheets and an image of the tile that I made.

It will never be stable. Just experiment with one piezo disk, until you understand what to expect.

Hey yeah, i connect all of them in Parallel with acrylic and copper foil so the tile of the piezo can be flexible. Thanks for your comment! I add the image of the tile.

Yeah, I agree, but Im trying to be able to identify if someone steps on it or not. and even that is quite difficult.
Adding the Link to my dashboard
https://thingspeak.com/channels/2201210

Piezos are a very poor choice for registering footsteps.

Hey yeah, you are defiantly right. I have a Bridge rectifier as part of the LTC 3588.
Do you think that 100 Farads isn't a good idea? What storage do you suggest? What if I add more than 100 piezo discs, which will sit on top of the existing ones 100 piezo?

I would say, never.
Large super capacitors have a very high internal leakage current.
Leo..

1 Like

I mean that due to the piezoelectric effect and being connected in parallel, when one (or several) piezos are compressed and generate a certain tension, the others will absorb part of that tension and will compress or expand.
Have you taken into account that "tiny" detail?

1 Like

Thanks, do you have another idea for storing the energy more efficiently?

Oh, I see what you mean. Yeah, I didn't bean aware of that. do you suggest approaching that in a different way?
Do you have any suggestions for harvesting the energy in the most efficient way?

Not really. :man_facepalming:t2:

1 Like

I assume you mean supercaps, because you said 100 Farad 16volt,
which is the size of a soda can, with a price of >$100 (if you want a good one).

Smaller supercaps leak less, so size the supercap to your needs.

Lipo batteries have relative low leakage, and are better suited to power an Arduino.
Leo..

One approach would be to measure the voltage or energy output of one piezo disk.

Assuming that the other 99 are stimulated in exactly the same way, each with the same output(*), multiply by 100.

(*) Check by picking a few other piezo disks at random, and repeat the single disk experiment with each one. Take an average for a better estimate.

In my experience, those piezo discs could be dropped onto their brass base randomly.
You must select them for polarity before soldering them in parallel.
They could be fighting each other, producing no power at all.

Do I see that you have shorted the white part to the brass base?
Leo..

Thanks for that. I plan to use the Adafruit BATT CHG SOLAR 3.7V/4.2V 1.5A https://www.digikey.co.uk/en/products/detail/adafruit-industries-llc/4755/13231325?utm_adgroup=&utm_source=google&utm_medium=cpc&utm_campaign=PMAX%20Shopping_Product_Higher%20Performing&utm_term=&productid=13231325&gclid=CjwKCAjwwb6lBhBJEiwAbuVUSiq7fTRFzYHBoKz2sJmt2_4c12ptkQK4364J9Ho3WT2wJNcy4lW-PxoChK8QAvD_BwE

And the Lipo battery :that one https://uk.rs-online.com/web/p/speciality-size-rechargeable-batteries/1449405?cm_mmc=UK-PLA-DS3A--google--CSS_UK_EN_Batteries_%26_Chargers_Whoop--Speciality+Size+Rechargeable+Batteries_Whoop+(2)--1449405&matchtype=&pla-333331382340&gclid=CjwKCAjwwb6lBhBJEiwAbuVUSvJx6YcnMSvoEninfqmccE1dz4r2Ie95iB6h4ebb_hTLzvwI6QBGJBoCazAQAvD_BwE&gclsrc=aw.ds

Thanks! I will check the amount of AC voltage each piezo produces on each press.
My objective in measuring the AC voltage produced by each piezo disk individually is to detect if someone steps on any of the disks. By analyzing the AC voltage input, I can count the number of steps and determine the amount of power generated within an hour.

I'm utilizing the LTC 3588-1, an energy-harvesting device, to achieve this. It captures and stores the energy internally until it reaches 3.3 volts, then transfers the power to the battery with an efficiency of 90%. The LTC 3588-1 can harvest both the negative and positive current.

Considering my intention to detect steps by measuring the AC voltage, do you have any suggestions for an alternative approach? I would appreciate any additional insights you can provide.