X10 Community Forum

📱🖥️PiX10Hub => 💬General Discussion => 📝GPIO Projects => Topic started by: Tuicemen on December 28, 2020, 11:08:11 AM

Title: Utilizing the GPIO Pins.
Post by: Tuicemen on December 28, 2020, 11:08:11 AM
Like many that use the PiX10Hub image I just wanted a winning solution to AHP.

The fact that a simple inexpensive low power computer would fit inside a CM15A was A bonus for me and I had no desire to utilize the GPIO pins.
Times have changed!
There are so many small modules, sensors and things that will work from these pins with little coding to make them perform.
I created this section so users could share their Ideas and projects.
These can be stand alone projects, created to work with Home Genie(HG), or integrated into your Home Automation setup some other way.
 HG has some code already for the GPIO pins found in the Package manager however some work is required to get these to work with newer versions of HG and newer Pi Boards.
If your running any of those programs I'm sure others would be interested what your using them for.
Please start a new thread for each GPIO Project!
 >!
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on December 28, 2020, 08:29:36 PM
Just a suggestion, but have you checked out the Raspberry Pi forums yet?  There are a ton of projects posted there with a very active community.  I imagine you would get a lot of ideas just by perusing the list of projects!
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 29, 2020, 07:25:38 AM
I have checked out a few different projects that sounded interesting. In creating this section my intent was for others to show off what they did for their Home Automation. Maybe how they utilized one of the many projects for their own use.
 Utilizing the GPIO pins is far easier then most would think especially if your board has the pins already soldered on the board .(all my ZeroW boards do not). :-[
 Things you can add to the pins are almost endless. Some can be very complicated using resistors and a bread board while others don't require those.
I could post several projects that could be used in a HA project but since I've not done them I couldn't comment on them. Others may think of uses for some I dismissed think the project couldn't be used in a HA setup.
 I have several DHT11,22 and other sensors I'm currently playing with however currently not using them in my HA setup. Once I do I'll post a separate thread showing them off.
 
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on December 29, 2020, 02:32:35 PM
Without header pins, all you have to do is turn on your soldering iron and add them.  They aren't required if you are creative either way.  I have a few Arduino and sensor boards that I've used various methods to test by adding either jumpers held at an angle or spring loaded clips to attach.  Of course, the easiest method is to just solder the header on and use a combination of bread board, jumper wires, and whatever components are required (resistors, sensors, etc).  FWIW, most of the basic projects that have resistors are usually used for pull-up/down and are not required for the RPi so long as you set the internal pull-up/down resistor appropriately.  I'd actually counter that a breadboard is the way to make a project LESS complicated rather than more-so.

And as for the DHT sensors, if you don't have headers, how are you intending on hooking those to your Zero?  It is possible that they could line up with the GPIO header such that power, ground, TX, RX are all in a row, but the reality is that they probably won't.  When I was testing with mine, I used a breadboard and some jumpers to get everything hooked up.  Granted that was with an Arduino, so it should be possible to do with 4 direct jumpers to GPIO on RPi.  Keep in mind that the DHT sensors have tiny/flimsy connectors and don't like working with either jumpers or a breadboard.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 29, 2020, 02:48:28 PM
Without header pins, all you have to do is turn on your soldering iron and add them.  They aren't required if you are creative either way.  .
And as for the DHT sensors, if you don't have headers, how are you intending on hooking those to your Zero? 
I've soldered male to female jumper wires to the PI and plug the sensor into the female ends.
Quote
It is possible that they could line up with the GPIO header such that power, ground, TX, RX are all in a row, but the reality is that they probably won't.  When I was testing with mine, I used a breadboard and some jumpers to get everything hooked up.  Granted that was with an Arduino, so it should be possible to do with 4 direct jumpers to GPIO on RPi.  Keep in mind that the DHT sensors have tiny/flimsy connectors and don't like working with either jumpers or a breadboard.
The DHT sensors have 4 pins but only 3 are used with a Pi. My DHT11 & 22 sensors are ones already mounted to a small board that has the resistors added similar to this. The pins are much heavier.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 30, 2020, 07:01:45 PM
I've about 5 GPIO pin projects now in my bucket list.
A couple are simple adds like a power button and and LED light to easily see if my Pi is Powered up. These could be incorporated into one project using a lighted button. ;)
A couple others are gas sensors which I started to look into last spring when I ordered my DHT22 sensors.
I've yet to order these sensors.
The biggest project I have in my list I suspect will be a weather station for my off grid place. However I probably will do the power button project for all my Pi boards I just have to find a button I like. rofl
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on December 30, 2020, 08:04:37 PM
Power button with a light:
https://www.canakit.com/raspberry-pi-switch.html
I've used a switch like this built into a power supply and it's a nice option that just plugs right in.

