{"id":628,"date":"2014-11-21T18:23:19","date_gmt":"2014-11-21T16:23:19","guid":{"rendered":"http:\/\/dety.net.ua\/?p=628"},"modified":"2014-12-04T11:31:56","modified_gmt":"2014-12-04T09:31:56","slug":"arduino-energy-monitoring","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=628","title":{"rendered":"Arduino + Energy Monitoring"},"content":{"rendered":"<p>Recently I&#8217;ve built a device for monitoring power consuption from <a href=\"http:\/\/openenergymonitor.org\/emon\/buildingblocks\/how-to-build-an-arduino-energy-monitor\" target=\"_blank\">http:\/\/openenergymonitor.org\/emon\/buildingblocks\/how-to-build-an-arduino-energy-monitor<\/a><\/p>\n<p>I used: Nokia 5110 display for Arduino, sensor SCT-013, power adapter AC-AC 9v.<\/p>\n<p>I bought a cheap current sensor with LCD to calibrate my device (emon1.current(5, 28);).<\/p>\n<p>I used Adafruit library because others didn&#8217;t work correctly.<\/p>\n<p>My sketch for it:<\/p>\n<blockquote><p>#include &#8220;EmonLib.h&#8221;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Include Emon Library<br \/>\n#include &lt;SPI.h&gt;<br \/>\n#include &lt;Adafruit_GFX.h&gt;<br \/>\n#include &lt;Adafruit_PCD8544.h&gt;<br \/>\nEnergyMonitor emon1;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Create an instance<br \/>\n\/\/ Software SPI (slower updates, more flexible pin options):<br \/>\n\/\/ pin 7 &#8211; Serial clock out (SCLK)<br \/>\n\/\/ pin 6 &#8211; Serial data out (DIN)<br \/>\n\/\/ pin 5 &#8211; Data\/Command select (D\/C)<br \/>\n\/\/ pin 4 &#8211; LCD chip select (CS)<br \/>\n\/\/ pin 3 &#8211; LCD reset (RST)<br \/>\nAdafruit_PCD8544 display = Adafruit_PCD8544(8, 9, 10, 11, 12);<\/p>\n<p>void setup()<br \/>\n{<\/p>\n<p>Serial.begin(9600);<br \/>\n\/\/ init<br \/>\ndisplay.begin();<br \/>\ndisplay.setContrast(60);<br \/>\n\/\/demo<br \/>\ndisplay.setTextSize(1);<br \/>\ndisplay.setTextColor(BLACK);<br \/>\ndisplay.setCursor(0,0);<br \/>\n\/\/\u00a0 delay(1000);<br \/>\ndisplay.clearDisplay();<\/p>\n<p>\/\/\u00a0 display.display();<br \/>\n\/\/ Calibration<br \/>\nemon1.voltage(4, 234.26, 1.7);<br \/>\nemon1.current(5, 28);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Current: input pin, calibration.<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\ndouble Irms = emon1.calcIrms(1480);\u00a0 \/\/ Calculate Irms only 1480<br \/>\nemon1.calcVI(20,2000); \/\/ Voltage<\/p>\n<p>float realPower\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = emon1.realPower;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/extract Real Power into variable<br \/>\nfloat apparentPower\u00a0\u00a0 = emon1.apparentPower;\u00a0\u00a0\u00a0 \/\/extract Apparent Power into variable<br \/>\nfloat powerFactor\u00a0\u00a0\u00a0\u00a0 = emon1.powerFactor;\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/extract Power Factor into Variable<br \/>\nfloat supplyVoltage\u00a0\u00a0 = emon1.Vrms;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/extract Vrms into Variable<br \/>\n\/\/float Irms\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = emon1.Irms;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/extract Irms into Variable<\/p>\n<p>\/\/double Volt = emon1.readVcc();<br \/>\n\/\/emon1.serialprint();<br \/>\ndouble Watt = Irms*supplyVoltage;<br \/>\nSerial.print(Watt);\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Apparent power<br \/>\nSerial.print(&#8221; &#8220;);<br \/>\nSerial.print(Irms);\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Irms<br \/>\nSerial.print(&#8221; &#8220;);<br \/>\nSerial.print(supplyVoltage);<br \/>\nSerial.print(&#8221; &#8220;);<br \/>\nSerial.print(realPower);<br \/>\nSerial.print(&#8221; &#8220;);<br \/>\nSerial.print(apparentPower);<br \/>\nSerial.println(&#8221; &#8220;);<br \/>\n\/\/Display<br \/>\ndisplay.print(&#8220;A=&#8221;);<br \/>\ndisplay.println(Irms);<br \/>\ndisplay.print(&#8220;W=&#8221;);<br \/>\ndisplay.println(Irms*220);<br \/>\ndisplay.print(&#8220;V=&#8221;);<br \/>\ndisplay.println(supplyVoltage);<br \/>\ndisplay.print(&#8220;RP=&#8221;);<br \/>\ndisplay.println(realPower);<br \/>\ndisplay.print(&#8220;AP=&#8221;);<br \/>\ndisplay.println(apparentPower);<br \/>\ndisplay.print(&#8220;PF=&#8221;);<br \/>\ndisplay.println(powerFactor);<br \/>\ndisplay.display();<br \/>\ndelay(2000);<br \/>\ndisplay.clearDisplay();<\/p>\n<p>}<\/p><\/blockquote>\n<p>In the beginning my RRD graphs were strange &#8211; voltage and power looked like 0V, 23V, 180V, and so on. After some investigations I found the cause &#8211; 2 scripts asks USBtty and conflict with each other. So I composed them into a script:<\/p>\n<blockquote><p>#!\/bin\/bash<br \/>\n# \u041f\u0443\u0442\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 rrdtool<br \/>\nRRDTOOL=\/usr\/bin\/rrdtool<\/p>\n<p># \u041f\u0443\u0442\u044c \u043a \u0431\u0430\u0437\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430<br \/>\nDATABASE=\/usr\/local\/rrd\/power.rrd<br \/>\nDATABASEV=\/usr\/local\/rrd\/voltage.rrd<\/p>\n<p># \u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 (\u0441\u0435\u043a) &#8211; \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d CRON<br \/>\nPERIOD=60<\/p>\n<p># \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430!<br \/>\nDATASTR=`sed -n &#8216;n;n;p;q;&#8217; &lt; \/dev\/ttyUSB0` # omit 2 lines from tty because the first line contains not full data and the second line is empty<br \/>\nSENSOR=`echo $DATASTR | awk &#8216;{print $1}&#8217;`<br \/>\nSENSORV=`echo $DATASTR | awk &#8216;{print $3}&#8217;`<br \/>\n#SENSOR=`sed -n &#8216;n;n;p;q;&#8217; &lt; \/dev\/ttyUSB0 | awk &#8216;{print $1}&#8217;`<br \/>\n#SENSORV=`sed -n &#8216;n;n;p;q;&#8217; &lt; \/dev\/ttyUSB0 | awk &#8216;{print $3}&#8217;`<br \/>\necho Power=$SENSOR Voltage=$SENSORV<br \/>\n# \u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u0430\u0442\u0430\u043b\u043e\u0433 web-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.<br \/>\nIMAGE_PATH=\/var\/www\/power<\/p>\n<p># \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430<br \/>\nTITLE_TEXT=&#8217;\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u044f&#8217;<\/p>\n<p># \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u0432 \u043b\u0435\u0433\u0435\u043d\u0434\u0435 \u043f\u043e\u0434 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u043c<br \/>\nUNDER_TEXT=&#8217;\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u0438&#8217;<\/p>\n<p># ========= \u0428\u0410\u0413 1. \u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b ======<\/p>\n<p># \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0430\u0437\u0430 \u0434\u043b\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 &#8211; \u0441\u043e\u0437\u0434\u0430\u0451\u043c<\/p>\n<p>if ! [ -f $DATABASE ]<br \/>\nthen<br \/>\n$RRDTOOL create $DATABASE -s $PERIOD DS:input:GAUGE:600:U:U \\<br \/>\nRRA:AVERAGE:0.5:1:576 \\<br \/>\nRRA:AVERAGE:0.5:6:672 \\<br \/>\nRRA:AVERAGE:0.5:24:732 \\<br \/>\nRRA:AVERAGE:0.5:144:1460<br \/>\nfi<br \/>\nif ! [ -f $DATABASEV ]<br \/>\nthen<br \/>\n$RRDTOOL create $DATABASE -s $PERIOD DS:input:GAUGE:600:U:U \\<br \/>\nRRA:AVERAGE:0.5:1:576 \\<br \/>\nRRA:AVERAGE:0.5:6:672 \\<br \/>\nRRA:AVERAGE:0.5:24:732 \\<br \/>\nRRA:AVERAGE:0.5:144:1460<br \/>\nfi<\/p>\n<p>$RRDTOOL update $DATABASE N:$SENSOR<br \/>\n$RRDTOOL update $DATABASEV N:$SENSORV<\/p>\n<p># ============================================================================<\/p>\n<p># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<p>function DRAW_GRAPHIC<br \/>\n{<\/p>\n<p># \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u044f, \u0432\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a<br \/>\nNOW_HOUR=`date +%H`<br \/>\nNOW_MIN=`date +%M`<br \/>\nNOW_SEC=`date +%S`<\/p>\n<p># \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 2, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c<br \/>\ncase $2 in<br \/>\nday)<br \/>\nTIME_TEXT=&#8221;\u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 24 \u0447\u0430\u0441\u0430&#8221;<br \/>\n;;<br \/>\nweek)<br \/>\nTIME_TEXT=&#8221;\u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043d\u0435\u0434\u0435\u043b\u044e&#8221;<br \/>\n;;<br \/>\nmonth)<br \/>\nTIME_TEXT=&#8221;\u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446&#8221;<br \/>\n;;<br \/>\nyear)<br \/>\nTIME_TEXT=&#8221;\u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0434&#8221;<br \/>\n;;<br \/>\nesac<\/p>\n<p>$RRDTOOL graph $IMAGE_PATH\/$1 \\<br \/>\n-s -1$2 \\<br \/>\n-e now \\<br \/>\n-a PNG \\<br \/>\n-v $4 \\<br \/>\n-t &#8220;$TITLE_TEXT $TIME_TEXT&#8221; \\<br \/>\n-r \\<br \/>\n-E \\<br \/>\n-i \\<br \/>\n-R light \\<br \/>\n&#8211;zoom 1 \\<br \/>\n-w 500 \\<br \/>\n-h 150 \\<br \/>\n&#8211;font DEFAULT:10:\/usr\/local\/share\/rrdtool\/fonts\/ARIAL8.TTF \\<br \/>\nDEF:input=$3:input:AVERAGE \\<br \/>\nLINE2:input#C0140E \\<br \/>\nGPRINT:input:LAST:&#8217;\u0422\u0435\u043a\u0443\u0449\u0430\u044f\\:%2.1lf&#8217;\\<br \/>\nGPRINT:input:MIN:&#8217;\u041c\u0438\u043d\\:%2.1lf&#8217; \\<br \/>\nGPRINT:input:MAX:&#8217;\u041c\u0430\u043a\u0441\\:%2.1lf&#8217; \\<br \/>\nGPRINT:input:AVERAGE:&#8217;\u0421\u0440\u0435\u0434\u043d\u044f\u044f\\:%4.1lf&#8217;<br \/>\n}<\/p>\n<p># ========= \u0428\u0410\u0413 2. \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 ========<br \/>\nDRAW_GRAPHIC &#8216;power_d.png&#8217; &#8216;day&#8217; $DATABASE &#8216;\u0412\u0430\u0442\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;power_w.png&#8217; &#8216;week&#8217; $DATABASE &#8216;\u0412\u0430\u0442\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;power_m.png&#8217; &#8216;month&#8217; $DATABASE &#8216;\u0412\u0430\u0442\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;power_y.png&#8217; &#8216;year&#8217; $DATABASE &#8216;\u0412\u0430\u0442\u0442&#8217;<\/p>\n<p>DRAW_GRAPHIC &#8216;volt_d.png&#8217; &#8216;day&#8217; $DATABASEV &#8216;\u0412\u043e\u043b\u044c\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;volt_w.png&#8217; &#8216;week&#8217; $DATABASEV &#8216;\u0412\u043e\u043b\u044c\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;volt_m.png&#8217; &#8216;month&#8217; $DATABASEV &#8216;\u0412\u043e\u043b\u044c\u0442&#8217;<br \/>\nDRAW_GRAPHIC &#8216;volt_y.png&#8217; &#8216;year&#8217; $DATABASEV &#8216;\u0412\u043e\u043b\u044c\u0442&#8217;<\/p><\/blockquote>\n<p>Some photos:<\/p>\n<p>&nbsp;<\/p>\n<p>1. The sensor has a burden resistor already.<\/p>\n<p>2. Calibration and comparison.<\/p>\n<p>3. The bad image on the LCD with non-Adafruit library.<\/p>\n<p>4. RRDtool graphs.<\/p>\n<p><a href=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141113_115730.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-629\" src=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141113_115730-300x225.jpg\" alt=\"IMG_20141113_115730\" width=\"300\" height=\"225\" srcset=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141113_115730-300x225.jpg 300w, https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141113_115730.jpg 320w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141118_183058.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-630\" src=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141118_183058-300x225.jpg\" alt=\"IMG_20141118_183058\" width=\"300\" height=\"225\" srcset=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141118_183058-300x225.jpg 300w, https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/IMG_20141118_183058.jpg 320w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/Untitled.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-631\" src=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/Untitled-300x213.png\" alt=\"Untitled\" width=\"300\" height=\"213\" srcset=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/Untitled-300x213.png 300w, https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/Untitled.png 450w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/temp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-642\" src=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/temp-300x173.png\" alt=\"temp\" width=\"300\" height=\"173\" srcset=\"https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/temp-300x173.png 300w, https:\/\/dety.net.ua\/wp-content\/uploads\/2014\/11\/temp.png 320w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I&#8217;ve built a device for monitoring power consuption from http:\/\/openenergymonitor.org\/emon\/buildingblocks\/how-to-build-an-arduino-energy-monitor I used: Nokia 5110 display for Arduino, sensor SCT-013, power adapter AC-AC 9v. I bought a cheap current sensor with LCD to calibrate my device (emon1.current(5, 28);). I used Adafruit library because others didn&#8217;t work correctly. My sketch for it: #include &#8220;EmonLib.h&#8221;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Include [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13],"tags":[],"class_list":["post-628","post","type-post","status-publish","format-standard","hentry","category-gadgets","category-novosti"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=628"}],"version-history":[{"count":5,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions"}],"predecessor-version":[{"id":649,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions\/649"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}