Sunday, April 30, 2017

Building a Custom Strain Gauge with Electric Paint

In this video we look at how we can use Bare Conductive's Electric Paint to create a custom strain gauge.




/*
 * This code was written for a video on the ForceTronics YouTube channel. This code is public domain and can be used and modified by anybody at your own risk
 */

#include <Average.h> //Call average library

void setup() {
  Serial.begin(57600);
  analogReadResolution(12); //Set Arduino Zero ADC to 12 bits
  for(int i=0;i<4;i++) analogRead(A0); //burn a couple readings since we changed ADC setting
  Average<int> ave(10);
}

void loop() {
  delay(100);
  Average<int> ave(10); //Create average object
  for (int i=0; i<10;i++) ave.push(analogRead(A0) - 2700); //get 10 readings and subtract most of the value off to look at small changes
  Serial.println(ave.mean()); //average the 10 readings together
}

No comments:

Post a Comment