Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peripherals/doc; Added Documentation to Peripherals #294

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/src/media/DS18B20-Sensor-Pinout.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions firmware/peripherals/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,35 @@
@defgroup peripherals Peripherals
@ingroup m4a-firmware

### What goes here?
### Peripherals
Specific documentation for our reference peripherals;
In the next module you can find:

### ds18_sensor
### Kconfig Setup

Module to get temperature data.
The peripherals has an effect in each board. a property of the board is periph_conf where is all
specifications of each communication protocol used, converters analog to digital, and PWM parameters.
So, peripherals actually provides support to manage de VREF of ADC channels, This will give more precision
with the measurements.

### moisture_sensor
| Macro of the periph_conf | Voltage Referenced | type |
|:-------------------------------:|:------------------------------------:|:---------------:|
| CONFIG_ADC_VREF_DEFAULT | 1.0V | Internal |
| CONFIG_ADC_VREF_INTVCC0 | 1/1.48 VDDANA | Internal |
| CONFIG_ADC_VREF_INTVCC1 | 1/2 VDDANA (only for VDDANA > 2.0V) | Internal |
| CONFIG_ADC_VREF_EXT1 | External reference #1 | External |
| CONFIG_ADC_VREF_EXT2 | External reference #2 | External |

Module to get moisture data.
### Ds18_sensor

This is a soil temperature sensor that could provide the current measurement
in degrees centigrades "°C". this works with any digital pin, but needs to use the
one wire protocol to obtain the data from itself.

### Moisture_sensor

A peripheral that could read through adc pins, getting an analog measurement, this works with a
10-bit resolution, and it's adjustable to work with 3.3V (in low consumption) and 5V for more
information about the peripheral see @ref moisture_sensor module

*/
27 changes: 23 additions & 4 deletions firmware/peripherals/ds18_sensor/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@
@defgroup ds18_sensor Ds18 sensor
@ingroup peripherals

### What goes here?
### Ds18 soil sensor

This module is used to get the data of the temperature sensor. The function
``` init_temperature_sensor ```initialize the sensor and the function
``` get_temperature_value ``` gets the values.
The ds18b20 is a temperature sensor with a range between -55 °C and 125 °C, its operative
voltage is 3V or 5V respectively, only needs a data pin to transfer data an a MCU using one-wire communication.
Has an acurracy of 0.5 °C. The output resolution is programmable between 9 - 12 bits, conversion time of 750 ms
at 12-bit resolution.

### Pinout scheme

\image html DS18B20-Sensor-Pinout.jpg Ds18b20 Pinout scheme width=40%

This module works with the ds18b20 peripheral, this implement two steps,
`init_temperature_sensor()` and `get_temperature_value()`. the first function checks
if the peripheral is connected to a designed pin. when the initialization it's successfully returns `DS18_OK`
in case that the peripheral was not found returns a `DS18_ERROR`.

To the function `get_temperature_value()` needs receive a int16_t variable as parameter (Signed Integer variable), because the
peripheral could operates with positive and negative values. when you are reading the received data it could be observed
in this way:

| Value read |Integer part | Decimal part | Temp read in °C |
|:-----------:|:-----------------:|:-----------------:|:---------------:|
| 1517 | 15 | 17 | 15.17 °C |
| -1517 | -15 | 17 | -15.17 °C |

*/
20 changes: 16 additions & 4 deletions firmware/peripherals/moisture_sensor/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
@defgroup moisture_sensor Moisture sensor
@ingroup peripherals

### What goes here?
### Analog Capacitive Moisture sensor V1.2

This module gets the data of the moisture sensor.
This module contains all about the manage the read data from the Moisture sensor. It's an Analog
sensor that operates betwwen 3.3V and 5.0V, has three pins VCC (Red wire), GND (Black wire), DATA (Yellow Wire),
There is a fixed frequency oscillator that is built with a 555 Timer IC. The square wave generated is then fed
to the sensor like a capacitor. To a square wave signal that capacitor, however, has a certain reactance, or
for argument’s sake a resistance that forms a voltage divider with a pure ohm type resistor (the 10k one on pin 3).
The greater is the soil moisture, the higher the capacitance of the sensor. Consequently, there is a smaller reactance
to the square wave, thus lowering the voltage on the signal line. The voltage on the Analog signalpin can be measured by
an analog pin of a MCU.

Note: This is an adc device, for the correct functioning of this module you have to use 3.3V
and 10bits resolution.
@image html Electronic-sheme-analog_moisture_sensor.png Fig. 1.1 Electronical scheme of the Analog Capacitive Moisture Sensor V1.2 width=40%

@note The resolution supported is 10 bit.

@warning There a line drawn on the analog sensor, this represent the operating zone to get the humidity from the soil and
the circuit zone of the device (This limits could affect the sensor and its functionality).

@image html Analog_moisture_sensor_001.jpeg Fig. 1.2 Representation of limits to use the moisture sensor. width=20%
*/