Why am I getting sensor value even if LDR is not connected to wifi module?

Hello,

I have connected LDR to the bolt WIFI module and getting sensor values as expected all the time.

I wanted to add a scenario, wherein, if the LDR doesn’t work then a piece of code should work. But even after disconnecting the LDR from WIFI module (disconnected everything- LDR, resistor and nothing is connected to module) still I am getting a sensor value ranging 0- 80. Not sure why. Please explain why I am getting a sensor value even if nothing is connected to WIFI module.

Code – using boltiot package in the python code to call digitalwrite function.

This may due the internal sensors present in wifi module.

1 Like

I too thought that. So it means we would never able to identify if LDR is connected or not? Because wifi module will always give some resistance/sensor value, even though LDR is not present. That’s bad.

Hi @analegaonkar,

The Bolt WiFi module never knows that a sensor is connected to it. All it does is measure the voltage coming in at the A0 pin and digitises it to the range of 0 to 1024.

So in essence it is not possible for the Bolt WiFi module to detect that the sensor is broken, or not connected.

1 Like

it may be because the wifi module has its own sensor so when connected it displays the ldr value

when the sensor is not connected the pin is ‘floating’ that is any value between 0 and 1024. Unless you specifically write the pin to a certain value or externally give a certain voltage it may give erratic readings. Same problem in arduino’s and other microcontrollers

1 Like

This could be due to presence of noise. Since Bolt WiFi does not know that it is LDR connected, it will take any value

Since the light intensity is inversely proportional to the resistance of LDR, I think when you have disconnected the LDR there would be no current in the circuit which makes the WiFi module think it has infinite resistance which implies the light intensity is 0 or it’s dark so it gives some values between 0-80 as they are the most significant numbers for less light intensity.