breadboard
documentación

Proyecto de ejemplo · Montajes y proyectos

Monitor para plantas (Nano)

Un panel para plantas basado en la particularidad del Arduino Nano: A6 y A7, dos pines solo analógicos que el Uno no tiene. La sonda de suelo va a A6 y el divisor de luz a A7, dejando libres los pines digitales para la barra de 8 LED en D2–D9, con las ocho resistencias en una red de resistencias DIP-16. Firmware Arduino real compilado informa suelo, luz y temperatura (TMP36 en A0) dos veces por segundo. Selecciona el sensor y arrastra su control Moisture: la barra y el estado de la planta la siguen.

El circuito Monitor para plantas (Nano) tal como lo dibuja el simulador

Componentes del montaje

  • 8× LED
  • Arduino Nano
  • Fotorresistencia (Photoresistor)
  • Red de resistencias ×8 (Resistor array ×8)
  • Resistencia (Resistor)
  • Sensor de humedad del suelo (Soil Moisture)
  • Temperatura (TMP36) · Temp (TMP36)

Cómo está conectado

  • orificio B+13→orificio j23
  • orificio B-13→orificio a23
  • orificio a4→orificio B+6
  • orificio a6→orificio B-5
  • orificio c5→orificio j31
  • orificio a9→orificio B+9
  • orificio a10→orificio B-10
  • orificio c11→orificio j25
  • orificio h23→orificio f40
  • orificio i42→orificio h24
  • orificio i45→orificio B-43
  • orificio a24→orificio a55
  • orificio g55→LED · a
  • LED · k→orificio B-14
  • orificio a25→orificio a56
  • orificio g56→LED · a

…y 19 conexiones más. Ábrelo en el simulador para ver todos los cables.

El código

Este sketch de Arduino C++ está en Code; inicia sesión y pulsa Compile & upload para compilar firmware real para la placa emulada.

// ============================================================
// PLANT MONITOR — an Arduino Nano houseplant dashboard.
//
// This bench exists because of the Nano's two EXTRA analog pins:
// A6 and A7 are ADC-only pads on the Nano's TQFP-32 package — they
// have no digital function at all (no pinMode, no digitalRead, no
// pull-up), so they are the perfect home for analog sensors, and
// using them keeps EVERY digital pin free for the display:
//
//   soil-moisture probe   A6  (the sensor prints ~2.5 V bone-dry,
//                              ~0.2 V waterlogged)
//   photoresistor divider A7  (LDR from 5 V, 10 k to ground —
//                              bright light pulls the node high)
//   TMP36 thermometer     A0  (0.5 V + 10 mV/°C)
//   8-LED moisture bar    D2–D9, all eight series resistors in ONE
//                              DIP-16 resistor-array package
//
// Twice a second it narrates the plant's world over serial and
// redraws the bar: each LED is ~12.5% soil moisture. Click the soil
// sensor or the photoresistor in the Inspector and drag their
// sliders — the narration and the bar follow.
// ============================================================

const uint8_t BAR_PINS[8] = {2, 3, 4, 5, 6, 7, 8, 9};

void setup() {
  Serial.begin(9600);
  for (uint8_t i = 0; i < 8; i++) {
    pinMode(BAR_PINS[i], OUTPUT);
    digitalWrite(BAR_PINS[i], LOW);
  }
  Serial.println(F("Plant monitor online (Nano A6/A7 on sensor duty)"));
}

void loop() {
  // A6 — soil probe: 2.5 V dry .. 0.2 V soaked, mapped to 0..100%.
  float soilV = analogRead(A6) * 5.0 / 1023.0;
  int soilPct = (int)((2.5 - soilV) * 100.0 / 2.3);
  soilPct = constrain(soilPct, 0, 100);

  // A7 — light divider: percent of full scale is plenty for a plant.
  int lightPct = (int)(analogRead(A7) * 100L / 1023L);

  // A0 — TMP36: 500 mV offset, 10 mV per degree C.
  float tempC = (analogRead(A0) * 5.0 / 1023.0 - 0.5) * 100.0;

  // Moisture bar: one LED per 12.5%, through the 8-element array.
  int lit = (soilPct * 8) / 100;
  for (uint8_t i = 0; i < 8; i++) {
    digitalWrite(BAR_PINS[i], i < (uint8_t)lit ? HIGH : LOW);
  }

  const char *mood = soilPct < 25 ? "THIRSTY" : soilPct > 75 ? "SOAKED" : "HAPPY";

  Serial.print(F("Soil "));
  Serial.print(soilPct);
  Serial.print(F("% ("));
  Serial.print(mood);
  Serial.print(F(") | Light "));
  Serial.print(lightPct);
  Serial.print(F("% | Temp "));
  Serial.print(tempC, 1);
  Serial.print(F(" C | ["));
  for (uint8_t i = 0; i < 8; i++) Serial.print(i < (uint8_t)lit ? '#' : '.');
  Serial.println(F("]"));

  delay(500);
}
Informar de un problema de traducción

Proyectos relacionados