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

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