Maqueta de Parada de Autobús Inteligente con Toldos Automáticos
Componentes y suministros
| Componente | Descripción | Cantidad |
|---|---|---|
| Arduino Nano R3 | Pequeño, fácil de ocultar en maqueta. | 1 |
| Servo MG995 | Servo de alta potencia para toldo pesado. | 1 |
| Fotorresistencia | Una orientada Este, otra Oeste. | 2 |
| Sensor de lluvia | Detecta precipitación. | 1 |
| LED blanco alta luminosidad | Iluminación interior y farola. | 6 |
| Resistencia 220Ω | Para LEDs. | 3 |
| Protoboard | Conexiones. | 1 |
| Cables jumper Macho-Macho | 27 unidades. | 27 |
| Bornas de tornillo | Conexiones seguras. | 2 |
| Conector batería 9V | Para Arduino y servo. | 2 |
| Batería 9V | Alimentación Arduino. | 1 |
| Portabaterías 4xAA | Alimentación servo MG995. | 1 |
Sobre el proyecto
Versión 2.0 de maqueta arquitectónica (1.5m x 1m). Mejoras respecto a V1.0:
- Servo MG995 para toldo más pesado.
- Fuente externa para el servo.
- Dos mecanismos probados para desplegar/recoger toldo (el definitivo en video 3).
- Uso de librería
VarSpeedServopara movimiento suave. - Corrección lógica en estados del toldo (gracias a Gurneet1928).
Código
#include <VarSpeedServo.h>
VarSpeedServo servo;
int easternLight = 0, westernLight = 0, rainSensed = 0, sunshadePosition = 0;
int rainThreshold = 512;
int sunshadeExpanded = 120, sunshadeContracted = 60;
int ambientLighting = 0, turnOnLightsOn = 150, ledIntensity = 0, ledPower = 0;
int servoSpeed = 20;
bool debugging = false;
void setup() {
pinMode(A4, OUTPUT); // Iluminación interior
pinMode(A5, OUTPUT); // Farola
pinMode(A1, INPUT); // Luz Oeste
pinMode(A2, INPUT); // Luz Este
pinMode(A3, INPUT); // Sensor lluvia analógico
pinMode(2, INPUT); // Sensor lluvia digital
servo.attach(A0);
servo.write(sunshadeContracted, servoSpeed, true);
if (debugging) { Serial.begin(9600); Serial.println("*** DEBUGGING STARTED ***"); }
}
void oya_mydebug(String text, int value = NULL) {
if (debugging) {
Serial.print(text);
if (value) { Serial.print(" = "); Serial.println(value); }
else Serial.println();
}
}
void expand_collapse(int easternLight, int westernLight) {
if (easternLight <= westernLight) { // Amanecer
oya_mydebug("It's sunrise");
if (sunshadePosition != sunshadeExpanded) {
servo.write(sunshadeExpanded, servoSpeed, true);
oya_mydebug("Sunshade expanded");
}
}
if (easternLight > westernLight) { // Atardecer
oya_mydebug("Sun is going down");
if (sunshadePosition != sunshadeContracted) {
servo.write(sunshadeContracted, servoSpeed, true);
oya_mydebug("Sunshade contracted");
}
}
}
void loop() {
easternLight = analogRead(A2);
westernLight = analogRead(A1);
rainSensed = analogRead(A3);
sunshadePosition = servo.read();
ambientLighting = (easternLight + westernLight) / 2;
oya_mydebug("easternLight", easternLight);
oya_mydebug("westernLight", westernLight);
oya_mydebug("rainSensed", rainSensed);
oya_mydebug("sunshadePosition", sunshadePosition);
oya_mydebug("ambientLighting", ambientLighting);
if (rainSensed < rainThreshold) { // Llueve
oya_mydebug("It's raining...");
if (sunshadePosition != sunshadeExpanded) {
servo.write(sunshadeExpanded, servoSpeed, true);
oya_mydebug("Sunshade expanded");
}
} else { // No llueve
oya_mydebug("It is not raining...");
if (ambientLighting <= turnOnLightsOn) { // Oscurece
oya_mydebug("It's getting dark, turning on the lights");
ledPower = ((turnOnLightsOn - ambientLighting) * 4);
oya_mydebug("ledPower", ledPower);
analogWrite(A5, ledPower);
analogWrite(A4, ledPower);
expand_collapse(easternLight, westernLight);
} else { // Mucha luz
oya_mydebug("A lot of sunshine, turn off lights");
analogWrite(A5, 0); analogWrite(A4, 0);
expand_collapse(easternLight, westernLight);
}
}
if (debugging) { Serial.println("********************"); delay(5000); }
else delay(100);
}
Esquemático

Proceso de manufactura
- Trenes modelo Lionel: historia, fabricación y futuro
- Robot Clasificador de Reciclaje con Google Coral Edge TPU
- Control Automático de Tren DIY con Arduino: Simple, Fiable y Personalizable
- Robot evasor de obstáculos con servo: Construcción con Arduino y HC-SR04
- Sistema automático de riego para plantas con Arduino
- Fundamentos de la Prensa Servo: Potencia, Precisión y Eficiencia Explicadas
- Motores servo: funcionamiento, tipos y por qué son importantes
- Maximizando la precisión: Acoplamiento de reductores con servomotores
- Ciclo de Mandrinado ECS G86 con Función de Parada de Husillo
- Torno lineal SPRINT 20: Torneado automatizado rápido para piezas de alta precisión
- Maximice ingresos recurrentes con consumibles inteligentes: Un cambio de juego para fabricantes de maquinaria