Automated Smart Bridge
The Automated Smart Bridge isn’t any normal bridge; it raises and lowers itself based off environmental conditions. When its sensors detects moisture, it displays a flood alert while simultaneously raising the bridge. The purpose of this bridge is to ensure that people can cross it safely during floody conditions.
| Engineer | School | Area of Interest | Grade |
|---|---|---|---|
| Logan W | Irvine HS | Structural Engineering | Incoming Junior |
Final Milestone
Modifications
- Created an E-STOP Button that stops the bridge from moving and returns the Bridge to its neutral position
- Created two soil moisture sensors to detect water in multiple places
- Added cardboard to the structure of the bridge to make it more secure
- Added a second servo to allow an extra arm to raise the bridge
- Added an 8V battery pack to power the second servo since the Arduino’s 5V can’t power both servos
Challenges I Overcame
- Breadboard overheated when I added the 8V battery pack for the second servo
- I unplugged all the wires and identified a dead short circuit casued by plugging the power wires of the servo into the ground rail
- I plugged my power wires into the positive rail and system functionaled normally again
Future Iterations
- I plan to finish the Github and Schematic
First Milestone
Different Components
- Soil Moisture Sensor: Detects moisture and sends signals to the Arduino when it detects low resistance (moist soil has low resistance compared to dry soil)
- Arduino: Acts as a motherboard and recieves signals from the Soil Moisture Sensor and sends signals to output components
- Servo: A motor that recieves signals from the Arduino and raises and lowers the bridge with its arm.
- OLED: A screen that recieves signals from the Ardunio and displays text
- Red LED: A light that recieves signals from the Arduino in Pin 6 and lights up when a flood is detected
Challenges I Overcame
- The physical wiring of the Arduino was the hardest part since I had to learn the basics of wiring it from scratch, now that I have finished the base project, I feel more confident about my wiring abilities
- It took trial and error, but the effort to connect the wires to the right places was incredibly rewarding once the bridge started working
Future Iterations
- I plan to make modifications to the bridge to improve safety
Schematics
Code
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Servo.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// Define Pins
const int ESTOP_PIN = 2;
const int SERVO1_PIN = 4;
const int SENSOR1_PIN = 5;
const int LED_PIN = 6;
const int SERVO2_PIN = 7; // Servo 2
const int SENSOR2_PIN = 8;
Servo servo1;
Servo servo2;
bool estopTriggered = false;
unsigned long lastFlashTime = 0;
bool ledState = LOW;
void setup() {
Serial.begin(9600);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(2);
pinMode(SENSOR1_PIN, INPUT);
pinMode(SENSOR2_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(ESTOP_PIN, INPUT_PULLUP);
servo1.attach(SERVO1_PIN);
servo2.attach(SERVO2_PIN);
// STARTING POSITIONS
servo1.write(0); // Servo 1 starts at 0
servo2.write(90); // Servo 2 starts at 90 (its "closed" position)
digitalWrite(LED_PIN, LOW);
}
void loop() {
if (digitalRead(ESTOP_PIN) == LOW) {
estopTriggered = true;
}
display.clearDisplay();
display.setCursor(0, 0);
if (estopTriggered) {
display.println("EMERGENCY\nSTOP!!!");
display.display();
// Snap back to safe/closed positions
servo1.write(0);
servo2.write(90);
digitalWrite(LED_PIN, HIGH);
while(true) {}
}
int s1 = digitalRead(SENSOR1_PIN);
int s2 = digitalRead(SENSOR2_PIN);
if (s1 == LOW || s2 == LOW) {
display.println("FLOOD\nALERT!");
display.display();
// OPEN THE GATES
servo1.write(90); // Servo 1 rotates up to 90
servo2.write(0); // Servo 2 rotates down to 0 (which mirrors it!)
if (millis() - lastFlashTime >= 200) {
lastFlashTime = millis();
ledState = !ledState;
digitalWrite(LED_PIN, ledState);
}
}
else {
display.println("Safe\nLevel");
display.display();
// KEEP GATES CLOSED
servo1.write(0);
servo2.write(90);
digitalWrite(LED_PIN, LOW);
}
delay(50);
}
Bill of Materials
| Part | Note | Price | Link |
|---|---|---|---|
| Arduino Uno | Recieves inputs from Moisture Sensor and sends signals to the outputs | $14.99 | Link |
| OLED Module | Displays Text | $9.99 | Link |
| Breadboard | Allows for multiple wires to share a GND and 5V connection | $7.89 | Link |
| Micro Servo | Raises and lowers the bridge | $9.88 | Link |
| Female Jumper Wires | Connects Moisture Sensor, OLED, and LED to the Arduino | $3.99 | Link |
| Male Jumper Wires | Connects the Servo and Red Button to the Arduino | $3.99 | Link |
| Soil Moisture Sensor | Detects Water | $12.99 | Link |
| Red Button | E-Stops the Bridge | $8.99 | Link |
| Red LED | Alarm | $5.99 | Link |
| Cardboard | Structure of the Bridge | $24.99 | Link |
| Construction Paper | Road | $5.38 | Link |
| Battery Pack | Supplys Extra Power | $8.39 | Link |