LM393 on GPIO - Switch not updating Topic is solved

Moderator: leecollings

Post Reply
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

LM393 on GPIO - Switch not updating

Post by ycahome »

Hello.

Am trying to add a LDR switch to my raspberry ans update one switch without success.

Connected my sensor to raspberry 2B following this guide http://www.uugear.com/portfolio/using-l ... pberry-pi/

When i run the python code "lm393.py" bellow:

Code: Select all

#!/usr/bin/python
import sys
sys.path.append ('/storage/.kodi/addons/debug.tools.i2c-tools/lib')
sys.path.append ('/storage/lib')
import smbus
import time

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.IN)

for i in range(0,5):
    print GPIO.input(4)

am getting the correct response (depends on LDR state):

Code: Select all

pi@Rpi-2B:~ $ ./lm393.py
0
0
0
0
0
pi@Rpi-2B:~ $

- added "Raspberry GPIO" to Domoticz H/W
- added a switch as described in https://www.domoticz.com/wiki/GPIO
- exported the GPIO 4

Code: Select all

pi@Rpi-2B:~ $ gpio exports
GPIO Pins exported:
   4: in   0  both
pi@Rpi-2B:~ $
BUT, switch is always at "Closed" state no matter what is the state of LDR (lm393)
test sw.JPG
test sw.JPG (18.84 KiB) Viewed 3710 times

What am doing wrong???????

.
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: LM393 on GPIO - Switch not updating

Post by ycahome »

Finally worked with those settings. Seems that i was not waited enough to see the switch toggle.

The problem is now that, with this method, we have a switch that receives EXTREMELY HIGH number of changes.
When am trying to see the log of this switch, it takes a lot of time to load.

Trying to find an alternative!!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest