Advertisement
pleasedontcode

**System Monitor** rev_01

Dec 6th, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: **System Monitor**
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-12-06 12:08:17
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Real Time Remote Monitoring and Automation of */
  21.     /* Distribution Transformer using Arduino uno, GSM, */
  22.     /* AC Current sensor, AC volage sensor, oil level */
  23.     /* sensor, LM35, LCD 20*4 */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26. /* START CODE */
  27.  
  28. /****** DEFINITION OF LIBRARIES *****/
  29. #include <GSM.h>                // GSM library for communication
  30. #include <LiquidCrystal.h>      // LCD library for display
  31. #include "ACCurrentSensor.h"    // Library for AC current sensor
  32. #include "ACVoltageSensor.h"    // Library for AC voltage sensor
  33. #include "OilLevelSensor.h"     // Library for oil level sensor
  34. #include "LM35.h"               // Library for LM35 temperature sensor
  35.  
  36. /****** FUNCTION PROTOTYPES *****/
  37. void setup(void);
  38. void loop(void);
  39.  
  40. /****** GLOBAL VARIABLES *****/
  41. GSM gsm;                          // GSM object
  42. LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // LCD object with RS, Enable, D0-D3 pins
  43. ACCurrentSensor currentSensor;    // AC current sensor object
  44. ACVoltageSensor voltageSensor;    // AC voltage sensor object
  45. OilLevelSensor oilSensor;         // Oil level sensor object
  46. LM35 temperatureSensor(A0);       // LM35 temperature sensor object on analog pin A0
  47.  
  48. void setup(void)
  49. {
  50.     // Initialize GSM module
  51.     gsm.begin();
  52.    
  53.     // Initialize LCD
  54.     lcd.begin(20, 4); // 20 columns and 4 rows
  55.     lcd.print("Monitoring System");
  56.  
  57.     // Initialize sensors
  58.     currentSensor.begin();
  59.     voltageSensor.begin();
  60.     oilSensor.begin();
  61. }
  62.  
  63. void loop(void)
  64. {
  65.     // Read sensor values
  66.     float current = currentSensor.readCurrent();
  67.     float voltage = voltageSensor.readVoltage();
  68.     float oilLevel = oilSensor.readLevel();
  69.     double temperatureC = temperatureSensor.getTemp();
  70.    
  71.     // Display values on LCD
  72.     lcd.setCursor(0, 1);
  73.     lcd.print("Current: ");
  74.     lcd.print(current);
  75.     lcd.print(" A");
  76.    
  77.     lcd.setCursor(0, 2);
  78.     lcd.print("Voltage: ");
  79.     lcd.print(voltage);
  80.     lcd.print(" V");
  81.    
  82.     lcd.setCursor(0, 3);
  83.     lcd.print("Temp: ");
  84.     lcd.print(temperatureC);
  85.     lcd.print(" C");
  86.  
  87.     // Add GSM functionality here if needed, e.g., sending alerts
  88.  
  89.     delay(1000); // Update every second
  90. }
  91.  
  92. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement