Hi fabinho,
Here are the schematics for the arduino board and for the RPM sensor.
The arduino board
![]()
The RPM Sensor board
![]()
I'm not sure if the max6675 module is still available, but this is a replacement http://www.adafruit.com/products/269
The arduino code...
Code://-------------------------------------------------------------- // // Interrupt driven sketch to measure RPM, and Temps // it expects a suitable signal on pin digital 2 / external int0 // Display is via LCD. // //-------------------------------------------------------------- #include <LiquidCrystal.h> #include <max6675.h> #include <Wire.h> int thermoDO = 3; int thermoCS = 4; int thermoCLK = 7; MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); LiquidCrystal lcd(13, 12, 11, 10, 9, 8); uint8_t degree[8] = {140,146,146,140,128,128,128,128}; int pwmPin5 = 5; // 976hz signal on pin 5, connected to a mosfet to drive a glowplug. int dutycycle = 80; // 25 = 10% duty cycle volatile word rpmcount; unsigned long rpm; unsigned long timeold; void setup() { pinMode(pwmPin5, OUTPUT); analogWrite(pwmPin5, dutycycle); //turn on the glowplug output. lcd.begin(20,4); // Setup the LCD, use 16,2 for a 16x2 LCD, etc. lcd.clear(); // start with a blank screen lcd.createChar(0, degree); attachInterrupt(0, rpm_fun, RISING); //enable int0 rpmcount = 0; rpm = 0; timeold = 0; delay(500); } void loop() { lcd.setCursor(0,0); lcd.print("RPM: "); lcd.setCursor(0, 2); lcd.print("EGT:"); lcd.setCursor(5,2); lcd.print(thermocouple.readCelsius()); lcd.write((byte)0); lcd.print("C "); if (rpmcount >= 100) { //Update RPM every 100 counts, increase this for better RPM resolution, //decrease for faster update rpm = 1000000*60/(micros() - timeold)*rpmcount; //rpm = (micros() - timeold); timeold = micros(); rpmcount = 0; lcd.setCursor(5,0); lcd.print(" "); lcd.setCursor(5,0); lcd.print(rpm); } delay (500); } void rpm_fun() { rpmcount++; //Each rotation, this interrupt function is run } //-----------------------------------------------
If there are any questions, let me know
Regards,
Steve.
Good afternoon Steve, I made here a circuit as shown in your drawing to the glow plug more when I turn on the 12v Battery candle call and is still making connected do you have any idea what it could be?