Kandregula leela sai lakshmi sudha
Published

CPU Stress Detector with Bolt Platform

This project is helpful in determining tthe stress that your CPU feels.It indicates via LED's.

IntermediateShowcase (no instructions)10 hours543
CPU Stress Detector with Bolt Platform

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1

Software apps and online services

Bolt IoT Android App
Bolt IoT Android App
Bolt Cloud
Bolt IoT Bolt Cloud
vmware software

Story

Read more

Schematics

cpu stress detector

Two LED's status

Code

cpustress

Python
It is a python code.it will be worked in vmware software
import psutil
from boltiot import Bolt

api_key = "YOUR_API_KEY"
d_id = "YOUR_DEVICE_ID"

cpu_red_threshold = 0.4
client= Bolt(api_key, d_id)

#interval in seconds to check cpu usage
interval = 5

def control_green_led(pin, value):
    response = client.digitalWrite(pin, value)

def control_red_led(pin, value):
    response = client.digitalWrite(pin, value)

while True:
    cpu_usage = psutil.cpu_percent(interval = interval)
    print "CPU usage is", cpu_usage
    if cpu_usage > cpu_red_threshold:
        control_green_led('0','LOW')
        control_red_led('1', 'HIGH')
        control_red_led('2', 'LOW')
    else:
        control_green_led('0', 'HIGH')
        control_red_led('1', 'LOW')

Credits

Kandregula leela sai lakshmi sudha
1 project • 0 followers

Comments