Skip to content

Commit

Permalink
Merge pull request #35 from pyr0ball/loredans-additions
Browse files Browse the repository at this point in the history
Merging Loredans additions.

Conflicts were resolved in pull from @loredan fork
  • Loading branch information
pyr0ball committed Sep 25, 2019
2 parents 21a37ee + cf34ffd commit 5f963d4
Show file tree
Hide file tree
Showing 23 changed files with 796 additions and 526 deletions.
292 changes: 70 additions & 222 deletions docs/changelog.md

Large diffs are not rendered by default.

@@ -1,4 +1,4 @@
###Pyr0-Piezo Changelog v2.1.2 to beta-avr-v2.1.3
###Pyr0-Piezo Changelog v2.1.2 to v2.1.3

#### Added Features

Expand Down
64 changes: 64 additions & 0 deletions docs/changelogs/changelog_2019-09-25_v2.1.3_v2.1.4.md
@@ -0,0 +1,64 @@
###Pyr0-Piezo Changelog v2.1.3 to v2.1.4

#### Added Features

- Added EEPROM support for storing nvol settings [view commit](http://github.com/pyr0ball/pyr0piezo/commit/5d72a5e817c182b90b1c9c7158d99bce744121f7)

- complete overhaul of serial input and debug output [view commit](http://github.com/pyr0ball/pyr0piezo/commit/9e885f316effc105f29027d1b859969f77477851)

- updated serial input explaination to match new schema [view commit](http://github.com/pyr0ball/pyr0piezo/commit/f4af33fe75c8306b567fdcaed92f238a0757499f)

- Added input parameter for vref constant [view commit](http://github.com/pyr0ball/pyr0piezo/commit/e416f1407251516217271dc6d09cad009e482987)


------------------------------------

#### Bugfixes

- synced nomenclature for vfollower variables [view commit](http://github.com/pyr0ball/pyr0piezo/commit/9f172f1c1811d2084bfaf8771f36a87be4b083ab)

- removed duplicate definition [view commit](http://github.com/pyr0ball/pyr0piezo/commit/a58a7d029f7332c47529b393d8b9c7ec140cd19e)


------------------------------------

#### Full Changelog

- Initial PlatformIO conversion [view commit](http://github.com/pyr0ball/pyr0piezo/commit/b35e11696e97826a48bfd4b67bf968b803ecb49f)

- Saving settings to EEPROM and other IMO sensible changes [view commit](http://github.com/pyr0ball/pyr0piezo/commit/6b9ea8ef06b5cac687a1fa3bb2bbc2e86cc9b85d)

- Merge branch 'loredans-additions' of https://github.com/pyr0ball/pyr0piezo [view commit](http://github.com/pyr0ball/pyr0piezo/commit/14651c0d8a27d1431cde9436dea7f583e87e192f)

- Updated gitignore, removed unnecessary files #changelog [view commit](http://github.com/pyr0ball/pyr0piezo/commit/4165075fa04e9d272c837c94496393b7f12da8a5)

- Merge pull request #34 from loredan/master [view commit](http://github.com/pyr0ball/pyr0piezo/commit/6d471fd928e0e8528847f633a7832416d6675690)

- synced nomenclature for vfollower variables [view commit](http://github.com/pyr0ball/pyr0piezo/commit/9f172f1c1811d2084bfaf8771f36a87be4b083ab)

- Added EEPROM support for storing nvol settings [view commit](http://github.com/pyr0ball/pyr0piezo/commit/5d72a5e817c182b90b1c9c7158d99bce744121f7)

- complete overhaul of serial input and debug output [view commit](http://github.com/pyr0ball/pyr0piezo/commit/9e885f316effc105f29027d1b859969f77477851)

- syntax cleanup #changelog [view commit](http://github.com/pyr0ball/pyr0piezo/commit/26d7a978d3b91ebc985dd5a2531db3ce93cce9ff)

- more syntax fixes (from merge) #changelog [view commit](http://github.com/pyr0ball/pyr0piezo/commit/9ce36b86075be7ab63fc5a7872633c33d9f57950)

- actually added some of the changes intended for previous commit [view commit](http://github.com/pyr0ball/pyr0piezo/commit/59387f85027443852feffed5704f2e4e79e9d95d)

- restructured AVR firmware directory for vscode/PIO #changelog [view commit](http://github.com/pyr0ball/pyr0piezo/commit/6618f35f7d874082fde64678715ce25b670e8ce2)

- migrated vscode comfig files [view commit](http://github.com/pyr0ball/pyr0piezo/commit/bf33ef43d7cdac37e594681d37dcbfd043756392)

- updated serial input explaination to match new schema [view commit](http://github.com/pyr0ball/pyr0piezo/commit/f4af33fe75c8306b567fdcaed92f238a0757499f)

- Cleanup remaining merge files #changelog [view commit](http://github.com/pyr0ball/pyr0piezo/commit/5dd279775a475c2e9f271fbf0d9c5aacc25821de)

- fixed variable typo [view commit](http://github.com/pyr0ball/pyr0piezo/commit/d00b0d078a732321b527347aaf95e33d84dfe3f0)

- removed duplicate definition [view commit](http://github.com/pyr0ball/pyr0piezo/commit/a58a7d029f7332c47529b393d8b9c7ec140cd19e)

- Added input parameter for vref constant [view commit](http://github.com/pyr0ball/pyr0piezo/commit/e416f1407251516217271dc6d09cad009e482987)

- slight change in comment structure [view commit](http://github.com/pyr0ball/pyr0piezo/commit/aa6e3148a2f259023d83884bbcfd2365e75ee605)

93 changes: 92 additions & 1 deletion docs/config.md
@@ -1 +1,92 @@
#Under construction
## Configurations over UART/Serial TTY

To set the below parameters using serial input, use the following:

- To change trigger active duration: `TRG_D` [integer for milliseconds]
- To change gain factor: `GAIN_F` [integer for gain state - see note*]
- To change ADC hysteresis value: `HYST` [integer]
- 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]

You can also enable or disable DEBUG output with: `DEBUG` [0|1]

You can query the current configuration with: `CONFIG`
You can query the current state (including ADC measurements) with: `STATE`

To reset all settings to defaults, use: `RESET`


These commands should be wrapped in this format:
1CMD INT1

Examples:

- `GAIN_F 3` <~ set gain factor to index 3 (6x)
- `VFOL 2350` <~ set the vref floor to 2.35V
- `DEBUG 1` <~ Enable debug output
- `STATE` <~ display current sensor status

*Note for Gain Factor:
The gain STATE is representative of these values:
0 = 3x
1 = 3.5x
2 = 4.33x
3 = 6x
4 = 11x

------------------------

## Calibrating the internal vRef

The adc calculation in this sensor assumes an "ideal" constant value which
is used to convert the internal 1.1v reference.

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, 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.

## Configuration in firmware

All default configurations are stored in `pP_config.h`.

`#define GAIN_FACTOR_DEFAULT 2`
- Gain adjustment factor. 0=3x, 1=3.5x, 2=4.33x, 3=6x, 4=11x


`#define FOLLOWER_THRESHOLD_DEFAULT 1450`
- Voltage follower default voltage in millivolts (1/1000V)

`#define COMP_THRESHOLD_DEFAULT 2850`
- Comparatore Vref default voltage in mV

`#define InitCount 6`
- Number of times to blink the LED on start

`#define LOOP_DUR_DEFAULT 50`
- Duration of time between ADC checks and other loop functions

`#define TRG_DUR_DEFAULT 20`
- Duration of the Z-axis pulse sent, in ms

`#define HYST_DEFAULT 20`
- Software hysteresis for ADC/DAC adjustment, in mV (±20 default)

`extern long voltMeterConstant = 1125300L;`
- For fine tuning input voltage sense

`extern byte pP_i2c_address = 0xa0;`
- I2C Bus Slave Address
7 changes: 7 additions & 0 deletions firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/.gitignore
@@ -0,0 +1,7 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.vscode/settings.json
.travis.yml
@@ -0,0 +1,6 @@
{
"board": "MiniCore:avr:328",
"configuration": "bootloader=uart0,variant=modelPB,BOD=1v8,LTO=Os,clock=8MHz_internal",
"programmer": "AVRISP mkII",
"sketch": "src\\Pyr0_Piezo_Sensor_v2.x.x.cpp"
}
@@ -0,0 +1,23 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${HOME}\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.0.3\\**",
"${workspaceFolder}\\**",
"D:\\Arduino\\**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files\\LLVM\\bin\\clang.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"forcedInclude": []
}
],
"version": 4
}
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
41 changes: 0 additions & 41 deletions firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_config.h

This file was deleted.

0 comments on commit 5f963d4

Please sign in to comment.