Diferencia entre revisiones de «Sensor de humedad del suelo»

De fabwiki
Ir a la navegación Ir a la búsqueda
Sin resumen de edición
Sin resumen de edición
 
(No se muestra una edición intermedia del mismo usuario)
Línea 17: Línea 17:
Humedad de suelo 1.2 esquemático.png
Humedad de suelo 1.2 esquemático.png
</gallery>
</gallery>
* https://thecavepearlproject.org/2020/10/27/hacking-a-capacitive-soil-moisture-sensor-for-frequency-output/
=Simulación por Ngspice=
<pre>
.title sensor humedad suelo
.include 555.cir
.include 1n4148.lib
.param c_soil = "100p"
*          Ground
*          | Trigger
*          | | Output
*          | | | Reset
*          | | | | Control
*          | | | | | Threshold
*          | | | | | | Discharge
*          | | | | | | | Vcc
*          | | | | | | | |
*      555 1 2 3 4 5 6 7 8
x1 0 6 3 4 5 6 7 8 555
vcc 8 0 5
vreset 4 0 5
csoil sensor1 0 {c_soil}
r1 3 0 10k
c2 6 0 470p ic=0v
r3 7 4 330
r4 7 6 1.6k
c3 5 0 10n
r5 3 sensor1 10k
d1 sensor1 signal 1n4148
r6 signal 0 1meg
c4 signal 0 1n
.tran 10n 200u uic
.control
  run
  meas tran astable_period TRIG v(3) VAL=2.5 RISE=3 TARG v(3) VAL=2.5 RISE=4
  let astable_frequency = 1.0/astable_period
  print astable_frequency
  plot v(3) v(6) v(signal)
.endc
.end
</pre>

Revisión actual - 00:20 10 ago 2026

void setup() {
  Serial.begin(9600);
}

void loop() {
  int s = analogRead(A0);
  long humedad;
  // long map(long x, long in_min, long in_max, long out_min, long out_max)
  humedad = map(s, 150, 437, 100, 0);
  Serial.println(humedad);
  delay(1);
}

Simulación por Ngspice

.title sensor humedad suelo
.include 555.cir
.include 1n4148.lib

.param c_soil = "100p"

*           Ground
*           | Trigger
*           | | Output
*           | | | Reset
*           | | | | Control
*           | | | | | Threshold
*           | | | | | | Discharge
*           | | | | | | | Vcc
*           | | | | | | | |
*       555 1 2 3 4 5 6 7 8 

x1 0 6 3 4 5 6 7 8 555

vcc 8 0 5
vreset 4 0 5

csoil sensor1 0 {c_soil}

r1 3 0 10k
c2 6 0 470p ic=0v
r3 7 4 330
r4 7 6 1.6k
c3 5 0 10n

r5 3 sensor1 10k
d1 sensor1 signal 1n4148
r6 signal 0 1meg
c4 signal 0 1n

.tran 10n 200u uic

.control
  run
  meas tran astable_period TRIG v(3) VAL=2.5 RISE=3 TARG v(3) VAL=2.5 RISE=4
  let astable_frequency = 1.0/astable_period
  print astable_frequency
  plot v(3) v(6) v(signal)
.endc

.end