That’s it for connection now lets upload the below code to make it work. SDA and SCL pins from the LCD display are connected to D21 and D22 of ESP32 respectively. The OUT pin from the IR sensor module is connected to the digital pin D2 (GPIO2) on ESP32.
Circuit Diagram Interfacing ESP32 with IR sensor and LCD displayįrom the above wiring diagram you can see the IR sensor and LCD display VCC and GND are powered from 5V and GND pins of ESP32 respectively. Through this we can measure the Revolutions per second and Revolutions per minute (RPM) of the rotating objects. Here we are using ESP32 instead of Arduino and ESP 32 has different type of interrupts than Arduino so the source code differs slightly than with Arduino. So below you can get the wiring diagrams and source code which you can use to get the accurate RPM readings from the rotating objects.įirst lets learn for ESP32 DIY Tachometer to Measure Accurate RPM using ESP32 The interrupts which we used in the above Arduino example doesn’t work with ESP 32 and ESP8266( NodeMCU, Wemos D1. In this method principle and working of the device is same except the interrupts and wiring. Oldtime=millis() //saves the current timeĪttachInterrupt(digitalPinToInterrupt(2),isr,RISING) ĭIY Tachometer to Measure Accurate RPM using ESP32 or ESP8266. Rpm=(RPMnew/newtime)*60000 //calculates rpm Int RPMnew = rev/wings //here we used fan which has 3 wings Int wings= 3 // no of wings of rotating object, for disc object use 1 with white tape on one side Newtime=millis()-oldtime //finds the time Create the lcd object address 0x27(get it from i2cscanner) and 16 columns x 2 rowsĪttachInterrupt(digitalPinToInterrupt(2),isr,RISING) //attaching the interruptĭetachInterrupt(0) //detaches the interrupt DIY Tachometer to Measure Accurate RPM using Arduino
#ICIRCUIT ARDUINO DOWNLOAD#
To download LiquidCrystal_I2C library click : Libraries