Home › Forums › Mooshimeter Support › Python API Problems
- This topic has 9 replies, 3 voices, and was last updated 7 years, 8 months ago by
Anonymous.
- AuthorPosts
AlexMcHodgkins
MemberHello,
I just used the Python API Example and compared it with my android mobiles’ display and another normal meter.
=> I read the same raw values for current over Python and Android
=> The android conversion to amperes is correct
=> The python conversion to amperes is off by a factor of very roughly 10.
(For the moment I use a hardcoded “own” measured conversion factor, and get decent results )Is there any further documentation on the python API? For example I can set different Ranges for current and voltage in android, yet there is only one “setHVRange” function.
Also, I plan to extend the script with a live plot – wondering if someone already did something similar?
Kind regards,
KajetanAnonymous
GuestKajetan,
I used the Python API for a power quality measurement project last summer, just to setup the meter, turn on streaming and log the mains (AC) voltage to a database.
The rest of the project was done as a web app. I used smoothiecharts to plot the voltage in realtime, and highcharts for the histograms.
I ran into a similar issue where the Python API didn’t do what I needed, but I was able to implement the missing features using the Android app source code as a reference.
Cheers, Matt
AlexMcHodgkins
MemberOh my, I just saw the Python-folder on github and didn’t think of going one level up. It’s all there on https://github.com/mooshim/ :)
Do you want to share your code with me (nefarius2001-tmpmooshforum159@yahoo.de)?
Since I hate it when several people have do the same work, my goal would be to provide something that can be remerged to the main python repository.Cheers,
Kajetanadmin
KeymasterHi guys,
Nefarious, I owe you an apology and I think I know what problem you encountered. Were the current measurements off by a factor of exactly 8?
There was a manufacturing change between the original meters used to fulfill the crowdfunding campaigns (and some subsequent orders) and a later manufacturing run. It was accounted for in the iOS and Android apps, but wasn’t handled in the Python API.
Speaking programmer to programmer: I’m unhappy right now with the protocol to the Mooshimeter, because it required the host (Android,iOS,or PC) to know specific hardware details about the meter itself. I haven’t posted in the blog recently because I’m deep in an overhaul that should provide a much cleaner interface to the meter… values will be calculated in firmware and transmitted in native units over the air, no more conversion on the iOS/Android side.
Unfortunately that’s not quite ready yet because the overhaul goes deep. If you’d like a preview of it you can look at the dev branch of the repository.
https://github.com/mooshim/Mooshimeter-PythonAPI/tree/dev
If you run in to more issues please feel free to post gists to the forum.
Best
~JamesAlexMcHodgkins
MemberHi James,
thanks for the answer, I will test this today.
Also I’m setting up a github for my project, using the Mooshimeter-PythonAPI as a submodule.The dev-commits look reasonable. Can you tell me if the dev-branch is usable? After fixing some stuff in my own code, master is now working and dev gives a “TypeError: exceptions must be old style classes or derived from BaseException, not NoneType”. Anyway, I will have to get back to other work now.
Personally, I’m a friend of having low level access as long as possible – for hacks & debugging. Providing calculated results is a huge gain in convenience, I would just recommend to keep a way to access the raw values as well. But that’s just an opinion.
Regards,
KajetanAlexMcHodgkins
MemberTest Results:
1.031 A Mooshim-Python times 8
1.000 A multimeter gelb (Pollin PDMM-390)
0.9975A multimeter orange (Keysight U1232A)12.404 V Mooshim-Python
12.06 V multimeter gelb (Pollin PDMM-390)
12.00 V multimeter orange (Keysight U1232A)Seems like I still have an calibration issue with the voltage, but at least it’s reasonable values :)
I forgot to include the Android measurements, so I briefly repeated them:
1.034 A Mooshim-Current times 8
1.0011 A Mooshim-Android
0.9975 A multimeter orange (Keysight U1232A)12.404 V Mooshim-Python
12.0070 V Mooshim-Android
12.00 V multimeter orange (Keysight U1232A)Guess I should also dig into the Android code and port the conversion from there…
Feel free to watch my progress with the project at
https://github.com/nefarius2001
(though it might take some days to have a well working state uploaded)AlexMcHodgkins
MemberNew Code, new test:
15.92 V multimeter orange (Keysight U1232A)
15.917 V Mooshim-Python
15.917 V Mooshim-Android1.0025 A multimeter orange (Keysight U1232A)
1.003 A Mooshim-Current
1.0030 A Mooshim-AndroidAll good now, took only an hour on the train!
See https://github.com/nefarius2001/Mooshimeter-PythonAPI (master branch)Regards
admin
KeymasterThank you so much nefarius! I will review this and merge.
Best
~JamesAnonymous
GuestKajetan,
I’m happy to share my graphing code.
Here is a simple web app that communicates with the Mooshimeter and graphs AC voltage (~125V) using smoothie.js:
https://github.com/mbkali/Mooshimeter-Flask
Cheers,
Matt
Anonymous
GuestHello James,
I am very interested in the python API because i use it to log solar panel data via bluetooth with a pi for almost a year now. by accident i noticed now, that my max. power measurements were very low for the last three months. yesterday my power meter showed >100W and mooshimeter still 30-35W (as every day) so i took a deeper look. it turned out, that the problem was linked to me doing a firmware update and connecting the android app to the mooshimeter three months ago. the app must have set the AMP range to something else than 10A, because my python programm logged max. current 2.3A.now i come to the reason why i write here in nefarius2001’s post:
Is there any further documentation on the python API? For example I can set different Ranges for current and voltage in android, yet there is only one “setHVRange” function.
Is there a possibility to set the AMP range fixed to 10A in the “old” python API?
- AuthorPosts