Not sure about the type of gas sensor you are talking about, but if it's a CO/CO2/Methane detector type, then that's a specialty sensor. 

LP: https://www.dfrobot.com/product-684.html
CO: https://www.sparkfun.com/products/9403
CO2: https://store.arduino.cc/usa/gravity-analog-co2-gas-sensor

If you are talking about a device that can detect gas meter usage, that is a type of device that I've looked into in the past in connection to a ESP type setup.
http://seductiveequations.com/2015/11/09/water-meter.html

Weather stations are very popular for the SBC crowd.  I get it, it's easy to make a small computer with GPIO read sensors and make a database.  But the real issue is, where is that computer located.  If you want to know the weather on your work bench, these are AWESOME!  If you want to know the weather outside, you have to come up with a device that runs off of a battery and/or solar.  You also have to come up with a weatherproof case.  Oh, and it has to wirelessly communicate with a data logger.  Save yourself a lot of effort and just pick something that's compatible with rtl_433 and move on...
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 30, 2020, 08:38:57 PM
I actually have most of the stuff for a weather station already to do the wind & rain readings and since my solar array already has a solar battery setup for turning one of my arrays, the pi 3B+ can be powered from it.
I'm not interested in creating a data base, it would be more for current readings.

The gas sensors I was thinking about were for CO2 and hydrogen never thought of LP. I did see one that did several gasses but at the time I was more interested in the DHT sensors as HG had programs already available. (little did I know they didn't work with the current HG/OS combination.) ::) :'
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 30, 2020, 08:43:40 PM
I'm a little leery on the https://www.canakit.com/raspberry-pi-switch.html, isn't that just like pulling the power wire? (not good for the OS or board.)
What I'm looking at does a safe shutdown before you cut the power.
Title: Re: Utilizing the GPIO Pins.
Post by: petera on December 30, 2020, 09:52:21 PM
Oh my days of solder beads are nearing an end  rofl Dropped solder beads, burnt finger tips, bread boards etc. Nah. The Sense Hat will put an end to all that. https://www.deviceplus.com/raspberry-pi/raspberry-pi-sense-hat-led/ Hopefully my latest Arduino project, an EEPROM programmer needed in a hurry to read the EEPROM firmware on my alarm panel will be my last.

Personally I’d use an Arduino with its analogue sensors and interface it to the RPI and HG via Serial Port program. You can extract any reading you want and send it to a HG widget with a bit of basic coding. The old DHT sensors wouldn’t be my first choice of sensor. Problematic and quite dated at this stage. Still work with what you have.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 31, 2020, 07:16:42 AM
My Soldering days are also nearing an end. My eye sight is no where near what it was.
If I had even a sight inkling I would have been using GPIO pins I would have ordered them pre soldered on my Zero W boards.
Using bread boards I still can't see myself doing so some projects I'd like to do just won't get done. ::) :'
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on December 31, 2020, 02:29:47 PM
It takes 3 minutes to just solder the headers on (a few more if the iron isn't already hot).  Then you don't have to solder again.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on December 31, 2020, 02:59:48 PM
It takes 3 minutes to just solder the headers on (a few more if the iron isn't already hot).  Then you don't have to solder again.
Yes, however since where my Zero W boards are (inside the CM15) room is limiting. Luckily I have only few GPIO projects planed for these boards. The Pi 3B+ has the header pins so it makes it easy to test from it then setup on a Zero W. >!
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on December 31, 2020, 04:56:57 PM
Well, one solution would be to extracate the RPi from the CM15A and install it in a small case of it's own.  My brother has one that has a small display hat that plugs in which makes a very nice package for a variety of projects. I believe that setup was intended to monitor pine wood derby races.

From my memory of the size of the CM15A battery compartment, I'm surprised you wouldn't be able to fit the board with headers on it since the headers are around 1/2" tall and the box is taller than a battery (3/4" or so).  Seems it would be easy to use as is or remove the CM15A cover and cut a slot for the GPIO wires to exit.  The wires have to get out to the sensors or whatnot anyway.
Title: Re: Utilizing the GPIO Pins.
Post by: petera on December 31, 2020, 10:51:20 PM
If you’re into minimalism you could bury this little gem from Gene into your CM15. It’s an embedded X10 solution and the project looks fairly straightforward and would solve all your problems as it’s based on the ESP 8266 board and gives plenty of expansion options including GPIO and other features https://github.com/genielabs/homegenie-mini
Title: Re: Utilizing the GPIO Pins.
Post by: brobin on January 01, 2021, 12:34:59 AM
If you’re into minimalism you could bury this little gem from Gene into your CM15. It’s an embedded X10 solution and the project looks fairly straightforward and would solve all your problems as it’s based on the ESP 8266 board and gives plenty of expansion options including GPIO and other features https://github.com/genielabs/homegenie-mini

But you still gotta solder some headers!  rofl

Happy New Year All!
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on January 01, 2021, 04:01:17 AM
 rofl
Happy New Years!
I had looked at Gene's mini when he first developed it, however I already had the ZeroW in my CM15.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on January 02, 2021, 09:04:06 AM
I thought  about utilizing more then one GPIO project and combining them into one . The first example is using my current DHT Sensor project with a project to light up a LED on the pi case prviding a visual alert that Temperature or Humidity needed attention. I suspect the GPIO HG addon project can turn on off a LED connected to a GPIO pin.
Title: Re: Utilizing the GPIO Pins.
Post by: petera on January 02, 2021, 09:55:38 AM
I thought  about utilizing more then one GPIO project and combining them into one . The first example is using my current DHT Sensor project with a project to light up a LED on the pi case prviding a visual alert that Temperature or Humidity needed attention. I suspect the GPIO HG addon project can turn on off a LED connected to a GPIO pin.

While using sensors in conjunction with GPIO, breadboards, connectors, capacitors, soldering etc is a good tinkering exercise for anyone interested in environmental projects the RPI Sense Hat does all that work for you. Just snaps onto the Raspberry Pi GPIO pins and includes all the Python libraries you’ll ever need to create your own weather station.

Six on board sensors will allow you to cover most if not all of a weather station’s sensor range without all the hardship. All neatly contained on one board and can be used as is indoors and with a suitable housing and a solar powered battery pack can be deployed neatly outdoors. https://www.raspberrypi.org/products/sense-hat/

Definitely worth checking out for those interested in all things sensors without all the laborious setup.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on January 06, 2021, 06:00:28 PM
I seen this gas sensor kit while going through Amazon
https://www.amazon.com/BONATECH-Modules-Project-Starter-Detection/dp/B07D9H74LT/ref=sr_1_15?dchild=1&keywords=MQ-8+gas+sensor&linkCode=gs3&qid=1609973259&sr=8-15&tag=787ca-20
I could see a use for most of them at my off grid place. the world of the GPIO pins is opening up some great remote monitoring options.
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on January 06, 2021, 06:12:17 PM
You might want to look into those sensors more closely. They indicate they require 5v to power them but I dont see their logic level. Usually, when not published, I would assume the logic level will be only the same as the input voltage. Since the RPi GPIO are not 5v tolerant, you might burn something up if you just plug it in without proper circuit protection.
Title: Re: Utilizing the GPIO Pins.
Post by: petera on January 07, 2021, 02:58:42 AM
For anyone relatively new to the world of the GPIO interface you may want to refer to this document. It exploits the built in the Pi programming language Scratch and gives a good grounding in the safe use of sensors. We have the kids here plugging away at the various different projects and of course they are flying through them.

Please heed the cautionary notes in this document as mentioned above by bkenobi. Fried Pi is not something anyone would want to see or worse a house full of burning embers https://projects.raspberrypi.org/en/projects/physical-computing-with-scratch/2
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on January 09, 2021, 08:11:05 AM
You might want to look into those sensors more closely. They indicate they require 5v to power them but I dont see their logic level. Usually, when not published, I would assume the logic level will be only the same as the input voltage. Since the RPi GPIO are not 5v tolerant, you might burn something up if you just plug it in without proper circuit protection.
Good to Know thanks!
I did look up specs for most if not all the sensors in the package and most state they don't go over 4 volts. There are 1 or 2 that do not state their max voltage pull.
Title: Re: Utilizing the GPIO Pins.
Post by: Tuicemen on January 09, 2021, 08:15:10 AM
Please heed the cautionary notes in this document as mentioned above by bkenobi. Fried Pi is not something anyone would want to see or worse a house full of burning embers https://projects.raspberrypi.org/en/projects/physical-computing-with-scratch/2
Nice link makes me feel like a Kid again. (not a bad thing!) ;)
I did see some projects that could be utilized with HG however most are for creating games.
 >!
Title: Re: Utilizing the GPIO Pins.
Post by: bkenobi on January 09, 2021, 10:20:00 AM
The ROi was developed to be an inexpensive learning tool for kids in less developed areas of the world. It was intended to give an opportunity to learn about HW and software without the expense or knowledge typical with more traditional tools. By providing an all in one development board and PC for $40 that merely requires a psu, keyboard, and display, they made it a tool anyone can afford to buy or even donate. The software was all free and open source including the stretch programming environment which includes lessons.

The fact that they eventually decided to sell to everyone else was a true bonus and not by initial design. The hobbyist community has boomed based on these boards, but we weren't in any of the plans originally.