https://github.com/biotinker/viam-nau7802
https://github.com/biotinker/viam-nau7802
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/biotinker/viam-nau7802
- Owner: biotinker
- License: agpl-3.0
- Created: 2024-02-28T01:36:03.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-17T17:21:03.000Z (over 1 year ago)
- Last Synced: 2025-03-11T04:44:03.433Z (over 1 year ago)
- Language: Go
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# viam-nau7802
A Viam module to use a nau7802 load cell amplifier
## Setup
Add the module to your robot from the Viam registry. The component may then be added to your configuration as follows (using example values)
```
...
"components": [
...,
{
"name": "componentNameHere",
"model": "biotinker:sensor:nau7802",
"type": "sensor",
"namespace": "biotinker",
"attributes": {
"zero": 161000,
"kg": 50000,
"gain": 128,
"samples": 16,
"i2c_bus": "0"
}
},
...,
],
...
```
The attributes `gain` and `samples` are optional.
If `gain` is not set, it will default to 64. Valid `gain` values are 1, 2, 4, 8, 16, 32, 64, and 128. Gain should be set higher for lower capacity load cells. Any change to `gain` requires re-calibration.
If `samples` is not set, it will default to 8. This value is the number of readings which will be taken in quick succession and averaged together to give the reading. Valid `samples` values is any positive integer.
## Calibration
The output of the sensor has two values, a raw reading and a kg reading. The kg reading will be meaningless without proper calibration.
First, assemble your apparatus. Take a reading with nothing on the scale. This raw value should be entered into the `zero` field in your configuration.
Then, place an item of known weight on the scale and record the raw value. The value to fill in for `kg` is the amount that the raw value is expected to change for each kg of weight. For example, if your zero value is 163540, and you place a 200g item on the scale and that raw value is 167315, then your kg value should be `(167315-163540) * (1000g/200g)` which equals `18875`
The `kg` value may be negative, for example if your load cell is installed upside down.