Things used in this project

Hardware components:
Esp01
Everything ESP ESP8266 ESP-01
×1
INA219 - Current sensor
×1
OLED display
×1
AMS1117 - 3,3V
×1
Panasonic eca 1hm221
Capacitor 220 µF
×1
Screw terminal connector
×1
DIN Rail Mounted Plastic Box
×1
Software apps and online services:
Ide web
Arduino IDE
Cayenne logo hi
Cayenne
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Schematics

Schematics
Snimek obrazovky (52) cf0p9kjrhb

Code

CodeArduino
#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219;
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float current_A = 0;
float loadvoltage = 0;
float power_W = 0;
       
#define CAYENNE_PRINT Serial  
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"


char token[] = "token";
char ssid[] = "ssid";
char password[] = "password";


void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
  
  Wire.begin(2, 0); // SDA, SDL
  uint32_t currentFrequency;
  ina219.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop()
{
  Cayenne.run();
  
  shuntvoltage = ina219.getShuntVoltage_mV();
  busvoltage = ina219.getBusVoltage_V();
  current_mA = ina219.getCurrent_mA();
  loadvoltage = busvoltage + (shuntvoltage / 1000);
  current_A = current_mA / 1000;
  power_W = current_A * loadvoltage; 
  
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);  
  display.println(loadvoltage);
  display.setCursor(45, 0);
  display.println("V");
  display.setCursor(0, 10);  
  display.println(current_A);    
  display.setCursor(45, 10);
  display.println("A");
  display.setCursor(0, 20);  
  display.println(power_W);    
  display.setCursor(45, 20);
  display.println("W");
  display.display();
  
}


CAYENNE_OUT(V0)
{
  Cayenne.virtualWrite(V0, loadvoltage);
}

CAYENNE_OUT(V1)
{
  Cayenne.virtualWrite(V1, current_A);
}

CAYENNE_OUT(V2)
{
  Cayenne.virtualWrite(V2, power_W);
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Autonomous Plant (ESP8266 - Arduino)
Intermediate
  • 108
  • 2

Full instructions

Want to build system that takes care of a plant? Here's my first attempt. Using ESP8266, soil moisture and Sonoff grow light

Attendance System Using MYSQL with Raspberry and RFID-RC522
Intermediate
  • 1,275
  • 9

Protip

Here we are taking data from RFID reader which is connected to Node MCU V3 and saving it to MYSQL database running on Raspberry Pi.

Wireless Attendance System Using NodeMCU with MySQL
Intermediate
  • 645
  • 9

Protip

Here we are going to interface NodeMCU with RFID-RC522 and getting data to phpMyAdmin database.

IoT Pet Feeder
Intermediate
  • 6,805
  • 38

Full instructions

Use circuito.io to build a smart food dispenser for your pet controlled directly from your phone.

Build a Tank Volume Reader in Under $30 using ESP32
Intermediate
  • 770
  • 8

Full instructions

Build a DIY Level Sensor - tank monitor for volume, temperature, and humidity. Prototype for under $30.

NodeMCU Announcer for Domoticz
Intermediate
  • 110
  • 0

Full instructions

Status announcer for Domoticz using the Raspberry Pi and NodeMCU.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login