AWS Builder Center

GreenGlow: Connecting Smart Streetlights to AWS with ESP32

GreenGlow is a cloud-connected smart streetlight prototype built using an ESP32, activity sensors, and AWS. The system adjusts streetlight brightness based on detected activity while sending device and sensor information to the cloud for storage and monitoring. This article explains the project concept, hardware, system architecture, AWS integration, data flow, security considerations, limitations, and possible future improvements.

GreenGlow: Building a Cloud-Connected Smart Streetlight System with ESP32 and AWS

The Observation That Started Everything

You know what's funny? I was sitting in my car at 2 AM, waiting for someone, and I noticed the streetlight above me was blazing at full brightness. There wasn't a single car or person in sight. Not one.
And I thought to myself... why?
That moment became the seed for GreenGlow. I kept wondering: does a streetlight really need to burn electricity at maximum capacity when nobody's around to benefit from it? The answer seemed obvious, but I wanted to actually test it rather than just assume.

The Problem With Traditional Streetlights

Most streetlights operate on a schedule. They turn on at dusk, turn off at dawn, and stay at the same brightness the entire time. It's simple, reliable, and... wasteful.
I'm not saying we should turn them off completely. That would be dangerous. But do we need them at 100% power when there's zero activity for minutes at a time?
That's the gap GreenGlow tries to fill:
When activity is detected → full brightness When nothing's there → reduced brightness
It sounds simple, but making this work reliably while also sending data to the cloud turned out to be more interesting than I expected.

The Core Concept

Here's how I thought about it from the start:
The ESP32 sits at the center of everything. It reads sensor data, decides what to do with the light, and also prepares information to send to AWS. These are two separate jobs that happen in parallel.
The local control part is straightforward:
  • Sensor detects something → light goes bright
  • Sensor detects nothing for a while → light dims down
The cloud part is different. It's not about real-time control. It's about collecting information so I can actually see what the system is doing over time.
What I really wanted was a way to answer questions like:
  • How often does this light get activated?
  • What times of day are busiest?
  • Is the sensor working correctly?
  • How does this light compare to others?
You can't answer those questions by looking at a single LED in a prototype. You need data. You need storage. You need a way to visualize things.

What I Actually Built

The Hardware Side

The physical prototype uses:
  • An ESP32 board as the main controller
  • A sensor for detecting activity (vehicles or pedestrians)
  • An LED array that acts as the "streetlight"
  • A power supply to run everything
The ESP32 reads the sensor continuously. When it detects something, it drives the LED to full brightness. When the area clears, it dims the LED down after a short delay.
Pretty basic stuff honestly. The real magic isn't in the hardware.

Making It Cloud-Connected

This is where things got more interesting. Instead of just having a smart light, I wanted to see what that light was actually doing.
So I set up an architecture where:
  1. The ESP32 publishes messages to AWS IoT Core using MQTT
  1. A Lambda function processes incoming messages
  1. DynamoDB stores the processed data
  1. A dashboard lets me view everything in a human-friendly way
The streetlight doesn't depend on the cloud to work. If the internet goes down, the light still responds to activity. That was important to me. The cloud is for visibility and analysis, not for real-time control.

The Flow of Information

Let me walk through what actually happens when data moves through the system:
  1. The ESP32 reads sensor data and controls the LED
  1. It constructs a message with information like:
  • Device ID
  • Timestamp
  • Activity state (active/inactive)
  • Current brightness level
  • Sensor readings
  1. The message gets published to AWS IoT Core via MQTT
  1. AWS IoT Core routes the message to a Lambda function
  1. Lambda validates and transforms the data before storing it
  1. DynamoDB stores each record
  1. The dashboard queries the database and displays the information
What I like about this separation is that the ESP32 doesn't need to know anything about the database structure. It just sends telemetry. The cloud side handles the transformation.

Storing the Data

I went with DynamoDB because it's simple and works well for IoT data patterns. Each event becomes a record with fields like:
{
"deviceId": "streetlight-001",
"timestamp": "2026-08-10T02:15:30Z",
"activityDetected": true,
"brightnessPercent": 100,
"sensorValue": 850
}
This gives me a history of what the light has been doing. I can query by device, by time range, or look for specific patterns.

The Dashboard View

Raw database records aren't exactly user-friendly. I wanted something visual that would let me see the system state at a glance.
The dashboard shows:
  • Current state of the streetlight
  • Recent activity events
  • Historical brightness data
  • Device status (online/offline)
  • Event timestamps
I used [insert your dashboard tech here] to build it. Nothing fancy, just enough to actually see what's happening without having to write queries every time.
[Insert actual dashboard screenshot here when available]

The Real-Time Behavior

