sometimewoodworker Posted September 27, 2019 Share Posted September 27, 2019 35 minutes ago, Crossy said: If it's the type with a toroid and coil I'd call it a "current transformer", if it's the alternative Hall-effect (electronic) type I'd call it a "current sensor". In reality the terms are used interchangeably. I'm more confused as to why johng wasn't able to buy the beasts successfully. OK then on the terminology. But I'm with you on availablity, you can find them almost everywhere. Link to comment Share on other sites More sharing options...
Farangwithaplan Posted September 27, 2019 Share Posted September 27, 2019 (edited) On 2/22/2018 at 6:49 PM, Crossy said: OK, this is probably the "final" software update. Correctly displays month, day, hour, minute, second with leading zero if <10. Does the same when creating the .csv files so they sort properly. Datalogging_V2.0.ino 10.22 kB · 0 downloads Also a macro-enabled Excel 2013 sheet with a VB script that imports the .csv files (oiked off the net). Power Monitor.xlsm 2.54 MB · 1 download Select cell A1 of Sheet 1 Hit alt F11 to run VB Select module "Import_CSV" Hit F5 to run Follow the prompts. The charts on the second sheet should now be filled correctly. Hi Crossy, I really enjoy looking at your work - especially the electrical side as that is not such a strong point. Here is a short addition to the VBA code you are using. All this does is automatically select cell A1 of sheet 1 and then runs your existing code on start up of your excel workbook. If you have a fixed location where you need to pull the CSV file from, we can either have the dialog box auto populate that location or if you know the actual file name and location of the CSV, the code can be modified so you don't need a dialog at all and the import will just happen on start. Let me know if you want me to do it for you. Anyway, here is the first amended code. Sub Auto_Open() '''Auto starts the import of CSV routine on opening of workbook by FWAP Worksheets("Sheet1").Range("A1").Select '''Selects sheet 1 and cell A1 on startup. ImportCSVsWithReference ''' Runs your CSV import code. End Sub Sub ImportCSVsWithReference() 'UpdatebyKutoolsforExcel20151214 Dim xSht As Worksheet Dim xWb As Workbook Dim xStrPath As String Dim xFileDialog As FileDialog Dim xFile As String On Error GoTo ErrHandler Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker) xFileDialog.AllowMultiSelect = False xFileDialog.Title = "Select a folder [Kutools for Excel]" If xFileDialog.Show = -1 Then xStrPath = xFileDialog.SelectedItems(1) End If If xStrPath = "" Then Exit Sub Set xSht = ThisWorkbook.ActiveSheet If MsgBox("Clear the existing sheet before importing?", vbYesNo, "Kutools for Excel") = vbYes Then xSht.UsedRange.Clear Application.ScreenUpdating = False xFile = Dir(xStrPath & "\" & "*.csv") Do While xFile <> "" Set xWb = Workbooks.Open(xStrPath & "\" & xFile) Columns(1).Insert xlShiftToRight Columns(1).SpecialCells(xlBlanks).Value = ActiveSheet.Name ActiveSheet.UsedRange.Copy xSht.Range("A" & Rows.Count).End(xlUp).Offset(1) xWb.Close False xFile = Dir Loop Application.ScreenUpdating = True Exit Sub ErrHandler: MsgBox "no files csv", , "Kutools for Excel" End Sub Edit: Actually if you have a preferred path, you can just replace the bold / italics part of the line above with that path wrapped in inverted commas and you should be good to go. Example: xStrPath = "D:\myCSVfilefolder" Edited September 27, 2019 by Farangwithaplan added a bit of info about the actual path at the bottom of the post. Link to comment Share on other sites More sharing options...
Crossy Posted September 27, 2019 Author Share Posted September 27, 2019 17 minutes ago, Farangwithaplan said: Anyway, here is the first amended code. Excellent! Actually the .csv files are always in the same folder as the Excel sheet. Link to comment Share on other sites More sharing options...
Farangwithaplan Posted September 27, 2019 Share Posted September 27, 2019 (edited) I've just edited my last post to give you an example Edited September 27, 2019 by Farangwithaplan 1 Link to comment Share on other sites More sharing options...
johng Posted September 27, 2019 Share Posted September 27, 2019 1 hour ago, Crossy said: I'm more confused as to why johng wasn't able to buy the beasts successfully. I only tried Lazada as they offer cash on delivery and I already had an account with them.. for some reason they wouldn't/couldn't send just the current transformer on its own..but its ok as a package deal ??? total madness ! Link to comment Share on other sites More sharing options...
Chazar Posted September 27, 2019 Share Posted September 27, 2019 I had an "interesting issue" the other day, something cut through the power lines to the land and blew up 3 of the 4 elcb's scattered around the land, why one survived I have no idea, first time this has ever happened in 3 years. Stormy weather and tree sliced through them somewhere nearby, couldnt reset 3 out of the 4, replaced and worked fine. Link to comment Share on other sites More sharing options...
Fruit Trader Posted September 27, 2019 Share Posted September 27, 2019 (edited) 4 hours ago, johng said: Eventually after 2 more goes If you want to experiment with power monitoring over MQTT consider a cheap Chinese smart meter like the SDM220 to handle data acquisition and comms. http://www.eastron.com.cn Edited September 27, 2019 by Fruit Trader 1 Link to comment Share on other sites More sharing options...
sometimewoodworker Posted September 27, 2019 Share Posted September 27, 2019 5 hours ago, johng said: I only tried Lazada as they offer cash on delivery and I already had an account with them.. for some reason they wouldn't/couldn't send just the current transformer on its own..but its ok as a package deal ??? total madness ! Not at all from Lazada. they are not usually dealing with components, just with ready to install units. if you wanted that other suppliers are better Link to comment Share on other sites More sharing options...
johng Posted September 30, 2019 Share Posted September 30, 2019 Off topic yes but I just run into another "prohibited item" on Lazada Link to comment Share on other sites More sharing options...
johng Posted September 30, 2019 Share Posted September 30, 2019 On 9/27/2019 at 3:13 PM, Fruit Trader said: cheap Chinese smart meter like the SDM220 to handle data acquisition and comms. Thanks for the suggestion the cheaper ones use Modbus which seems to be RS232 ?? http://en.trialcommand.com/blog/gateway-esp8266-modbus-rtu-mqtt-hmi-industrial-panasonic/ My brain starts to hurt again ???? maybe after a few more times reading the stuff from the link above..it will start make sense to me.. I have a few of the ESP8266 NodeMCU units to experiment with they are really cheap and can run Arduino code ???? Link to comment Share on other sites More sharing options...
Fruit Trader Posted September 30, 2019 Share Posted September 30, 2019 2 hours ago, johng said: Thanks for the suggestion the cheaper ones use Modbus which seems to be RS232 ?? SDM220 >> RS485-TTL >> ESP8266 >> MQTT A little more help and ideas below. https://diytechandrepairs.nu/esp8266-to-monitor-electricity-with-sdm-devices-and-send-to-mqtt 1 Link to comment Share on other sites More sharing options...
OneMoreFarang Posted September 30, 2019 Share Posted September 30, 2019 2 hours ago, johng said: I have a few of the ESP8266 NodeMCU units to experiment with they are really cheap and can run Arduino code ???? Yes, they run Arduino code. But don't expect that they always function in exactly the same way like the Arduino. I.e. if you use the WLAN of the ESP then that might screw up the timing of other operations. LED strips are a good example. They work fine with relative easy code on the Arduino. But on the ESP the timing does not work as expected and the LED stripes don't work as expected. Obviously some code will work just fine. But don't expect all code will work. 1 Link to comment Share on other sites More sharing options...
Crossy Posted September 30, 2019 Author Share Posted September 30, 2019 These cheap Chinese meters look interesting. What data do they provide and how often do they send? Link to comment Share on other sites More sharing options...
Fruit Trader Posted September 30, 2019 Share Posted September 30, 2019 3 hours ago, Crossy said: These cheap Chinese meters look interesting. What data do they provide and how often do they send? SDM Smart meters Voltage, current, frequency and several power values are stored in registers which can be queried over a stable RS485 using modbus protocol. How often data is requested and how its used is down to the device or software sending the requests. A popular method to handle this type of data is through the open source Node-RED tool installed on a low power single board computer. Link to comment Share on other sites More sharing options...
Crossy Posted September 30, 2019 Author Share Posted September 30, 2019 Got it. I've come across Node-Red when looking at controlling my solar inverters, sadly the new version of the inverter (which I have) don't use the same protocols. They've gone web-based, great for managing from anywhere via the App, not so great for controlling the output. Link to comment Share on other sites More sharing options...
johng Posted October 1, 2019 Share Posted October 1, 2019 15 hours ago, Crossy said: These cheap Chinese meters look interesting. What data do they provide and how often do they send? Here's the user manual for the one @Fruit Trader mentioned. Eastron_SDM220-Mbus_user_manual_V1_8.pdf Link to comment Share on other sites More sharing options...
johng Posted October 1, 2019 Share Posted October 1, 2019 3 hours ago, Crossy said: They've gone web-based, great for managing from anywhere via the App Is it https or just plain http ? if plain http you could easily "sniff' the traffic with the wireshark program and then maybe work out what commands/data are what then use those commands/data bits in Node red..which has its own fully configurable "dash board" (web page) and can send/receive data to a mobile phone app all without sending any data at all to China or wherever, you keep all the traffic in your own network...unless of course you want to make it accessible over the internet but even then you have total control over access,encryption method and passwords..the downside is its much harder to set it all up lots of reading and achy brain ???????? Link to comment Share on other sites More sharing options...
Crossy Posted October 1, 2019 Author Share Posted October 1, 2019 42 minutes ago, johng said: Is it https or just plain http ? It's plain http so sniffing is an option, just not sure how enthusiastic I am. I could just dump excess power and make some hot water (need to stop exporting when the meter reader might notice). Link to comment Share on other sites More sharing options...
tjo o tjim Posted October 1, 2019 Share Posted October 1, 2019 2 hours ago, Crossy said: It's plain http so sniffing is an option, just not sure how enthusiastic I am. I could just dump excess power and make some hot water (need to stop exporting when the meter reader might notice). curl and grep are your friend... unless it is using javascript. Did you do a port scan on the modem? I would expect telnet is wide open too... Link to comment Share on other sites More sharing options...
Fruit Trader Posted October 1, 2019 Share Posted October 1, 2019 2 hours ago, Crossy said: It's plain http so sniffing is an option, just not sure how enthusiastic I am. I could just dump excess power and make some hot water (need to stop exporting when the meter reader might notice). WVC wireless modem protocol and micro inverter flow for Node-Red https://github.com/invite-frey/wvc-inverter If this was used to prevent export, how would you provide real time meter reading for the limit control to function. Link to comment Share on other sites More sharing options...
Crossy Posted October 1, 2019 Author Share Posted October 1, 2019 1 minute ago, Fruit Trader said: WVC wireless modem protocol and micro inverter flow for Node-Red https://github.com/invite-frey/wvc-inverter If this was used to prevent export, how would you provide real time meter reading for the limit control to function. Yeah, I know about that, sadly it only works with the earlier inverters and modem ???? It does have the facility to talk to one of the electronic meters to determine export level. Link to comment Share on other sites More sharing options...
Fruit Trader Posted October 1, 2019 Share Posted October 1, 2019 1 minute ago, Crossy said: Yeah, I know about that, sadly it only works with the earlier inverters and modem ???? It does have the facility to talk to one of the electronic meters to determine export level. The protocol was provided by KaiDeng Technology so I guess any changes or updates are available. Link to comment Share on other sites More sharing options...
Crossy Posted October 1, 2019 Author Share Posted October 1, 2019 4 minutes ago, Fruit Trader said: The protocol was provided by KaiDeng Technology so I guess any changes or updates are available. Yup, I asked them. Although the support chap was very helpful in telling me that my modem wouldn't work with my inverters (got a partial refund on the modem from AliExpress) and selling me the right unit for a good price I've not had much luck in getting anything really useful out of them. At least not yet ???? Part of the problem now is that the modem links directly to the Kaideng servers (once it's set up), your App or browser then talks to the servers. Link to comment Share on other sites More sharing options...
Fruit Trader Posted October 1, 2019 Share Posted October 1, 2019 1 hour ago, Crossy said: Yup, I asked them. Although the support chap was very helpful in telling me that my modem wouldn't work with my inverters (got a partial refund on the modem from AliExpress) and selling me the right unit for a good price I've not had much luck in getting anything really useful out of them. At least not yet ???? Part of the problem now is that the modem links directly to the Kaideng servers (once it's set up), your App or browser then talks to the servers. Another git-hub user has suggested the project owner has communication in Chinese with KaiDeng Co and is probably the best place to grab more info. I have a contact address for project owner if you are interested in going deeper. Out of personal interest I have asked around for some info on the WVC wireless to modem data and whats available locally outside of messages being sent to a broker. Cant find any good technical info on the various modems for WVC devices. Its all buried in the Chinese dark web. 1 Link to comment Share on other sites More sharing options...
Crossy Posted October 1, 2019 Author Share Posted October 1, 2019 17 minutes ago, Fruit Trader said: I have a contact address for project owner if you are interested in going deeper. Please PM to me, another voice may persuade him that it's a good idea ???? Link to comment Share on other sites More sharing options...
johng Posted October 5, 2019 Share Posted October 5, 2019 On 9/30/2019 at 3:39 PM, OneMoreFarang said: Yes, they run Arduino code. But don't expect that they always function in exactly the same way like the Arduino. I.e. if you use the WLAN of the ESP then that might screw up the timing of other operations. LED strips are a good example. They work fine with relative easy code on the Arduino. But on the ESP the timing does not work as expected and the LED stripes don't work as expected. Obviously some code will work just fine. But don't expect all code will work. Apparently they have/had trouble with modbus RS485 protcol...maybe the libraries are fixed now ? Link to comment Share on other sites More sharing options...
OneMoreFarang Posted October 5, 2019 Share Posted October 5, 2019 1 hour ago, johng said: Apparently they have/had trouble with modbus RS485 protcol...maybe the libraries are fixed now ? As far as I understand it's not a library problem (at least not only a library problem). It the principle that on the ESP other tasks (like WLAN) work at the same time. And they need some resources. On the Arduino things are simple. The loop is running and nothing else. I don't know how much this is a problem is real life for many projects. I worked with Arduinos and now I started working with the ESP32. I did some LED stripe control programming on the Arduino and it worked fine without hassle. Now I looked how this would work on the ESP and lots of people in the forums complain that it does not work (Arduino code or ESP-IDF code) because of timing problems. There seem to be some workarounds how to maybe make it work under certain conditions. But it's definitely not trivial. For some not timing critical projects it won't matter. But I mention it here so that people who think "let's change to the ESP, that should be easy" are aware that sometimes it's absolutely not easy. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now