Project using Arduino

I am doing a project in which I am using two different sensors and Arduino NANO. Arduino is reading the sensor values and data is pushed to Bolt cloud.
I want to know how to access the pushed data (from both the sensors simultaneously) using python.
Please help!

You should be using JavaScript on the Bolt Cloud to get the reading.

Thanks for the reply.

I am using JavaScript on the Bolt cloud and getting perfect graphs. But I want to access the data using Python. I tried boltobject.serialRead('10') but getting Null values.

Some reply from Bolt would be helpful! @yeshwant.naik @vinayak.joshi

Hi @akshayphadke002,

I am inviting @shoeb.ahmed1 to help you out with this query.

Do let me know in case you need further assistance.

@saha.shounak.48 , Set your BOLT and Arduino in the TX-RX and try to read the serialread from the python.Hope it will work. Post here if you want further assistance.

Pls share ur arduino code and Python code

please share arduino code also

Hello, @shafiq.shaikh.
Since this a part of my final project, I cannot share the Arduino code.

Hello @rahul.singh1 .

Hi @akshayphadke002,

What is the output of your python code? Also check if this project helps https://www.hackster.io/ashishsupper/anomaly-detection-temperature-monitoring-using-bolt-iot-ec2935

So basically you push the data to Bolt Cloud using your Arduino code and you can read the serial data in python using Bolt Cloud API.

Also, you can share your code to support@boltiot.com and I will get it reviewed from @shafiq.shaikh

Do let me know in case you need any other information.

Thanks for the reply @rahul.singh1
Firstly, I am using more than one sensors. Should I be using a single boltobject.serialRead('10') statement or multiple statements.

Secondly, I referred to various similar projects which uses Arduino to collect sensor data on hackster.io. They use boltobject.serialRead(2) or boltobject.serialRead(3) in their Python code. What does these two statements mean? Use of serialRead(2) or serialRead(3) is not listed in Bolt Docs.

Thirdly, what is the difference between these two: serialRead('10') and serialRead(10) ?

This is the output of the python code.

Hello @rahul.singh1,
Any updates?

Can I guide you through this?

@akshayan.sinha , ok sure

Hi @askumar835,

Check this link https://docs.boltiot.com/docs/read-incoming-serial-data. serialRead takes the ‘till’ parameter as an argument.

boltobject.serialRead(2) - it means read-only two characters from the incoming UART data.
serialRead(10) - It means read-only 10 characters from the incoming UART data.

So you can use as many sensors as you want. While doing the serial write, insert a comma or any other delimiter between each value.

For example:
Suppose the value of sensor A is 10 and the value of sensor B is 20
You can write “10, 20” to the serialWrite.

While doing the serialRead,

You can do (python code)

response = bolt.serialRead(10) // You are reading first 10 charters of incoming uart data. 
// the value of response will be 
// {"success": "1", "value": "10, 20"}
//Now we need only the value from the response, 

data = json.loads(response)
data_value = data["value"]
// Here data_value is "10, 20"
Now we know each sensor value is separated by a comma. 
data_value = data_value.split(',')
// ['10', ' 20']
sensor_A = data_value[0]
//10
sensor_B = data_value[1]
//20

Now you have both the sensor value in different variables.

There is no difference between serialRead('10') and serialRead(10). Bolt python library handles both cases.

Do let me know in case you need any other information.

@akshayphadke002 Sure, it will be awesome.

Hello @rahul.singh1,
As you can see, I am already using bolt.serialRead('10') in my python code but still getting null values.

Hello @akshayan.sinha