Things used in this project

Hardware components:
Esp01
Espressif 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 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

Temperature and humidity meter (iot)
Intermediate
  • 309
  • 3

Measuring temperature and humidity with Arduino and uploading it to the server

Magic VR Hat
Intermediate
  • 776
  • 8

Wear the hat, get transported to different 360 VR experience.

From BT to WiFi: Creating WiFi Controlled Arduino Robot Car
Intermediate
  • 577
  • 5

Protip

NodeMCU ESP8266 in access point mode: the simplest way to make Wi-Fi controlled Robot Car from Bluetooth Arduino Robot Car + Android App.

Arduino Word Clock
Intermediate
  • 528
  • 8

Full instructions

A clock that let you read the time, for real!

DIY Complete Philips Hue Home Automation
Intermediate
  • 2,161
  • 6

Full instructions

This project emulates a Philips Hue Bridge that is able to control multiple types of lights.

Traffic Monitor- Monitors traffic on the Go
Intermediate
  • 160
  • 2

Full instructions

The device uses color indication to display traffic on the road you are driving or you have selected.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog