Page 1 of 1

setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 15:43
by guantolento
hi to all,
iam testing to use a pin on the gpio to use as an input in domoticz.
i connect a button (normally open) betwenn the physical pin 34 (ov) and the physycal pin 32 (name GPIO.26 and BCM 12).
in this mode when the button is unpressed, on the pin 32 i have nothing, when the buttun is pressed i must have 0v.
if i use the command gpio readall from shell i look always the value of the pin is V 0.

to export in domoticz i use a sysf gpio hardware. in the file to startup domoticz i add this line:

echo 12 > /sys/class/gpio/export

and i can add a virtual device connect to the sysf gpio on bcm 12. i set the type as contact as i find in the wiki.

i think in the export miss something, but i don't understand because from gpio readall the value is always 0.

someone can help me ?

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 16:10
by SweetPants
Did you use a pull-up resistor?

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 16:12
by guantolento
SweetPants wrote: Saturday 04 November 2017 16:10 Did you use a pull-up resistor?
actually i don't use nothing. tell me how restitor i must use .

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 16:21
by SweetPants
guantolento wrote: Saturday 04 November 2017 16:12
SweetPants wrote: Saturday 04 November 2017 16:10 Did you use a pull-up resistor?
actually i don't use nothing. tell me how restitor i must use .
10K to Vcc would do, Vcc being 3.3v

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 16:23
by guantolento
10k is the value of R1 ?

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 16:34
by guantolento
i find this 2 type of connection of the gpio. how i need to use ? pullup or pulldown ?

Re: setting a gio pin as input and export in domoticz

Posted: Saturday 04 November 2017 18:12
by SweetPants
Depends if you want the Gpio to go low (pullup) or high (puldown). Pulldown is not really a pulldown to 0V. I would choose pullup, you van always invert the action in software.

Re: setting a gio pin as input and export in domoticz

Posted: Tuesday 07 November 2017 16:50
by guantolento
but only to make a test. can i give 3.3v directly to the gpio pin? connect directly the button (NO) between the gpio and 3.3v ?

Re: setting a gio pin as input and export in domoticz

Posted: Tuesday 07 November 2017 22:52
by SweetPants
guantolento wrote: Tuesday 07 November 2017 16:50 but only to make a test. can i give 3.3v directly to the gpio pin? connect directly the button (NO) between the gpio and 3.3v ?
I don't think so, when the switch is open you have a floating input.