sparkfun / SparkFun_Qwiic_Scale_NAU7802_Arduino_Library

An Arduino library to interface with load cells using the Qwiic interface and the NAU7802.
https://www.sparkfun.com/
Other
20 stars 28 forks source link

Select Channel 2? #5

Closed lbussy closed 2 years ago

lbussy commented 2 years ago

Subject of the issue

Query about using the second channel

Your workbench

This is generic, I have not yet designed my project

Steps to reproduce

N/A

Expected behaviour

I would like to be able to select between CH1 and CH2

Actual behaviour

Nothing yet!

I can see from the data sheet that there are two channels available on the NAU7802. I realize your breakout board is specifically designed for simplicity and a single channel. Nevertheless, your library and the one from Adafruit are the only ones I see available right now, and I do see what appear to be vestiges of CH2 support.

I see what I think is turning on support for the cap on CH2 (for stability I believe) in Enable 330pF decoupling cap on chan 2

I also see that you have a member function NAU7802::setChannelSelect() (currently not used) which allows selecting between channels 1 and 2.

Do I understand that part correctly? So if I wanted to use two channels (two load cells) I should be able to remove the decoupling cap enable and then select one or the other and read them?

nseidle commented 2 years ago

You are correct, channel 2 doesn't get much use. However it is covered in the HG:

Channel 2 The NAU7802 has a 2nd, optional ADC channel that has a much lower input capacitance (5pF vs 14pF) but is otherwise identical to the 1st channel. By default, this channel has a 330pF capacitor across its inputs. This helps reduce noise on channel one. If you’d like to use the 2nd channel, we recommend removing the capacitor by cutting the CAP jumper. Not sure how to cut a trace? Read here for more information!

Channel two is brought out to PTH holes:

image

There is a cap crossing B+/B- that can be removed as needed by cutting the jumper:

image

NAU7802::setChannelSelect() will allow you to select between the channels.

lbussy commented 2 years ago

Thanks for the reply @nseidle. I think I asked my question in a manner that was not immediately clear. My question was more about the library than the break-out boards.

You did answer I think, but I'd like to be sure:

NAU7802::setChannelSelect() will allow you to select between the channels.

Leaving aside the hardware for a moment, is the library capable of selecting between them with no changes, or would I have to change the way the initialization works within NAU7802::begin() to not indicate that there is a 330pF decoupling cap on chan 2?

nseidle commented 2 years ago

I have only done basic testing but after you've begin(), calling setChannelSelect(0) or 1 will switch which ADC output the device produces.

lbussy commented 2 years ago

Great, thank you so much! I already have a couple of your boards to test with as well so I'll do some reengineering on those when I get a spare moment.

PaulZC commented 8 months ago

I know this issue is years old, but #7 contains some proto-code which may help.