-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shifted voltmeter #13
base: stable
Are you sure you want to change the base?
Conversation
nice shot with those modules, they are less than 1$ on ali express and well sourced. |
@landswellsong thanks very much for the work. I bought one of these boards several years ago, and never had the time to play with it. https://github.com/lincomatic/open_evse/tree/development I made the define ZMPT101B instead of SHIFTED_VOLTMETER. After you test and give me some sample values to put into the VOLTMTER_xxx defines for this board, I will merge it into the stable branch, where it will eventually make back up to this repo. Please give is a whirl, and you can open up an issue on my repo to discuss tweaks. |
Thanks for this, I've incorporated these changes into my own build and it's working well (accepting the relatively low precision inherent in measuring voltage this way). A note about the ZMPT101B: The surface-mount input resistor on the high voltage side seems dangerously inadequate for the voltages it's exposed to. It's also alarmingly close to the mounting screw hole (nylon stand-offs seem like a good idea). I replaced the resistor on mine with a pair of 350V-rated 120k through-hole resistors in series, soldered to the pins of the screw terminal and transformer on the under-side of the board. At 240V, the 240k gives 1mA in the transformer, which means you can turn down the gain a bit for less noise. Given the amount of current available, I also recommend fitting a fuse of some kind between the incoming supply and the ZMPT101B. An inline 20mm fuse-holder is convenient. For what it's worth, I've connected the output of the ZMPT101B directly to the PP pin on the OpenEVSE V5.6 board, which is ADC pin 2. (The PP signal is unused if you have a tethered cable.) The 1k PP pull-up resistor does not appear to affect the signal. 5V and GND can be obtained from the programming header. The calibration values I've used are:
Obviously the scale factor will be dependent on the input resistor value and the adjustment of the gain potentiometer. The best approach seems to be to get it in the right ballpark then adjust the pot until the reading matches that of a trusted voltmeter. To determine the offset, I added a line of code to print the raw ADC value and disconnected the AC input to the ZMPT101B. |
I'm making a custom setup for development of a few features and needed a voltmeter for it. I have no idea what an OpenEVSE2 is and the code looks kind of dated, so I added support for a transformer based voltmeter that scales the input sine and puts it around half its VCC rather than zero. I bought it locally, so not sure how available it is, but seems to be quite common, called ZMPT101B. The thing looks like this just in case:
It required a voltage caclulation logic alteration as well as subtracting the offset rather than adding, and since for some reason those are unsigned for voltage (why? they are signed for current), I added a define. I also made the voltmeter-related defines redefinable in build time.
There's an additional commit allowing to drop GFI support in build-time, it doesn't really relate to the voltmeter code, but I threw it for good measure, as it might be useful for someone. (My setup has an external GFI unit)
PS: The "shifted voltmeter" name seems dumb, but I can't honestly think of anything better