IR Sensor only shows value = 0


#1

Hi, I recently got BOLT hardware. I tried to interface an IR proximity sensor with BOLT. However ,the proximity sensor is giving only a ‘0’ value i.e. {“success”:“1”,“value”:“0”} every time even when there is no object in front of it in the 3D space of some distance around the sensor.
The ACTIVE LOW Sensor must give
•{“success”:“1”,“value”:“1”} - If there is no obstacle in front of it.
•{“success”:“1”,“value”:“0”} - If there is obstacle in front of it.
The Red light on the sensor continuously glows. I turned the screw on blue potentiometer till the light goes off and then used the sensor. However the result did not change.


#2

Does the red light glow when you put your hand infront of it and goes off when you remove the hand?


#3

No, the led remains in its previous state.


#4

By “remains in its previous state.” I believe you mean it is off even when you put your hand in front of it. Correct me if I am wrong.
Here is what you could do:

  1. Check what value it gives you when the light is off. If the light is off the code should give value as 1.

  2. If the value is 1 then you might have rotated the blue potentiometer too much. It should be rotated so much that the red light comes on when you place your hand in front of it

  3. If the value is still 0 then it could mean there is an error in the code. Do share the code with us in this case.


#6

This video might be helpful

https://drive.google.com/drive/folders/0B26-Cg9KhEWwcmprNm1xMU1Gc2M


#7

The Code is
_<!doctype html>
_
_ BOLT
_
_
_

Sensor data



_ READ sensor on pin 4
_

#8

Sorry!!
My previous reply showed the html output of my code
I have attached the image containing the code here.


#9

So you get Value=0 even when the light is off? If yes then please confirm and also share a picture of your circuit connection.


#10

Please check if you have connected it to Pin 4 only.


#11

Ya, I adjusted the pot such that the light glows when I keep an obstacle in front of it. It is woking fine now and I’m getting proper vaues.
However, while using JS for controlling BOLT GPIO pins, the light is not glowing when I press the buttons.
I believe bolt.js file is not present in the sd card,containing the all the files in the folllowing folder(link)
https://drive.google.com/file/d/0B-ICJE7ubL4NbGVNb0JMTnMwaTA/view?usp=sharing
Also I have sent an image of the code which I uploaded.


#12

I tried out with other digital pins like 0,1,5 etc( i.e replaced x in the code digitalWrite(x,HIGH/LOW) with the pin numbers and also connected led accordingly) and they worked perfectly, i.e. led glows/turns off when I click the corresponding buttons).
However, it is a one time process, i.e. once I click on the “led on” and then turn it off, once again I cant turn the led on when I click on the ON button.
i.e once I glow the led by connecting it to a particular pin say pin 5, I cannot glow it again on the same pin 5, even if I re-upload the code and restart the device.


#13

@kmanishkumark Happy to know that the sensor is working fine now. For the issue with Bolt.js file and LED control I suggest you to create another thread in the forum since this thread is about issue you are facing with IR Sensor. Will answer the query there.


#14

Hii ,how I can store d reading from {value=""}?