2 sensors interface

Hello everyone, greetings.
So I’m working on a project- Air pollution detection and monitoring.
Here i am using PM 2.5 and MQ-135 sensors.
I am planning to use digital pin of PM 2.5 with BoltIot and analog pin of MQ-135 to analog. So please can u let me know, is that possible.
Also i am not getting graph. It shows error as INTERNAL ERROR 500. Please help me.

Yes , it is possible.
You will then need to write code to read the values from both sensors and send them to the BoltIot cloud platform for monitoring and analysis.

Regarding the error you are facing with the graph, an INTERNAL ERROR 500 typically indicates a server-side error that is caused by an issue with the server hosting the graph. You can try refreshing the page, clearing your cache, or using a different browser to see if that resolves the issue.
Do let us know if you still facing any error.

Please can u help me in the code too.
Like 1 sensor interfacing is done, others i am not getting a clear idea, also the graphs are required so.

Can you share the code so i can check if is there any error or need to update.

Heyy thanks for responding. But im stuck in how to interface my PM 2.5 sensor. Im just confused about the codes. Interfacing is not a problem, i can interface it through arduino, but provlem is coding, how can data be sent to bolt and firther the graph works. If u can help me regarding this, it will be very helpful. Thanks

Hi @hrishikesh.01deshpan

import requests
import json
from boltiot import Bolt

# set up Bolt object
API_KEY = "your_api_key"
DEVICE_ID = "your_device_id"
bolt = Bolt(API_KEY, DEVICE_ID)

# define PM2.5 digital pin
pm25_pin = 0

# define MQ-135 analog pin
mq135_pin = "A0"

# read PM2.5 value
pm25_value = bolt.digitalRead(pm25_pin)

# read MQ-135 value
mq135_value = bolt.analogRead(mq135_pin)

# print sensor values
print("PM2.5 value:", pm25_value)
print("MQ-135 value:", mq135_value)

# send sensor values to a remote server
payload = {"pm25": pm25_value, "mq135": mq135_value}
headers = {"Content-Type": "application/json"}
url = "your_remote_server_url"
response = requests.post(url, data=json.dumps(payload), headers=headers)

# print server response
print("Server response:", response.text)

Make sure to replace the API_KEY and DEVICE_ID with your actual credentials. Also, replace the pm25_pin and mq135_pin variables with the appropriate pins for your sensors.

This code reads the digital value from the PM2.5 sensor and the analog value from the MQ-135 sensor. It then sends the sensor values to a remote server using a POST request. You can modify the code to suit your specific requirements.
Do check and let us know if it works.

Sir thank you very much for this reply. But i am extremely sorry Sir, i guess i missed saying that i am coding in C++(arduino ide) and js for graphs (bolt cloud), not using digital ocean. Sorry sir. Please can u help me

I share you the C++ code in message, do can check and let us know if that helps you

@hrishikesh.01deshpan , could you just send me the code which is showing an error? Once seeing the code I can help you out.