element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Shift it! Warehouse Automation Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Shift it! Warehouse Automation Design Challenge
  • More
  • Cancel
Shift it! Warehouse Automation Design Challenge
Forum System software for checking motor temperature and for giving appropriate sound indication
  • News
  • Forum
  • Projects
  • Leaderboard
  • Files
  • Members
  • Mentions
  • More
  • Cancel
  • New
Join Shift it! Warehouse Automation Design Challenge to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 30 replies
  • Subscribers 42 subscribers
  • Views 1251 views
  • Users 0 members are here
  • design challenge
  • shift it
Related

System software for checking motor temperature and for giving appropriate sound indication

manojroy123
manojroy123 4 months ago

Flowchart for detecting motor temperature and giving sound indiction.

image

In the above flowchart you can see how the system software works. First it checks for motor temperature and gives proper indication about it. Bellow is the working video of the system.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Arduino code

First we read sensor value from ADC.

 // Read sensor value
         int newValue = analogRead(A1);

Than we filter those value using median filter. Median Filter function code is given bellow. There were many software filter available like SMA(Simple mean average), LMA(Logarithmic mean average), median filter. SMA was still giving lots of error, so we have used median filter for processing sensor data. it was still giving some error. We are looking for more better software filter for processing sensor values.

/*Median Filter */
// Median filter function
int median(int *array, int size) {
  int sorted[size];
  // Copy array
  for (int i = 0; i < size; i++) {
    sorted[i] = array[i];
  }

  // Simple bubble sort
  for (int i = 0; i < size - 1; i++) {
    for (int j = 0; j < size - i - 1; j++) {
      if (sorted[j] > sorted[j + 1]) {
        int temp = sorted[j];
        sorted[j] = sorted[j + 1];
        sorted[j + 1] = temp;
      }
    }
  }
  

After filtering the Raw ADC sensor data using median filter. We convert the filtered value to voltage. Code for which is given bellow.

 int rawValue = filteredValue;
  float voltage = rawValue * 0.00323 ;  // Convert to voltage
  const float Rref = 992.0; //1K ohm referance resistor
 
  // Calculate sensor resistance from voltage divider formula
  float Rt =  Rref*( voltage / (3.307 - voltage));

After converting to voltage. We convert the voltage value to temperature using "Invert Callendar-Van Dusen" technique which has some constant in it. bellow is the code for it.

// Callendar-Van Dusen coefficients for standard PT1000 (α = 0.00385)
const float A = 3.9083e-3;
const float B = -5.775e-7; 
const float R0 = 1000.0;  // PT1000 resistance at 0°C

//Function for voltage to temperature convertion
float calculateTemperature(float Rt) {
  float temp = -A + sqrt(A * A - 4 * B * (1 - Rt / R0));
  temp = temp / (2 * B);
  return temp;
}

After doing all the required processes we simply print this value in serial terminal and give appropriate buzzer indication based on algorithm shown in flowchart. bellow is the code for it.

// the loop function runs over and over again forever
void loop() {
    digitalWrite(LED_BUILTIN, HIGH);
       delay(10);
      /*Median Filter Local Varibales*/
      // Read sensor value
         int newValue = analogRead(A1);
         int filteredValue;
      // Store new value in buffer
          readings[index1] = newValue;
          index1 = (index1 + 1) % windowSize;

      // Check if buffer is full
          if (index1 == 0) bufferFilled = true;


      // Apply median filter only when buffer is filled
  if (bufferFilled) {
    filteredValue = median(readings, windowSize);
    Serial.print("Raw: ");
    Serial.print(newValue);
    Serial.print("  Filtered: ");
    Serial.println(filteredValue);
  } else {
    Serial.print("Raw: ");
    Serial.print(newValue);
    Serial.println("  (Warming up)");
  }
         
       //Serial Read Write
     
       int rawValue = filteredValue;
  float voltage = rawValue * 0.00323 ;  // Convert to voltage
  const float Rref = 992.0; //1K ohm referance resistor
  float Res = (Rref*voltage)/(3.3-voltage);
 



// Calculate sensor resistance from voltage divider formula
  float Rt =  Rref*( voltage / (3.307 - voltage));

  // Invert Callendar-Van Dusen to get temperature (for T ≥ 0°C)
  float temp = calculateTemperature(Rt-20.0);

  Serial.print("Raw ADC Value: ");
  Serial.print(rawValue);
  Serial.print(" => Voltage: ");
  Serial.print(voltage, 3);  // 3 decimal places
  Serial.println(" V");
  Serial.println(" Resistance");
  Serial.println(Rt-20.0);
  Serial.println(" Temperature");
  Serial.println(temp);

//Buzzer program
  if(Rt > 1174 and Rt < 1194){
        digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
         delay(100);                       // wait for a 100 milisecond
           for(int a = 0; a<5; a++){
                            digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
                            delay(100);
                            digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
                            delay(100);  
                            }
        }
   else if(Rt >= 1194){
                         digitalWrite(LED_BUILTIN, LOW);   // turn the LED off (Low is the voltage level)
                         delay(1000);      
                      }
    

}

  • Sign in to reply
  • Cancel

Top Replies

  • Jan Cumps
    Jan Cumps 4 months ago in reply to manojroy123 +2
    Your code does not do that: if(Rt > 1174 and Rt < 1194){ // ... 48, 49 } else if(Rt > 1194){ // 51, 52... } 50° is unsafe according to your comment above (it's above 45°, but not above 50°). But…
  • Jan Cumps
    Jan Cumps 4 months ago +1
    delay(100); // wait for a second This will not do what you expect. See the delay() documentation: Description Pauses the program for the amount of time (in milliseconds) specified as parameter…
  • michaelkellett
    michaelkellett 4 months ago in reply to manojroy123 +1
    I have told you, in another thread, that you can't decide on a better filter without looking at the noise signals you want to get rid of and comparing them with the signal you want to keep. From what…
Parents
  • Jan Cumps
    Jan Cumps 4 months ago

    This line does not do what you expect:

    digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)

    Sloppy comments are way worse than no comments. It sends yourself in a wrong direction.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • manojroy123
    manojroy123 4 months ago in reply to Jan Cumps

    How to edit it. I want to edit it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • manojroy123
    manojroy123 4 months ago in reply to Jan Cumps

    How to edit it. I want to edit it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Jan Cumps
    Jan Cumps 4 months ago in reply to manojroy123

    edit the post, then click on the code and select the edit button.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • manojroy123
    manojroy123 4 months ago in reply to Jan Cumps

    Where is edit the post button. I am not able to see it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 4 months ago in reply to manojroy123

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • manojroy123
    manojroy123 4 months ago in reply to Jan Cumps

    Thanks. I have edited the code. Please check.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube