Arduino Car Paint Thickness Indicator - Meter

 A very useful device especially when buying a car to check suspicious areas where auto putty has been applied under the paint.

 A paint thickness indicator is useful in industries like automotive, aerospace, marine, and construction where precise coating thickness is crucial for quality control and performance. It measure the thickness of paint or coatings on a metal surface. We can use this property, for example, when buying a car, where we can check if the car has a putty hidden under the paint. 

In the following, I will present you a very simple way to make such a device using an Arduino microcontroller board. The indicator will show the relative thickness of the measured paint layer in relation to the spot with the original layer. The device also detects whether the substrate is steel or aluminum.

  This project is sponsored by PCBWay. They has all the services you need to create your project at the best price, whether is a scool project, or complex professional project. On PCBWay you can share your experiences, or get inspiration for your next project. They also provide completed Surface mount SMT PCB assemblY service at a best price, and ISO9001 quality control. Visit pcbway.com for more services.

  As I mentioned before, the device is very simple to make and consists of only a few components:
  - Arduino Nano microcontroller board
  - LCD Dispaly 128x64 dots with ST7565 driver chip
  - three resistors, capacitor and diode
  - two buttons (specifically I use capacitive touch buttons, but you can use standard mechanical buttons without any change in the code)
 

 - and sensor coil (This is a coil taken from an old electromagnetic relay, in this particular case with an ohmic resistance of about 500 ohms, but any coil with similar characteristics can be used)

 The measurement is performed in such a way that first a rectangular signal is generated at the D2 output of the Arduino, which is then fed to a voltage divider composed of a constant resistor and an inductive reactance, which in this case is a relay coil. Bringing the coil closer to a metal object changes its inductive reactance, thereby changing the voltage at the output of the divider. This voltage, after diode rectification, is measured by the Arduino analog input.
 The procedure for measuring the relative thickness of paint is as follows:
 1. First put the coil to a place on the surface where you are sure that the paint is original.
 2. press the "Calibration" button. Now this value is taken as a reference against which the thickness of the suspicious areas will be measured.
 3. now, place the coil on the "suspicious" place,
 4. and press the "Measurement" button.
 And now let's see how the device works: Immediately after switching on, the "Ready" screen appears on the display. 
 

During the measurements I will use pieces of metal on which I will simulate paint and putty of different thicknesses, because at the moment I do not have the conditions to make the measurements on a real car.

 As you can see, the device perfectly detects the type of surface (iron or aluminum) and for the thickness of the paint it shows a relative number that does not correspond to the real thickness in a given measurement unit, but still gives us a idea of the thickness of the deposit. With small adjustments in the code we can change the ratio between the actual thickness and the displayed relative number, which would also increase the accuracy.
 And finally a short conclusion. Although relatively simple to make, this is a very useful device especially when buying a car to check suspicious areas where auto putty has been applied under the paint. The device is embedded in a suitable box made of PVC board and lined with colored self-adhesive wallpaper.

 

 

CODE
#include <U8g2lib.h>

//U8G2_ST7565_NHD_C12864_1_4W_SW_SPI u8g2(U8G2_R0, 11, 8, 13, 12, U8X8_PIN_NONE);
//U8G2_ST7565_NHD_C12864_1_4W_SW_SPI u8g2(U8G2_R0, 13, 11, 10, 9, U8X8_PIN_NONE);
U8G2_ST7565_ERC12864_1_4W_SW_SPI u8g2 ( U8G2_R0, /* scl=*/  13 , /* si=*/  11 , /* cs=*/  10 , /* rs=*/  9 , /* rse=*/  8 ) ;
int dystans;
char dystans_str[4];
char* rp;
int d1;
int a, b ;
byte outPin = 2;                      // output 800 Hz
byte inPin1 = 6;                      // sw-1 calibration
byte inPin2 = 7;                      // sw-2 measurement

int roznica; 
long srednia;
long sredniaP;
const byte dt = 10;                   //amount of data for the average "idle speed" difference
const byte dt_P = 10;                  //amount of data for the average measurement difference
int sred_wi;

void setup() {
  u8g2.begin(); 
  u8g2.setContrast(40);
  Serial.begin(9600);
  pinMode(inPin1, INPUT_PULLUP);      //setting the pin as a digital input
  pinMode(inPin2, INPUT_PULLUP);  
  //pinMode(13, OUTPUT);         
 // digitalWrite (13, LOW);             //wlaczenie podswietlenia LCD
//  pinMode(8, OUTPUT);               
//  digitalWrite (8, LOW);              //providing ground to power the LCD
  tone(outPin, 800);                  //feeding to the square wave divider
}

void loop() {
   Dipsw();
   sprintf(dystans_str,"%d", abs(d1));
   Display();

}

void Display(){
  if (sred_wi == 0) {rp = "   READY";}
  u8g2.firstPage();
  do {

  u8g2.drawFrame(0,0,128,64);  
  u8g2.drawRFrame(2,2,124,60,3);
    
     u8g2.setFont(u8g2_font_helvB08_tr);
     u8g2.drawStr(30,15,rp); 
     u8g2.setFont(u8g2_font_logisoso24_tn);
     u8g2.drawStr(30,50,dystans_str);
     u8g2.setFont(u8g2_font_helvB12_tf);
     //u8g2.drawStr(85,49,","); 
     //u8g2.drawStr(85,50,"um"); 
     if (d1 < 0) {u8g2.drawStr(85,50,"Fe");}
     if (d1 > 0) {u8g2.drawStr(85,50,"Al");}
  } while ( u8g2.nextPage() ); 
  delay (200);
}

void Oblicz_Sr() {
   srednia = srednia * dt;
   srednia = srednia + dystans;
   srednia = srednia / ( dt + 1);
   sred_wi = srednia;
}

void Oblicz_sr_P() {
   sredniaP = sredniaP * dt_P;
   sredniaP = sredniaP + dystans;
   sredniaP = sredniaP / ( dt_P + 1);
}

void Kalibracja() {
   rp = "CALIBRATION";
   for (int a = 1; a <1000; a++) {
     dystans = 2 * analogRead (1); 
     Oblicz_Sr();
   }
   //d1 = sred_wi;
   d1 = 0;
}

void Pomiar() {
   rp = "MEASURMENT";
   for (int a = 1; a < 1000; a++) {
     dystans = 2 * analogRead (1); 
     Oblicz_sr_P();
   } 
   //d1 = sredniaP;
   d1 = sredniaP - sred_wi; 
}

void Dipsw(){
  byte readPin1, readPin1A, readPin2, readPin2A;
  readPin1 = digitalRead(inPin1);           //reading the status of the SET button
  readPin2 = digitalRead(inPin2);           //read the status of the + button
  delay(1);
  readPin1A = digitalRead(inPin1);
  readPin2A = digitalRead(inPin2);
  if (readPin1 == LOW and readPin1 == readPin1A) {
    Kalibracja();
    delay(100);
  }  
  if (readPin2 == LOW and readPin2 == readPin2A) {
    Pomiar();
    delay(100);
  }
}
icon Schematic.zip 2.22MB Download(0)
License
All Rights
Reserved
licensBg
0