From 79887395429af3012afaf1fd019a7409c659731b Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Tue, 12 May 2020 23:35:46 -0700 Subject: [PATCH] Added I2C Integration page #docs --- .../pyr0piezo-parameters.md | 16 +++++++++++-- .../config/pyropiezo-i2c/pyropiezo-i2c.md | 24 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 docs/tutorials/config/pyropiezo-i2c/pyropiezo-i2c.md diff --git a/docs/tutorials/config/pyr0piezo-parameters/pyr0piezo-parameters.md b/docs/tutorials/config/pyr0piezo-parameters/pyr0piezo-parameters.md index 2f3ecb5..472c98a 100644 --- a/docs/tutorials/config/pyr0piezo-parameters/pyr0piezo-parameters.md +++ b/docs/tutorials/config/pyr0piezo-parameters/pyr0piezo-parameters.md @@ -11,7 +11,8 @@ - To change sensor input pullup vRef low threshold: `VFOL` [integer in millivolts] - To change comparator trigger high threshold: `VCOMP` [integer in millivolts] - To change the duration between ADC measurements: `LOOP_D` [integer in milliseconds] -- To calibrate internal vRef **(see notes below): `CONST` [Vcc measurement in millivolts] +- To update the internal vRef constant value **(see notes below): `CONST` [long value] +- To update the internal vRef using a multimeter reading: `ADJUSTVCC` [integer in millivolts] You can also enable or disable DEBUG output with: `DEBUG [0|1]` @@ -52,7 +53,18 @@ The ADC reading function assumes an "ideal" multiplier constant. Each Atmega chip is slightly different, so it won't be completely accurate without tuning. Most of the time this won't be necessary, so don't mess with this if you don't know what you're doing! -The reading can be fine-tuned by using a multimeter. Simply take a voltage readig at the Anode of D1 and input it's value in millivolts afte rthe `CONST` command +The reading can be fine-tuned manually by using a multimeter, and this equation: + +`scale_constant = internal1.1Ref * 1023 * 1000` + +where + +`internal1.1Ref = 1.1 * Vcc1 (per voltmeter) / Vcc2 (per readVcc() function)` + +If the scale_constant calculated is different from the default 1125300, update the voltMeterConstant variable in pP_config.h with the correct value or send a new value with `CONST` + +Alternatively, you can input a direct reading from a multimeter, in millivolts, and have the sensor calculate the constant value automatically by using `VCCADJUST` + ## Sensitivity Tuning Workflow diff --git a/docs/tutorials/config/pyropiezo-i2c/pyropiezo-i2c.md b/docs/tutorials/config/pyropiezo-i2c/pyropiezo-i2c.md new file mode 100644 index 0000000..7b45f6e --- /dev/null +++ b/docs/tutorials/config/pyropiezo-i2c/pyropiezo-i2c.md @@ -0,0 +1,24 @@ +# Integration using I2C + +Default I2C Address: 0x10 + +## I2C Command Register Map + +see [Pyr0-Piezo Parameters Explanation](../pyr0piezo-parameters/pyr0piezo-parameters.md) for more specific details on the command aliases. + +|I2C Register|Command Alias|Arguments|Type|Bytes Length +|---|---|---|---|---| +|0x00|GAIN_F|Gain Factor|Input|2 +|0x01|VFOL|Millivolts|Input|4 +|0x02|VCOMP|Millivolts|Input|4 +|0x03|LOOP_D|Milliseconds|Input|2 +|0x04|TRG_D|Milliseconds|Input|2 +|0x05|HYST|Millivolts|Input|2 +|0x06|LOGIC|Boolean|Input|2 +|0x07|PZDET|Boolean|Input|2 +|0x08|CONST|Millivolts|Input|4 +|0x09|CONFIG|None|Output|32 +|0x0a|ERASE|None|Input|1 +|0x0b|STATE|None|Output|10 +|0x0c|VCCSW|Boolean|Input|1 +|0x0d|VCCADJUST|Millivolts|Input|4