AI Lamp: Using AI in Arduino
This project demonstrates how to build a smart lamp that uses AI to automatically adjust brightness based on surroundings. It runs a simple AI model directly on an Arduino microcontroller.
Understanding AI Basics
Input
AI takes in observations or data as input.
Processing
The AI "brain" is a mathematical formula that processes the input.
Output
AI generates an action or prediction as output.
Building the Lamp
1
Cut Materials
Use the provided template to cut black and white card paper pieces.
2
Assemble Shade
Glue the cut pieces to form the lampshade.
3
Attach LED
Solder wires to a small LED and secure it inside the shade.
4
Connect Base
Attach the shade to the base with strong adhesive.
Preparing to Collect Data
1
Circuit Setup
Build the circuit with Arduino, LED, LDR, potentiometer and push button.
2
Code Upload
Upload the provided Arduino code for data collection.
3
LDR Placement
Position the LDR to measure ambient light, not the LED's output.
Collecting the Dataset
Move Lamp
Place the lamp in different locations with varying light levels.
Adjust Brightness
Set preferred LED brightness using the potentiometer.
Record Data
Press the button to log LDR reading and LED brightness.
Repeat
Collect 20-50 data points throughout the day.
Training the AI Model
Data Preparation
Export collected data to a CSV file.
Python Setup
Install required libraries: scikit-learn and pandas.
Model Training
Use linear regression to find the relationship between LDR and LED values.
Implementing AI in Arduino
Step
Action
1
Obtain w and b values from trained model
2
Insert values into new Arduino code
3
Remove data collection components
4
Upload final code to Arduino
Final Assembly and Applications
Smart Lighting
Lamp adjusts brightness automatically based on surroundings.
Weather Prediction
Apply similar techniques to create a weather prediction system.
Sign Language Translation
Train AI to recognize and translate sign language gestures.