Here's what happens when a vehicle actually approaches:
  1. The sensor detects the vehicle
  1. The ESP32 processes the reading
  1. The LED goes from dim to full brightness
  1. At the same time, the ESP32 prepares a message
  1. That message gets sent to AWS
  1. The dashboard updates
The important thing is that steps 1-3 happen almost instantly. The cloud stuff runs in the background.
This separation means even if the cloud communication is slow or fails temporarily, the streetlight still works correctly. It's not waiting for a response from AWS before it turns on.

What I Learned About Testing

I'll be honest, I don't have exact energy savings percentages to report yet. I could invent some numbers, but that feels wrong. The prototype needs real measurement under controlled conditions before I can make those claims.
The things I need to actually measure:
  • Power draw at full brightness
  • Power draw at reduced brightness
  • How long the light spends in each state
  • Number of activations over time
  • Environmental factors (time of day, weather, etc.)
Until I collect that data, the honest claim is that GreenGlow is designed to reduce unnecessary full-brightness operation. Not that it has achieved a specific savings percentage.

The Inevitable Problems

Every project hits snags, and GreenGlow was no exception. I'm not going to pretend everything went smoothly.
[Document your actual problems here]
For example, I initially had issues with:
  • The sensor triggering too frequently
  • MQTT connection stability
  • Data format inconsistencies
  • [Add your specific challenges]
Each problem taught me something about the system and pushed me to make it more robust.

Security (Because It Matters)

Connecting a physical device to the cloud opens up security questions. I took several steps to keep things locked down:
  • AWS IoT Core certificates for device authentication
  • Encrypted MQTT communication
  • IAM policies following least privilege
  • No credentials in source code
The ESP32 stores its certificate and private key securely. The device only gets permissions it absolutely needs.

Cost Considerations

I'm not going to quote a specific monthly cost because it depends entirely on usage patterns. But here are the factors that affect AWS costs:
  • How many devices are connected
  • How often they send messages
  • How many Lambda invocations occur
  • DynamoDB read/write activity
  • How much data is stored
  • Data transfer out of AWS
For a prototype with a single device, costs are minimal. For a production deployment with hundreds of streetlights, you'd want to optimize carefully.

Where This Project Currently Falls Short

Let me be transparent about the limitations:
It's a prototype. I'm not claiming this is production-ready. There's a big gap between a single streetlight in a controlled environment and a city-wide deployment.
Long-term durability isn't proven. I haven't tested this in rain, extreme temperatures, or for months of continuous operation.
Network dependency. The cloud features require internet connectivity. If the network goes down, you lose monitoring and historical data.
Sensor accuracy. Different sensors have different strengths and weaknesses. The prototype uses one type, but real-world conditions might require different choices.
Scale. One device is easy. Fifty devices create new challenges around data volume, device management, and failure handling.

What I'd Build Differently Next Time

If I were starting from scratch or building the next version, I'd focus on:
Better activity detection. More sophisticated algorithms could reduce false triggers and improve response accuracy.
Multiple nodes. The real value comes from connecting several streetlights to the same cloud infrastructure. That's when you can actually see patterns and compare behavior.
Energy analytics. With enough real data, I could calculate actual savings and optimize the dimming strategy further.
Fault detection. The system could flag unusual patterns automatically. For example, a streetlight that stops reporting or always shows activity.
Offline buffering. Network connectivity isn't guaranteed. The device could store events locally and sync when connectivity returns.
Solar power exploration. A future version could investigate solar charging and battery management for off-grid operation.

The Bigger Picture

What I really appreciated about this project is that it connects two worlds that often stay separate.
On one side, there's embedded systems and hardware. Reading sensors. Controlling outputs. Real-time responses.
On the other side, there's cloud engineering. Data pipelines. Storage. Visualization. Analytics.
GreenGlow forced me to think about both simultaneously. The physical streetlight doesn't care about the cloud. It just needs to respond to its environment correctly. But the cloud gives the system meaning beyond just "the light turned on."
Without the cloud, I'd just have a cool light that responds to traffic. With the cloud, I can actually measure, analyze, and improve the system over time.

Closing Thoughts

GreenGlow started as a simple observation at 2 AM. A streetlight burning electricity with no one around to benefit from it.
The prototype I built explores one way to address that waste. An ESP32 handles the local decision-making. Sensors detect activity. The LED adjusts brightness accordingly. And the AWS integration provides visibility into what's actually happening.
Is it perfect? No. Is it a finished product? Definitely not. But it's a concrete demonstration of how IoT can make something as mundane as street lighting more intelligent and efficient.
The next step isn't about adding more cloud services or making the dashboard prettier. It's about gathering real measurements and letting the data guide the next iteration.
What does the actual energy consumption look like? How reliably does the sensor work in different conditions? What breaks when the system runs continuously for weeks?
Those questions matter more than theoretical savings claims. And they're exactly what I plan to investigate next.
#buildatpce
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article