8 min to read
Sprint 3 Development Note
Development Note for Project Prism
What an incredible week for our little team! We’ve made massive strides across all fronts, particularly in backend development where we’ve nearly wrapped up all core functionality. Let’s dive into what each of us has accomplished this sprint.
Sunho’s Backend Progress
I made huge progress this week with a major milestone for our backend infrastructure! I nearly completed all functionality development and set up an automated deployment pipeline. Here’s what I pulled off:
Lambda Functions Development & Optimization
- Pattern to AI Lambda (the one we renamed from “Surprise Me”): I got this working beautifully - it now analyzes user history from DynamoDB to spot patterns and recommend light settings without the user having to ask. The system smartly sends these recommendations straight to the Arduino device.
- DynamoDB & Orchestration Lambda Updates: I modified our existing lambda (now called “Audio to AI”) to store important metadata in DynamoDB, giving us a persistent record of user interactions. The table uses UUID as partition key and DAY#TIME as sort key, storing everything from emotion tags to light settings and context.
- Refactoring for Speed: I spotted duplicated code across our lambdas and pulled out the common bits into a new “Result Save Send” lambda that handles database storage and Arduino communication. This move lets the original lambda return responses to the frontend immediately without waiting.
- WebSocket Connection Handling: I refined how we store WebSocket connection IDs mapped to UUIDs in DynamoDB, properly handling connections on $connect and cleaning them up on $disconnect.
Lambda Function Orchestration Pattern
I spotted duplicated code in multiple Lambda functions (audio_to_ai and pattern_to_ai). Both functions shared similar post-processing after receiving AI responses. So I pulled out the common bits into a new “Result Save Send” lambda that handles database storage and Arduino communication. This move lets the original lambda return responses to the frontend immediately without waiting to save the result to the database and send it to arduino.
- Used article Are We Making Lambda Too Hard? for guidance
The new workflow architecture works like this:
- First-stage Lambdas (
audio_to_ai,pattern_to_ai):- Handle authentication
- Prepare input for AI processing
- Validate AI responses
- Return quick results to frontend
- Asynchronously invoke second-stage Lambda
- Second-stage Lambda (
result_save_send):- Process and parse AI responses
- Store data in S3 and DynamoDB
- Retrieve IR codes from DynamoDB
- Send commands to Arduino devices via WebSockets
- Handle all backend processing without blocking user response
This approach gives us:
- Reduced cold start time: Smaller import footprint in each Lambda
- Improved user experience: Faster response times to frontend
- Better modularity: Easier maintenance and future feature additions
- More efficient resource utilization: Processing-heavy tasks run asynchronously
Final Architecture Diagram. The new “Result Save Send” Lambda handles all backend processing, while the original Lambdas return quick responses to the frontend.
DynamoDB Query Patterns & Sort Keys
- Learned how to use composite sort keys in DynamoDB by concatenating values with delimiters (e.g.,
DAY#3#TIME#14:30) - This approach enables efficient range-based queries while maintaining a simple table structure
- For our project, created a
DAY#TIMEsort key pattern to enable time-based pattern analysis
The application uses this pattern to query user activity by time ranges:
Infrastructure as Code Implementation
- Successfully implemented Terraform for managing AWS infrastructure
- Created GitHub Actions pipeline for automated deployment
- Set up environment variables and secrets management
CI/CD Pipeline Implementation
- I successfully hooked up Terraform with GitHub Actions to create a smooth CI/CD pipeline for automated deployment.
IAM Management Learning
- Created IAM policies with specific permissions for each resource type
- Used Terraform to define and attach policies to roles
- Implemented least-privilege principle for security
Known Issues
- Pipeline doesn’t automatically detect Lambda code changes that require new ZIP file creation
- Local testing properly updates ZIP files and detects changes, but CI/CD pipeline needs improvement
Next Moves:
- Fix that pipeline issue where lambda function changes aren’t automatically caught (I still have to manually update the zip files, which is annoying)
- Run full integration testing with the frontend
- Work on Arduino code for automatic WebSocket API Gateway connection
- Implement LED setting state initialization
- Update the frontend pipeline for Next.js compatibility
Taemin’s Frontend Progress
Taemin has built all the foundational components we need for user interaction. He focused on getting working logic first, with plans to make everything look pretty in later sprints:
Progress from Sprint 2
-
Device Registration Page
- Built a clean UI for users to enter their UUID and PIN
- Used React useState to manage form data with controlled input fields
- Added validation to make sure inputs follow the right format before submission
- Stored UUID and PIN in local state so we can use them in API requests
-
Audio File Submission (POST Request)
- Created a POST request function that sends data to the backend
- The request includes:
UUIDPINAudio file (binary)
- Used the FormData API to handle file uploads properly
- Made sure the backend can receive and process the request correctly
React Concepts Taemin Learned & Applied
- useState Hook: For managing form data and controlled inputs
- Handling File Uploads: Using FormData to send audio files efficiently
- Asynchronous API Calls: Implementing fetch requests with async/await
- Event Handling in Forms: Adding event listeners for form submission
- Component Reusability: Structuring form inputs as reusable components
Questions & Decisions
- Do we need to encrypt the UUID & PIN before sending?
- Decision: No, since this is an MVP. Encryption would need complex backend work, and we’re focusing on getting the AI to control the LED light. We’ll add encryption in a later version.
- Should we use local storage to remember the UUID/PIN between sessions?
- Decision: Yes, since we’re skipping logout functionality for now, local storage will let the web app remember the UUID and PIN. We’ll need to add a “Log Out” page later so users can enter different credentials if needed.
- How will the WebSocket connection handle multiple users?
- Decision: The Arduino will send the UUID with each WebSocket request. The backend will store active connections in DynamoDB and use the connection ID to route responses to the right user.
Taemin’s Goals for Sprint 4
- Convert to Next.js for better pipeline monitoring and API handling
- Build the “Surprise Me” Feature that generates AI-driven responses
- Implement a WebSocket Status Button to show real-time connection updates
- Check AWS API Gateway Logs to make sure requests are reaching the backend
- Add a Reset Button to reset the RGB color code for the LED light
WebSocket Status Implementation Plan
- Use useState to track WebSocket connection status
- Establish connection when component mounts
- Show real-time WebSocket status in the UI
- Handle incoming messages to update status dynamically
Harry’s Market Research Findings
Harry has completed extensive online research and finalized our student survey design:
Market Growth & Regional Trends
- Smart LED segments are growing 1.5x faster than ordinary LED segments (15-18% vs. 9-12% CAGR)
- North America dominates the smart LED market (35-40% share)
- Huge upgrade potential remains (610M ordinary LED strips vs. 240M smart LED strips sold)
Product Differentiation
- The main difference between products is control technology: analog RGB vs. digital microchip
- Smart strips cost 30-50% more but deliver much better functionality
- AI capabilities are transforming lighting from a basic utility to an interactive experience
Consumer Demographics
- Residential consumers are the biggest segment, with tech-savvy 25-45 year-olds leading adoption
- Commercial applications growing quickly (expected to be 20% of the market by 2030)
- People increasingly prefer buying smart LEDs online
College Student Market Segment
- High adoption rates (67% have basic, 58% have smart LED strips)
- They buy them for personalization, to make the most of small spaces, and to work around dorm restrictions
- Students spend about $150 on average, considering it worthwhile for the long life and better study environment
- Strong correlation (35%) between lighting quality and where students prefer to study
Adoption Barriers & Future Opportunities
- Installation complexity and compatibility with other systems are still big hurdles
- The price premium (30-50%) limits mainstream adoption despite falling costs
- Converting traditional LED users to smart LED represents a huge opportunity
- AI-enhanced experiences will increasingly be what sets products apart
- Integration with other smart home systems is driving growth (69% U.S. adoption projected by 2027)
NEXT STEPS
For Sprint 4, we’re planning to:
- Sunho (Backend): Complete integration testing and Arduino connectivity
- Taemin (Frontend): Convert to Next.js and implement real-time communication features
- Harry (Market Research): Distribute surveys, collect responses, and analyze data to refine our roadmap
- Sunho and Harry: Develop detailed revenue streams and cost structure based on the research findings
We’re making incredible progress toward our MVP! The backend functionality is nearly complete, frontend capabilities are coming along quickly, and the market research continues to validate our approach while highlighting key opportunities for us to stand out.
Onward to Sprint 4!