Raw data push from ESP based energy monitor

Hi there not sure who would be interest but here a small sample sketch and perl processing package.
it pushes raw data from esp based energy monitors thats using MCP3XXX chips…
perhaps you’re wondering why to push raw data. it just allows me to process the stream better. I can process the output from the ESP one give energy reading but also live oscilloscope measurements and I can set up trigger error conditions based on the output of the oscilloscope . I have not quite finished the process the data into readable energy measurement( currently have a flu and and my cognitive is messed up) it still needs some error correction and stuff ( when you first start your computer the data stream is off. just restart and it falls into line. I need to put a wait function as I suspect the com port and buffer does not have enough time and it messes it up on the first start)
it produces a comma separated output of the live stream… ( so it works with the oscilloscope I currently using which displays up to 9 outputs).
also since I am basically still debugging -currently displays the number of samples between each zero cross. which is 20 - 25 when outputting the data from 8 analog pins of the mcp3xxx or +2600 samples per second. if you halve the the number analog pin the data rate doubles and vise versa

wifiudpscopenew.ino (5.2 KB)

test2a.pl.zip (975 Bytes)

I probably should of used python instead of perl but 1/2 of my code that i am using is from my original TED project no reason reinventing the wheel… but once I get the perl program working properly I translate it to python

it is configured for my esp energy monitor that I built so it you are using on iotawatt or your own design just point the voltage analog pin to the correct one for your device.

it is using socat to capture the UDP stream and translate it serial so you need this command line to make it work

socat -u udp-recv:1234 PTY,link=/dev/ttyS18,group=tty,mode=770

the only difference is in the method of processing the data for energy readings. in the emon lib it is process one analog pin one at a time. with raw data push you process all data inputs at the same time in sequence so you can have very fast triggering events if you want but all in all I just need to convert the math routine from "while " to “if” statements on the emonlib

good luck have fun