| Electronics > Projects, Designs, and Technical Stuff |
| Energy monitoring using Raspberry Pi, looking for advice regarding data storage |
| << < (4/5) > >> |
| ljwinkler:
JeanF, here is the python code responsible for detecting the port (the USB2Serial adapter I use has ID of 2341): --- Code: ---import serial import serial.tools.list_ports while True: ports = list(serial.tools.list_ports.comports()) device = "" for p in ports: if "2341" in p.hwid: device=p.device try: arduino = serial.Serial(device, 115200) except: print "Failed to connect to",device try: while True: data = arduino.readline() data = data.replace("\r\n","") pieces = data.split(",") ... --- End code --- You can use the below to play with the devices: --- Code: ---import serial.tools.list_ports ports = list(serial.tools.list_ports.comports()) for p in ports: print p.device, "- hwid:", p.hwid, "-", p.description if "0403" in p.hwid: port=p.device print "This is an Arduino!" else: print "This is not :)" --- End code --- Thanks for the info about dashboards, my goal is to have something that is generated locally. I plan to use this station for life without worrying that some company will go bust and my dashboard will stop working :) For your energy meter webserver - good idea however having an android phone displaying a page looks like an overkill :) Ok, it can be cheap (if you have a spare phone) as newer RPis have WiFi on board, they can act as an access point so the phone can connect to it directly. Ideally you could have an LCD screen (even the official RPi 7") or any other HDMI display to display the page. You can have RPi booting into a desktop environment and displaying its own page in chromium browser. |
| GeorgeOfTheJungle:
Save it locally but also copy on a google spreadsheet, there's a REST API: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate |
| mjkuwp:
From AliExpress (china) you can get a power measuring board with serial connection). It is described as "Free shipping Digital Display AC Voltmeter Ammeter Power Meter Energy Meter Power Meter Serial Communication 100A" and is $26 USD. https://www.aliexpress.com/item/Free-shipping-Digital-Display-AC-Voltmeter-Ammeter-Power-Meter-Energy-Meter-Power-Meter-Serial-Communication-100A/32855637078.html?spm=2114.search0104.3.15.11493482oDc9bI&ws_ab_test=searchweb0_0,searchweb201602_4_10065_10068_10130_10890_318_10547_319_10546_10548_317_10545_10696_450_10084_10083_10618_452_535_534_10307_533_532_204_10059_10884_323_325_10887_100031_320_321_322_5727818_10103_5727718_448_449,searchweb201603_45,ppcSwitch_0&algo_expid=c60126c5-1223-40aa-a30f-02f3d8987393-2&algo_pvid=c60126c5-1223-40aa-a30f-02f3d8987393 If you go the Raspberry Pi route you could consider writing to USB based flash drives and if you can write to one, two is just as easy so that you have redundancy. I personally have projects like this and they log to my own webhost account using a php script as the endpoint. I used to use services but got tired of them adjusting their business models/ownerships/api designs. Obviously you would want to have the code automatically start upon booting the pi so that it recovers from power outage. I suggest doing two methods - the first is to send data to a cloud service or your own webhost and the second is to log to a usb flash drive for the backup. It is also possible to buy commercial power monitors that would log every instance of a sag in voltage. The very simplest Idea I can think of is to purchase a multimeter (DMM) that has a usb based serial connection and log using that, however this would be pretty $$ and also you would have to hack the battery input to give constant power supply to the meter. |
| JeanF:
Dear all, thank you very much for your responses. mariush thank you for this additional information :) I will look into miniz. There will be a UPS for the Raspberry Pi + the voltmeter module. I bought several USB powerbanks and tested them all, capacity, hi/lo cut-off voltages, general build quality etc, and I chose one of them which is pretty decent in all regards. Obviously, its output boost converter is powered on at all times, regardless of the 5v input (from the wall adapter) being present or not. Not all of them have this feature. All in all, it looks like a pretty good choice for a small 5v UPS. I read contradictory opinions about keeping Lithium cells fully charged 24/7, but I couldn't find any definitive conclusion so I'll test it myself. And there are commercial units (small UPSes for routers, CCTV cameras etc) that also use 18650 cells so time will tell :). If it fails I will revert to lead-acid. sokoloff I agree about "engineering close" being enough. There are two distinct goals in this project: - checking and logging voltage drops during the winter, and let the power company know for them to take action - if and only if the first goal is achieved, maybe add the functionality to somehow display the precise values grabbed from the official power meter; thus upgrading the present system which is using a Geo Minim+ power monitor. That would give similar functionality but better accuracy. But you are right, I must keep track of what's really important. As always the risk is to try to add so many bells and whistles that the project ends up never finished... Concerning the power factor, you are right. Voltage swings are (by far) the biggest source of error. I have measured less than 190V instead of the nominal 230V from time to time, but a single measurement is less fun than a graph over time, hence the idea of this whole thing :) ljwinkler thank you for your code, it will be put to good use, I will let you know when I succeed :) BTW in my case yes I have several old phones so using one as a display could work (and probably be cheaper than getting another RPi + external screen) but yeah it's surely a bit overkill :) GeorgeOfTheJungle thank you for the tip about Google Spreadsheets, for sure I wouldn't have thought about that :-+ mjkuwp I initially planned to include this in my first post, but it was long enough so I removed it. Anyway, this is the exact module I purchased :-+. It can be found on multiple places when searching "PZEM-004T". I got mine on BangGood. There is also the -004 version (without T) which has 4 seven segments display as well. Due to higher current needs for the segments, the PSU stage is a bit different and so is the board layout, but it is very similar. Yes a cheap multimeter with serial out (UNI-T UT61D has one for example) could work but would take more space. |
| kripton2035:
the same module, with some displays and serial link, and cheaper . https://www.aliexpress.com/item/AC80-260V-100A-Power-Meter-Monitor-Voltmeter-Ammeter-Energy-Meter-With-Serial-Communication-Free-Shipping-12002352/32430076105.html |
| Navigation |
| Message Index |
| Next page |
| Previous page |