MShemet
Posts: 2
Joined: Fri Dec 27, 2019 5:36 am

RP Zero W GPIO

Sat Dec 28, 2019 1:29 pm

Hi guys. Please help!

Need help with GPIO. I have 21 sensors connected to the RP Zero W and I’m not sure which GPIO is best for which sensor.

I have:
- 7 thermistors
- 5 Ammeter
- 4 pcs 5/110VAC really
- 3 buttons (open / close)
- 1 pressure sensor
- 1 wet sensor.

Thank you in advance!

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5590
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: RP Zero W GPIO

Sat Dec 28, 2019 2:39 pm

MShemet wrote:
Sat Dec 28, 2019 1:29 pm
Hi guys. Please help!

Need help with GPIO. I have 21 sensors connected to the RP Zero W and I’m not sure which GPIO is best for which sensor.

I have:
- 7 thermistors
- 5 Ammeter
- 4 pcs 5/110VAC really
- 3 buttons (open / close)
- 1 pressure sensor
- 1 wet sensor.

Thank you in advance!
More detailed info. is needed especially w.r.t the thermistors, ammeters, pressure sensor and "wet sensor". If any of those devices are "analogue" rather than using I2C, SPI or serial or other digital interface they cannot be used directly with a Pi - it doesn't have any analogue inputs. (The only things in your list that can be regarded as "digital" are the buttons and relays and the latter will require a "buffer circuit" such as a transistor switch or, better, an opto-isolator.) Some GPIO's can be "dedicated" to I2C, SPI, Serial or interfaces/protocols the rest are mainly for input or output logic ie. don't have special, predefined hardware, alt(ternative) functions. The table below gives some indication of what can be setup - I have the I2C, SPI and serial interfaces enabled:

Code: Select all

pi@raspiP4B4b-32GbP:~ $ gpio readall
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT5 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT5 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT  | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
(NB. whilst the above was dumped from a P4B a P0 has the same layout etc.)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

fruitoftheloom
Posts: 23132
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: RP Zero W GPIO

Sat Dec 28, 2019 2:44 pm

MShemet wrote:
Sat Dec 28, 2019 1:29 pm
Hi guys. Please help!

Need help with GPIO. I have 21 sensors connected to the RP Zero W and I’m not sure which GPIO is best for which sensor.

I have:
- 7 thermistors
- 5 Ammeter
- 4 pcs 5/110VAC really
- 3 buttons (open / close)
- 1 pressure sensor
- 1 wet sensor.

Thank you in advance!

https://pinout.xyz/
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: RP Zero W GPIO

Mon Dec 30, 2019 5:35 pm

MShemet wrote:
Sat Dec 28, 2019 1:29 pm
Hi guys. Please help!

Need help with GPIO. I have 21 sensors connected to the RP Zero W and I’m not sure which GPIO is best for which sensor.

I have:
- 7 thermistors
- 5 Ammeter
- 4 pcs 5/110VAC really
- 3 buttons (open / close)
- 1 pressure sensor
- 1 wet sensor.

Thank you in advance!
Before you go any further you must learn the
Difference between Digital electronics and
Analogue electronics, So a course in basic
Electronics is a must for you then you will know
How to interface with the Pi GPIOs
Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

MShemet
Posts: 2
Joined: Fri Dec 27, 2019 5:36 am

Re: RP Zero W GPIO

Thu Jan 02, 2020 2:08 pm

Thank you for your replay. Temperature sensors we’ve got is digital. The only analog sensor is ammeter and we already have an analog to digital converter.
The question, is there any difference in using different gpio or they are all can be used at any digital sensor.
Thank you.

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: RP Zero W GPIO

Thu Jan 02, 2020 2:54 pm

MShemet wrote:
Thu Jan 02, 2020 2:08 pm
The question, is there any difference in using different gpio or they are all can be used at any digital sensor.
GPIO2 (SDA1) and GPIO3 (SCL1) have 1K8 pull-ups to 3V3; the others do not. In the majority of cases this should have little effect on digital interfacing but it would be recommended to reserve the I2C pins for I2C interfacing. The same would be true for those pins which support UART and SPI use.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5590
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: RP Zero W GPIO

Fri Jan 03, 2020 1:08 am

hippy wrote:
Thu Jan 02, 2020 2:54 pm
MShemet wrote:
Thu Jan 02, 2020 2:08 pm
The question, is there any difference in using different gpio or they are all can be used at any digital sensor.
GPIO2 (SDA1) and GPIO3 (SCL1) have 1K8 pull-ups to 3V3; the others do not. In the majority of cases this should have little effect on digital interfacing but it would be recommended to reserve the I2C pins for I2C interfacing. The same would be true for those pins which support UART and SPI use.
+1 and to be sure that the sensors use 3.3V logic levels ...
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Return to “Beginners”