Read negative values on NAU7802 with Artemis?

New to coding and really new to Artemis.

Is it possible to get the Artemis Open Log to read loads in pos and neg directions?

I can’t get negative values from my load cell (SEN-14727 100gm bar and Qwiic Scale SEN-15242 ) and my Artemis Open Log DEV-16832. I can cheat it by adding weight during the zeroing step of the calibration and removing it when prompted to add it. In my case, zero load had a 260 output. Less than 260 was a load in one direction and more than 260 was a load in the opposite. I’d rather just carry a sign.

Is the source of my problem from line 190 on this code and how do I change that if possible:

https://github.com/sparkfun/OpenLog_Art … ensors.ino

As noob I can only understand the comment, not the code.

Thanks for reaching out to us on this.

The hookup guide for the NAU7802 https://learn.sparkfun.com/tutorials/qw … d-overview covers a few different scenarios you might want to set-up (it sounds like you want to adjust the zero offset and allow negative values, which requires using the functions covered in the guide)

Hope this helps, and happy sparking!

Thank you. I ran across that page weeks ago and forgot about it. Though I am still a bit confused. I see a variable(?) listed on that page that I assume I need to change to “allowNegativeWeights = true”. If that is the case where do I do that? Do I just type it into OLA setttings file? I don’t see a prompt for it in the terminal window.

From tutorial:

float getWeight(bool allowNegativeWeights = false) - Once you’ve set zero offset and cal factor, you can ask the library to do the calculations for you. By default, negative weights will be returned as 0.

Hi Joe5939,

The OLA does not currently support negative weights with the NAU7802. We would need to add that as a new feature to the code. Please feel free to raise it as a [Feature Request] issue on the OLA GitHub repo and we will get to it if we can:

https://github.com/sparkfun/OpenLog_Artemis/issues

Best wishes,

Paul

Thanks. Good not to be spinning my wheels.

Hey,

Like Joe5939, I would like to be able to record negative values with a NAU7802.

Before I submit a request, did anything change since you had this discussion?

Thanks,

Baptiste

I don’t believe it has changed (I looked through the closed issues and didn’t see one); feel free to open one regarding this :slight_smile:

Hi,

getWeight has a parameter that enables / allows negative weights:

https://github.com/sparkfun/SparkFun_Qw … ary.h#L183

getWeight(true); will get you going.

All the best,

Paul

Ah. Regarding negative weights on the OLA - those are (still) currently not supported. It looks like a Feature Request issue was never opened. If you’re wanting to measure negative weights on OLA, please go ahead and open a Feature Request.

Best wishes,

Paul

Thanks TS-Russel and Paul for the responses.

I compiled the code with getWeight(true) in the Sensor.ino file and it seems to be working fine.

Best,

Baptiste

I created an issue here https://github.com/sparkfun/OpenLog_Artemis/issues/176