New Sparkfun power meter
I just saw a new product from Sparkfun : Sparkfun power meter-ACS37800. Since they do not show any useful code, for me anyway. I am wondering if this board could be used with the P2 Edge product. I am not even sure if Spin2 could handle this. Since I am not a Spin2 person, maybe some example code could be provided, if this board could be used with the Edge.
Thanks
Ray

Comments
It's an I2C device, so yes, you could use it with the Edge -- all you need is an I2C library and a bit of interface code.
My P2 I2C object: https://obex.parallax.com/obex/i2c/
For an I2C connection the small differences between Spin1 and Spin2 are inconsequential. That said, on the I2C library page in ObEx there is a bus scanner example that will show you how to work with that library.
Thanks Jon, I think I will buy that board, and try my luck with getting it connected to a P2 Edge. Now I am trying to decide if I should take up learning how to use Spin2. I saw your presentation for the maaca spin tools, I just might have to install it on a Windows box, and maybe try doing some Spin2 stuff, not quite sure about that just yet.
I think that since there is a ton of example code, for Spin2, it should be much easier to learn the Spin2, this time around, will see.
Ray
Spin2 -- like Spin1 -- is very easy, and in many ways nicer. For example, built-in pin control with pinhigh(), pinlow(), pintoggle(), etc. Delays, too, with waitms() and waitus() (though each are limited to a ~10 second delay). My favorite part is inline assembly. If you look at my I2C library for the P2 you'll see that it's all assembly code, but it doesn't invoke a cog.
The P2 has a few new opeators, but something I like is that >= and <= behave as expected. I also like the ternary operator.
BTW, if your project can use the INA219
-- https://www.adafruit.com/product/904
I have P1 and P2 demo code. I use that device in laser tag and other projects, and even built my own P2-Accessory style board for it.
On Windows, all you have to do is unzip a folder to the location of your choice. Easy-peasy. Marco has done an amazing job with it and -- from my experience, anyway -- is open to suggestions that make sense.
Just a reminder: Don't try to conquer Spin2 (or anything, for that matter) in a day. Poke around very slowly. Spin2 is bigger than Spin1 so there is a lot to learn, especially when it comes to Smart Pins (which also save a lot of cogs). A nice thing about Spin2 is that it is not burned into the silicon; it actually gets downloaded with your code. This has allowed Chip to make improvements to it as those of us who work with Spin2 have ideas.
There have certainly been additions, and maybe a few changes, yet this article that I wrote way back in the beginning of the P2 might be helpful.
-- https://www.nutsvolts.com/magazine/article/an-introduction-to-the-parallax-propeller-2
Definitely don't use the code that can be downloaded from that article; get the latest from ObEx.
I just looked into the INA219 breakout board, very interesting. I will have to see what kind of voltage my solar panel array is producing. Maybe I can use the INA219 instead. And since you have some spin code, maybe I can use your code.
What I am thinking about now, is getting the solar panel array voltages and data logging the input. Not sure how I would do that with Spin2. Doing it with Python was very easy, plus I could easily open the log file to view the data. With Spin2 this might be a little more than I can handle, will have to see.
Ray
I don't think the INA219 is going to work in that application
Hi,
I am using WCS1700 sensor modules to log data from solar panels (24V nominal). They convert a current to a voltage and are therefore easy to interface, if you are able to measure voltage. They have high voltage insulation.
The ACS37800 seems to be something, that amateurs will not use too often. It is especially well suited for AC. But cannot handle mains voltage due to the limit to 60V. Has +/-100mA noise floor, that is a lot for many projects. It can give power directly but needs a microcontroller, which could calculate power. Good thing is, that it comes fully calibrated.
Writing a driver for a I2C device, if you have the basic driver for the protocol (which Jon gave you), is mainly a question of will and time and -most important- not to have too much respect. You have to study the data sheet https://www.allegromicro.com/-/media/files/datasheets/acs37800-datasheet.pdf?sc_lang=en, which register you want to read. Probably 0x2A for voltage and current, page 42. Then you have to find out how to address the chip and read that single 32bit register. When you have managed to read that one register, then you can think about all the other many possibilities, which you probably don't need.
Cheers Christof
Brief description:
I have six solar panels setup in parallel, the panel is 200 W, approx 10 amp, 12 V. I think the max Volts are about 17 V output. Of course the amps could be as 60, but that is on a perfect sunny day. So I think that the INA219 would do the job.
What I want to do is data log the output of the solar panel array, so I could get an idea of what time of the day I am getting max output and maybe some other data depending on what the INA219 provides. The logged data will be entered into an SQLite database, not even sure if P2 Edge could work with that.
Just thinking about this, I think I will have to pair up the P2 Edge with my Dell server box, not even sure how that will work. This project is starting to grow, from a software perspective.
Ray
After getting more information, the boards will not work for my project.
The INA219 is only good for +/- 3 A.
The Sparkfun board is only good for +/- 30 A.
Since my system will be exceeding 30 A, I have to figure out something else. Anybody have any ideas.
Ray
One for each panel?
Personally would be inclined to insert a crv on the low side and just measure voltage across it directly with P2…
Anybody have any ideas.
https://www.amazon.de/Stromsensor-Kurzschlussschutzmodule-Einstellbarer-Überstromschutz-Überstromerkennung/dp/B09L61Q662?th=1
WCS1700 can measure up to 70A DC. WCS1600 up to 100A.
As said I do use it.
Cheers Christof