extra IO with PIR or distance snsor
Moderators: grovkillen, Stuntteam, TD-er
extra IO with PIR or distance snsor
Hello to all,
Is it possible to use an IO extension (Via i2c) and connect to it distance sensors or PIRs ?
I would like to automate my garage door and might be short on IOs for my requirement:
- 2 distance sensors (2 IO each)
- 1 PIR would be great (an other IO)
- 2 relays (those will be on an IO extension either way)
- Temperature (can also be done via i2c)
It's most likely possible to fit everything on the esp8266, but I think IO extension can offer more flexibility (and other sensors ).
Any idea ?
Thanks
Laurent
Is it possible to use an IO extension (Via i2c) and connect to it distance sensors or PIRs ?
I would like to automate my garage door and might be short on IOs for my requirement:
- 2 distance sensors (2 IO each)
- 1 PIR would be great (an other IO)
- 2 relays (those will be on an IO extension either way)
- Temperature (can also be done via i2c)
It's most likely possible to fit everything on the esp8266, but I think IO extension can offer more flexibility (and other sensors ).
Any idea ?
Thanks
Laurent
Re: extra IO with PIR or distance snsor
GPIO-4 and GPIO-5 is used as I2C.rudloffl wrote: ↑18 Jul 2019, 05:18 Hello to all,
Is it possible to use an IO extension (Via i2c) and connect to it distance sensors or PIRs ?
I would like to automate my garage door and might be short on IOs for my requirement:
- 2 distance sensors (2 IO each)
- 1 PIR would be great (an other IO)
- 2 relays (those will be on an IO extension either way)
- Temperature (can also be done via i2c)
It's most likely possible to fit everything on the esp8266, but I think IO extension can offer more flexibility (and other sensors ).
Any idea ?
Thanks
Laurent
I am currently using an MCP23017 with 2 pieces of SR-501 PIR as input, 1 pc door open sensor as input and 1 pin as output with an SSR relay.
I've disabled serial and redefined gpio-3 as output for a buzzer as an extra GPIO. (as rtttl command is not meant for MCP)
GPIO13 is used for RCWL radar sensor, as it did not want to work on the MCP.
Distance sensor is added to GPIO14 and GPIO12 as it needs real GPIO pins.
And there are no more freely usable pins left.
You can use for example:
GPIO-12,GPIO-13,GPIO-14, GPIO-3 for 2 distance sensors (disable serial first and use GPIO-3 as a trigger pin)
GPIO-4&GPIO-5 for I2C to MCP23017 and HTU21D or other I2C temp sensor
1 PIR onto the MCP23017
2 relays onto the MCP23017 (it has to be tested before finalizing, as MCP output can be 25mA/pin and 150mA max)
Re: extra IO with PIR or distance snsor
Thanks for your feedback. I will work on a proof of concept
Re: extra IO with PIR or distance snsor
I run a similar setup for my garage. My 2 door openers have reed switches at each end of the rail. I'm only really concerned with the ones at the "closed" end of the rail. I use an MCP23017 expander for additional inputs.
I have a voltage divider that takes the 9v to about 3v and run those into the mcp for my open/closed state of the two doors.
I have two HC-SR04 ultrasonic sensors that determine if that bays are occupied. I use two outputs of the MCP to two transistors that "push" the buttons.
Two additional inputs to the MCP through more voltage dividers tell me if something crosses either of the two IR "beams" so I can flip lights on if its dark. I have a board all designed up to do that including a few other features including a dallas temp sensor input. I have spare boards left over that I could send you if these I/Os sound about right for what you want.
Do you use EasyEDA?
I have a voltage divider that takes the 9v to about 3v and run those into the mcp for my open/closed state of the two doors.
I have two HC-SR04 ultrasonic sensors that determine if that bays are occupied. I use two outputs of the MCP to two transistors that "push" the buttons.
Two additional inputs to the MCP through more voltage dividers tell me if something crosses either of the two IR "beams" so I can flip lights on if its dark. I have a board all designed up to do that including a few other features including a dallas temp sensor input. I have spare boards left over that I could send you if these I/Os sound about right for what you want.
Do you use EasyEDA?
Re: extra IO with PIR or distance snsor
I have to put that project on hold for now (Sprinkler is the priority, the grass is not getting any greener...)
I have never heard of easyEDA, I will play with it
I have never heard of easyEDA, I will play with it
Re: extra IO with PIR or distance snsor
I'm back to that project !
Here where I am:
- 2 distance sensors directly on the esp
- 1 PCF8574 for 2 relays (both are OK and functional) and 1 for a PIR and a door sensor (those are less ok...)
Here are my questions:
- How do I monitor a PCF port ? What I tried below does not work?
- Is the monitor function compatible with PCF8574 ? Or should I go to a different GPIO extender ?
- Is it possible to use the PCF8574 for inputs (door + pir) and output (relays)
Any help will be appreciated.
Thanks
Code tried:
Here where I am:
- 2 distance sensors directly on the esp
- 1 PCF8574 for 2 relays (both are OK and functional) and 1 for a PIR and a door sensor (those are less ok...)
Here are my questions:
- How do I monitor a PCF port ? What I tried below does not work?
- Is the monitor function compatible with PCF8574 ? Or should I go to a different GPIO extender ?
- Is it possible to use the PCF8574 for inputs (door + pir) and output (relays)
Any help will be appreciated.
Thanks
Code tried:
Code: Select all
on System#Boot do
Monitor,PCFGPIO,2
Monitor,PCFGPIO,3
endon
on pcfGPIO#2=1 do
if [Plugin#pcfGPIO#Pinstate#1]=1
tasksetrun,3,1,1
endif
endon
on pcfGPIO#3=1 do
if [Plugin#pcfGPIO#Pinstate#3]=1
tasksetrun,3,1,1
endif
endon
Re: extra IO with PIR or distance snsor
Why do not you create separeted tasks for every function?
See wiki:
https://www.letscontrolit.com/wiki/index.php/PCF8574
If you create a task that will be input as default, if you want to use it an output, you do not need to create a new task, but use PCFGPIO,<pin>,<value> command, also in the wiki:
https://www.letscontrolit.com/wiki/index.php/PCF8574
Re: extra IO with PIR or distance snsor
Indeed...
I have been overthinking...
Just for my curiosity, is it possible to monitor a PCF8574 like described here ? https://espeasy.readthedocs.io/en/lates ... Rules.html
I have been overthinking...
Just for my curiosity, is it possible to monitor a PCF8574 like described here ? https://espeasy.readthedocs.io/en/lates ... Rules.html
Code: Select all
on System#Boot do
Monitor GPIO,15
endon
on GPIO#15=0 do
if [Plugin#GPIO#Pinstate#13]=0
// do something
endif
endon
on GPIO#15=1 do
if [Plugin#GPIO#Pinstate#13]=1
// do something
endif
endon
Who is online
Users browsing this forum: No registered users and 2 guests