How to detect Temperature(LM35) and Light(LDR) at a time using Bolt

Hello,
I want to detect temperature and light both together at a time using Bolt, as both the LDR and LM35 sensors are being connected to A0 pin of Bolt. So will bolt send to values to the system.
Or is there any other way to do this.

OR CAN I Connect one sensor to A0 and the other to TX/RX/1/2/3/4 (IDK what are these pins used for)

NO,if u connect both the devices in the same pin then it will not working…As lm35 is an active device,so you have to connect it in a separate power supply line whereas LDR is a passive sensor so it requires separate too.

NO, you cannot connect the LM35 sensor and LDR sensor in same pin as as the values of both the sensors will be merged and bolt will receive a faluty values also LM35 is a active device and LDR is a passive sensor.

Both the sensors provide analog voltage as output. It is the role of an ADC(Analog to Digital Converter) present on the Bolt module that converts this voltage to a digital(integer) value.
However, Bolt module has only one ADC, and so you need added circuitry with multiple ADCs to read multiple analog values. Also, there does not seem to be any guide to connect the Bolt to external ADCs, as they mostly use I2C interface.
So, the only option is to use an Arduino UNO, which has 6 ADC channels and then to make it communicate serially with Bolt via its UART pins.

1 Like

since LM35 is an active sensor and LDR is a passive one the Module may display wrong values.Moreover be sure that power and GND pins aren’t in contact with eachother as it will lead to damage of the BOLT Module.

@pankajkumar.p Can you explain more about how we can connect them to the Arduino and send the data to the Bolt cloud?

Hey There,
As you are using LM35 and LDR sensors both sensors fetch Analog values. As Bolt has a single Analog pin i.e. A0 and the remaining are Digital pins from 0 to 4. The Rx and Tx are serial communication pins that will help Bolt to communicate serially with another board. If you wished to connect Analog sensors to Bolt here I came with two solutions for you :smile:
(1) Using ADC (Analog to Digital Converter)
You can use an ADC to convert any kind of Analog data into Digital to work with your compatible board. As you can see Bolt has only one Analog pin so you can interface the ADC converter with the Digital pins of Bolt with the sensor. Here by using ADC, you can connect multiple Analog sensors as well as Digital Sensors.
(2) Using Serial Communication
This might be a little complicated not in Hardware but in the form of Software. So in this process, you have to connect another AVR board such as (Arduino, Nodemcu, or stm compatible, etc). Discussing Arduino UNO has 5 Analog input pins and two serial communication pins, as discussed Bolt already has two serial communication pins (Rx and Tx) which stand for Receive and Transmitte. So here you just have to connect Rx of Bolt to Tx of Arduino UNO and Tx of Bolt to Rx of Arduino UNO and sensor connection to your Arduino UNO. As Arduino will retrieve the Analog data from the sensor the bolt will fetch that data from Arduino and display the required data on to your screen as you programmed. Remember Both boards have to programm seperatley to do serial data transmission.
Hope you got your Answer.

1 Like

Hey @dagdih,

Yes, it is possible to connect 5 analog sensors to the Bolt Module using a technique called multiplexing. In this method, you can utilize one analog pin (A0) and five digital pins (D0 - D4) to multiplex the sensors.

Let’s consider an example with three analog sensors: LM35, LDR, and Moisture.

First, connect all the GNDs and analog data pins of the sensors together, excluding the VCC pins. Then, connect all the analog data pins of the sensors to the Bolt Module.

Now, here’s how you can proceed. Connect the VCC pin of the temperature sensor to D0, the VCC pin of the LDR to D1, and the VCC pin of the Moisture sensor to D2.

In your programming code, you can perform the following steps:

  1. For a certain time period, turn on D0 and read the analog data from the sensor connected to D0.
  2. Turn off D0.
  3. In the next time period, turn on D1 and read the analog data from the sensor connected to D1.
  4. Turn off D1.
  5. Repeat this process for the remaining sensors, turning on the corresponding digital pin and reading the analog data.

By following this approach, you can multiplex the sensors and obtain data from each of them. However, it’s crucial to ensure that you don’t read the data from multiple sensors simultaneously within the same time period, as it can lead to inaccurate results.

If you need in great detail checkout my github repo : GitHub - Zameel-Byte/MULTIPLE-SENSOR-DATA-COLLECTION-AND-TRANSMISSION: Bolt Module's analog pin i.e. A0 is commonly connected to all sensors DATA pin, and D0 - D2 are connected to w.r.t Temp sensor, Mos sensor and LDR. where sensor's VCC pins are connected to D0 - D2 respectively.

I hope this explanation helps to solve your problem!

Regards, Zameel

No, you cannot connect the LM35 sensor and LDR sensor, because bolt module has only one ADC, and so you need added circuitry with multiple ADCs to read multiple analog values. Also, there does not seem to be any guide to connect the Bolt to external ADCs, as they mostly use I2C interface.

Hey @ramyaghatty17 check this

from boltiot import Bolt
import time

Create Bolt object

mybolt = Bolt(“<API_KEY>”, “<DEVICE_ID>”)

while True:
# Read temperature value from LM35 sensor
temperature = mybolt.analogRead(‘A0’)
# Read light intensity value from LDR sensor
light = mybolt.analogRead(‘A1’)

# Print the values
print("Temperature:", temperature)
print("Light Intensity:", light)

# Delay between readings
time.sleep(2)

@zameelalimohammed282

Hey @swethayprahallad, it’s not possible to access analog pin “A1”. because Bolt Wi-Fi module has only one analog pin i.e. “A0”.

Hey @dagdih,

As we have only one analog input pin (A0) available on Bolt Wi-Fi module, you can consider using a multiplexer (MUX) to expand the number of analog input pins and connect multiple sensors simultaneously.

Here’s a brief explanation of how you can use a multiplexer:

  1. Choose a suitable multiplexer: Look for a multiplexer IC that supports analog signals and has enough channels to accommodate the number of sensors you want to connect. (Popular options include the CD4051 or CD4052.)

  2. Connect the multiplexer to your Bolt module: Connect the power (VCC and GND) pins of the multiplexer to the appropriate power supply on your Bolt module. Connect the select/control pins of the multiplexer to digital output pins on the Bolt module, such as GPIO pins.

  3. Connect the sensors to the multiplexer: Connect the output pins of your sensors to the input channels of the multiplexer. Each sensor should be connected to a separate channel.

  4. Control the multiplexer: Use the digital output pins on the Bolt module to control the select/control pins of the multiplexer. By changing the digital output combination, you can select which sensor’s output you want to read.

  5. Read sensor data: With the multiplexer properly connected and controlled, you can read the sensor data from the selected channel by using the analog input pin (A0) on your Bolt module.

Remember to consult the datasheet and documentation of your specific multiplexer IC to understand its pin configuration, control logic, and how to properly interface it with your Bolt Wi-Fi module.