Najiyya Zahir
Published © MIT

Automated Light Monitoring System

An LED brightness-adjusting system that monitors ambient light and offers real-time alerts for sudden changes.

BeginnerFull instructions provided3 hours65
Automated Light Monitoring System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Resistor 330 ohm
Resistor 330 ohm
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
PHPoC Bread Board
PHPoC Bread Board
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Android App
Bolt IoT Android App

Story

Read more

Schematics

Image of the output

Code

Automated Light Monitoring System

JavaScript
setChartLibrary('google-chart');
setChartTitle('light data');
setChartType('areaGraph');
setAxisName('time_stamp','bolt_pin');
plotChart('time_stamp','bolt_pin');



// Analog pin for the light sensor
const bolt_pin = 'A0';

// Initialize an empty array to store light sensor data
let lightData = [];

// Function to read data from the light sensor and send it to the BOLT Cloud
function readLightSensor() {
    const lightValue = analogRead(bolt_pin);
    sendDataToBolt(lightValue);
}

// Function to send data to the BOLT Cloud
function sendDataToBolt(lightValue) {
    // Your code here
}

// Function to update the chart with the light sensor data
function updateChart() {
    const ctx = document.getElementById('lightChart').getContext('2d');
    const chart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: lightData.map((_, index) => index.toString()),
            datasets: [{
                label: 'Light Sensor Data',
                data: lightData,
                backgroundColor: 'rgba(255, 99, 132, 0.2)',
                borderColor: 'rgba(255, 99, 132, 1)',
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: true
                    }
                }]
            }
        }
    });
}

// Function to start monitoring the light sensor
function startMonitoring(interval) {
    setInterval(readLightSensor, interval);
}

// Start monitoring the light sensor
startMonitoring(60000); // Collect data every 1 minute (60000 milliseconds)

Credits

Najiyya Zahir
1 project • 1 follower

Comments