Modelo Arquitetônico de Ponto de Ônibus Inteligente com Toldo Automático
Componentes e Materiais
| Componente | Descrição | Qtd |
|---|---|---|
| Arduino Nano R3 | Pequeno, fácil de esconder no modelo. | 1 |
| Servo MG995 | Servo robusto (high torque) para toldo pesado. | 1 |
| Fotoresistor (LDR) | Um voltado para Leste, outro para Oeste. | 2 |
| Sensor de Chuva | – | 1 |
| LED Branco Alto Brilho | Iluminação interna e externa. | 6 |
| Resistor 220 Ω | Para LEDs. | 3 |
| Protoboard (genérica) | – | 1 |
| Jumpers Macho-Macho | – | 27 |
| Bloco de Terminais Parafuso | – | 2 |
| Conector Bateria 9V | – | 2 |
| Bateria 9V | – | 1 |
| Suporte 4xAA | Fonte externa para o MG995. | 1 |
Sobre o Projeto
Esta é uma atualização do projeto anterior (V1.0).
Principais mudanças da V1.0:
- Tamanho do modelo: 1,5 m x 1 m.
- Peso do toldo exigiu trocar o micro servo SG99 pelo MG995.
- Adicionada fonte de alimentação externa para o MG995.
- Testados dois mecanismos de expansão/contração do toldo. O descartado aparece no 2º vídeo; o definitivo no 3º.
- Sketch modificado para usar biblioteca VarSpeedServo (movimento suave).
- Corrigido pequeno erro lógico em um dos estados do toldo (obrigado Gurneet1928).
Versão 1.0: Model Version 1.0
Código
O Código (C/C++)
#include <VarSpeedServo.h>
VarSpeedServo servo;
int easternLight = 0;
int westernLight = 0;
int rainSensed = 0;
int sunshadePosition = 0;
int rainThreshold = 512;
int sunshadeExpanded = 120;
int sunshadeContracted = 60;
int ambientLighting = 0;
int turnOnLightsOn = 150;
int ledIntensity = 0;
int ledPower = 0;
int servoSpeed = 20;
bool debugging = false; // TRUE para debug no Serial
void setup() {
pinMode(A4, OUTPUT); // Iluminação interna
pinMode(A5, OUTPUT); // Luz externa (poste)
pinMode(A1, INPUT); // Luz oeste
pinMode(A2, INPUT); // Luz leste
pinMode(A3, INPUT); // Sensor chuva analógico
pinMode(2, INPUT); // Sensor chuva digital
servo.attach(A0);
servo.write(sunshadeContracted, servoSpeed, true);
if (debugging) {
Serial.begin(9600);
Serial.println("*** DEBUGGING STARTED ***");
Serial.println("-------------------------");
}
}
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) { // Nascer do sol
oya_mydebug("It's sunrise");
if (sunshadePosition != sunshadeExpanded) {
servo.write(sunshadeExpanded, servoSpeed, true);
oya_mydebug("Sunshade expanded");
}
}
if (easternLight > westernLight) { // Pôr do sol
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; // média
oya_mydebug("easternLight", easternLight);
oya_mydebug("westernLight", westernLight);
oya_mydebug("rainSensed", rainSensed);
oya_mydebug("sunshadePosition", sunshadePosition);
oya_mydebug("ambientLighting", ambientLighting);
// Chovendo?
if (rainSensed < rainThreshold) {
oya_mydebug("It's raining...");
if (sunshadePosition != sunshadeExpanded) {
servo.write(sunshadeExpanded, servoSpeed, true);
oya_mydebug("Sunshade expanded");
}
} else {
oya_mydebug("It is not raining...");
if (ambientLighting <= turnOnLightsOn) { // Escurecendo
oya_mydebug("It's getting dark, turning on lights");
ledPower = (turnOnLightsOn - ambientLighting) * 4;
oya_mydebug("ledPower", ledPower);
analogWrite(A5, ledPower);
analogWrite(A4, ledPower);
expand_collapse(easternLight, westernLight);
} else { // Muito sol
oya_mydebug("A lot of sunshine, turn off lights");
analogWrite(A5, 0);
analogWrite(A4, 0);
expand_collapse(easternLight, westernLight);
}
}
if (debugging) {
Serial.println("********************");
Serial.println(" ");
delay(5000);
} else {
delay(100);
}
}
Esquemático

Processo de manufatura
- Trens Lionel: História, Fabricação e Futuro
- Robô de Triagem de Reciclagem Alimentado por Google Coral Edge TPU
- Maximize Receita Recorrente com Consumíveis Inteligentes: Um Divisor de Águas para Fabricantes de Máquinas
- Controle Automático de Trem DIY com Arduino – Simples, Confiável e Personalizável
- Robô Desviador de Obstáculos com Servo: Construa com Arduino e HC-SR04
- Torno Linear SPRINT 20: Torneamento Automatizado Rápido para Peças de Alta Precisão
- Fundamentos da Prensa Servo: Potência, Precisão e Eficiência Explicadas
- Motores Servo Explicados: Como Funcionam e Por Que Importam
- Maximizando Precisão: Combinando Redutores com Servomotores
- Ciclo de Furação ECS G86 com Recurso de Parada do Fuso