Advertisement
Guest User

Untitled

a guest
May 27th, 2015
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. /Baseado no programa exemplo da biblioteca EmonLib
  2.  
  3. //Carrega as bibliotecas
  4. #include "EmonLib.h"
  5. #include <LiquidCrystal.h>
  6.  
  7. EnergyMonitor emon1;
  8. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  9.  
  10. //Tensao da rede eletrica
  11. int rede = 110.0;
  12.  
  13. //Pino do sensor SCT
  14. int pino_sct = 1;
  15.  
  16. void setup()
  17. {
  18. lcd.begin(16, 2);
  19. lcd.clear();
  20. Serial.begin(9600);
  21. //Pino, calibracao - Cur Const= Ratio/BurdenR. 1800/62 = 29.
  22. emon1.current(pino_sct, 29);
  23. //Informacoes iniciais display
  24. lcd.setCursor(0,0);
  25. lcd.print("Corr.(A):");
  26. lcd.setCursor(0,1);
  27. lcd.print("Pot. (W):");
  28. }
  29.  
  30. void loop()
  31. {
  32. //Calcula a corrente
  33. double Irms = emon1.calcIrms(1480);
  34. //Mostra o valor da corrente
  35. Serial.print("Corrente : ");
  36. Serial.print(Irms); // Irms
  37. lcd.setCursor(10,0);
  38. lcd.print(Irms);
  39.  
  40. //Calcula e mostra o valor da potencia
  41. Serial.print(" Potencia : ");
  42. Serial.println(Irms*rede);
  43. lcd.setCursor(10,1);
  44. lcd.print(" ");
  45. lcd.setCursor(10,1);
  46. lcd.print(Irms*rede,1);
  47.  
  48. delay(1000);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement