firstplacefranz
Posts: 21
Joined: Wed Apr 18, 2012 6:25 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:28 pm

Whats the point of Gpio pins? The only use I have seen for them is blinking LED lights. Is there a practical use for them?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:36 pm

Search the forum for "GertBoard", and, in particular, find and view the video that he made, which demonstrates what the GertBoard can do.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23655
Joined: Sat Jul 30, 2011 7:41 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:38 pm

firstplacefranz said:


Whats the point of Gpio pins? The only use I have seen for them is blinking LED lights. Is there a practical use for them?


Practical use? Blinking LED lights. Especially blue ones.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:41 pm

firstplacefranz said:


Whats the point of Gpio pins? The only use I have seen for them is blinking LED lights. Is there a practical use for them?



The point is sharp and if you stab yourself with them then it'll hurt...

OK... maybe not!

I think the answer is "because we can". And to make it easier to connect it up to other stuff like motors, sensors to make the whole device a bit more exciting for newbies to get into.

And I think it's good to have some sort of programmable IO back in a "PC" again. In ye olden days of the Apple II (what I started with) there was the game connector - it was actually 4 analogue inputs, 3 digital inputs and I think 1 or 2 digital outputs. Then the BBC Micro came along and we had the User port with 8 digital IO pins, the joystick port with more analogue and digitial inputs - the printer port - and I'm probably not the only one who used it as extra outputs and so on.

Modern computers lack the hackability of those early machines, so this is giving a little back.

At least that's my intrepretation!

Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
nick.mccloud
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:43 pm

firstplacefranz said:


Whats the point of Gpio pins? The only use I have seen for them is blinking LED lights. Is there a practical use for them?


Interfacing to anything in the outside world - temperature, light, dark, voltage, pressure, humidity, turning things on or off - the possibilities are endless and far greater than just displaying stuff on a monitor. Imagine being able to click a button on a web page to turn on your heating before you leave the office so it's warm when you get home. Or monitor the river levels in the south part of Britain from up here in the slightly damp and well watered north.

Andre_P
Posts: 241
Joined: Sun Aug 28, 2011 7:57 am

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:43 pm

The GPIO pins allow the RPi to be programmed to interact with the outside world. It allows sensor inputs and actuator outputs to be used. There is an IO expansion board called the Gert Board.
There are various robot projects that will use GPIO, as well as some interesting sensor projects.
It"s from this that people can get experience in Embedded System Software and maybe designing the electronics to connect to the GPIO.
So lots of good reason for it .

selsinork
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 7:43 pm

JamesH said:

 Especially blue ones.

Nooooooooooooooooooo.....................

n31l
Posts: 21
Joined: Fri Apr 06, 2012 8:27 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 8:13 pm

I thought that GPIO pins are something for the hardware person in us all to play with. Also they are for letting the software do something more than play games, surf the net and display porn. Without io the pi would be more of a flan.

firstplacefranz
Posts: 21
Joined: Wed Apr 18, 2012 6:25 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 10:04 pm

Didnt know they were that useful, thanks guys... Ill have to come up with some good projects.

BTW. anyone know when the gertboard will be ready?

User avatar
johnbeetem
Posts: 945
Joined: Mon Oct 17, 2011 11:18 pm
Location: The Mountains
Contact: Website

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 10:45 pm

Along with general-purpose digital I/O, there are some nifty low-level peripheral interfaces:

UART: you can use this to talk to a serial terminal.

I2C: medium-speed interface to lots of cute ICs including real-time clocks and pressure/temperature sensors.

SPI: faster interface to lots of other cute ICs including analog-to-digital converters.

k3v1nc
Posts: 10
Joined: Tue Apr 17, 2012 2:40 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 10:53 pm

GordonH said:


And I think it's good to have some sort of programmable IO back in a "PC" again.

.

.

Modern computers lack the hackability of those early machines, so this is giving a little back.

Gordon


I agree! This is long overdue, once the USB era was established, we lost the ability to hack stuff using the hardware ports.

One word of warning though, this is an operating system based computer, not a real time microcontroller like say an Arduino for example. So you can't be sure on the precise timing or prioritization when sending bits to the GPIO ports. For some projects that need a nearly instant reaction time between receiving a signal, interpreting it, and then acting on it (some kind of closed-loop application) you are better off with a different kind of device that works at a lower level, and just having your R Pi just send commands to that lower level real-time controller.

User avatar
jbeale
Posts: 3492
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 11:16 pm

I'd agree, the easiest approach for real-time stuff is to use an Arduino or similar. However there are several "Real-Time" versions of Linux including ADEOS, ART Linux, KURT, Linux/RK, QLinux, RED-Linux, RTAI, RTLinux, Xenomai. In the future, some of these might be ported to RasPi(?) If the kernel is preempted by a RTOS that will cause some tradeoffs in keeping up with other CPU tasks, of course. See also: http://www.linuxfordevices.com.....nce-Guide/

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

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 11:17 pm

k3v1nc said:

One word of warning though, this is an operating system based computer, not a real time microcontroller like say an Arduino for example. So you can't be sure on the precise timing or prioritization when sending bits to the GPIO ports.
Though presumably only for Linux or another OS - run bare metal code and it should be as good and deterministic as any other microcontroller, with a lot more speed and memory to play with.

Though the focus is on Linux, bare metal programming resources will come in due course.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12224
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 11:34 pm

The R-PI has on its GPIO header:

8 GPIO parallel I/O pins, that can control:

* Relays

* motors

* Dynamite sticks

* buzzers

* lamps

* heating elements

And thousands of other things, and as inputs can read (detect)

* Switches and pushbuttons

* light levels shining on LDR's

* Status signals from digital devices

* Water levels

* trip wires

* Rocks thrown into ponds.

And millions of other slightly digital input signals (with help from the right sensors)

It also has a UART (Universal Asynchronous Receiver Transmitter) (actually it seems to have several), which can be used for bidirectional communication with a zillion other devices and micro-controllers, for keyboards, mouse, joystick and not to forget via  a level converter to RS232 signals. Probably the most useful use will be to control arduino's, used as "real time interface controllers".

It has I2C (inter IC bus) useable (as the name implies) to connect to all kinds of digital IC's, its heavily used inside all kinds of devices, Originally invented to be used inside TV,s as a connection between the main controller, the remote control interface, the front touch buttons, the Teletext receiver the Real Time Clock, etc etc. Today is use has exploded in thousands of devices, making it possible that all kinds of subparts in a device can talk to each other. For example in a satellite its often used as the internal "bus" so that the main controller can talk with the "maximum power point tracker", the gyroscope, and the "star tracker". To mention just a few devices inside a sattelite.

SPI  (serial peripheral interface) allows a single "master" (the R-PI) to "talk to" a number of "slave devices" (in case of the raspberry two, but the number can be expanded) at high speed. Its use is the fast transfer of lots of data, for example its the basic interface mode for SD-Cards (so it could be used to connect a second SD-cardslot to the R-PI). Its used for all kind of high speed connections (except for sound for which other specialized  standards exists).

Although a bit hidden the R-PI also has a PWM (pulse width modulation) output, these can be used as simple analog to digital converters (but generally not for sound), But the most common use is for controlling servo motors.

GPIO pins can also be combined to create new kinds of interfaces, and the possibilities of those are endless.

k3v1nc
Posts: 10
Joined: Tue Apr 17, 2012 2:40 pm

Re: Whats the point of Gpio pins?

Wed Apr 18, 2012 11:58 pm

hippy said:


k3v1nc said:


One word of warning though, this is an operating system based computer, not a real time microcontroller like say an Arduino for example. So you can't be sure on the precise timing or prioritization when sending bits to the GPIO ports.


Though presumably only for Linux or another OS - run bare metal code and it should be as good and deterministic as any other microcontroller, with a lot more speed and memory to play with.

Though the focus is on Linux, bare metal programming resources will come in due course.


This is true, although the same could be said about nearly any computer, one could write machine or assembly code and execute it directly without an OS. I would very much like to see a real-time OS distribution and/or SDK be made available for those interested in these type of uses of the RaspberryPi. Although it will be quite limited in IO as compared to an ArduinoMEGA, but IO expansion boards could overcome that to some extent.

I just hope people become more educated about the difference between running something on top of an OS vs directly on the processor. This is especially relevant to robotics applications that require precision. Can you imagine someone using a physical limit switch wired to a GPIO pin that's read by a process running on top an OS? let's hope it wasn't moving too fast or eek broken machine parts!

plugwash
Forum Moderator
Forum Moderator
Posts: 3454
Joined: Wed Dec 28, 2011 11:45 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 12:10 am

hippy said:


Though presumably only for Linux or another OS - run bare metal code and it should be as good and deterministic as any other microcontroller, with a lot more speed and memory to play with.


Not exactly, even without an OS you still have a complex memory heirachy which is shared with the GPU. This makes it FAR FAR harder to determine how long instructions will take than on a microcontroller where all memory is equal.

amiga65
Posts: 70
Joined: Wed Jul 27, 2011 10:59 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 1:26 am

But most important of all is You can blink leds with them.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 6:24 am

+2 for blue blinky LEDS
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 8:34 am

mahjongg said:


The R-PI has on its GPIO header:

8 GPIO parallel I/O pins, that can control:

...

* Dynamite sticks

...

* trip wires


I sometimes worry about people on this forum.

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

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 10:18 am

plugwash said:


hippy said:


Though presumably only for Linux or another OS - run bare metal code and it should be as good and deterministic as any other microcontroller, with a lot more speed and memory to play with.


Not exactly, even without an OS you still have a complex memory heirachy which is shared with the GPU. This makes it FAR FAR harder to determine how long instructions will take than on a microcontroller where all memory is equal.


Good point; the SoC is CPU+GPU, not just a CPU.

Is how timing may be affected described anywhere ? I suppose the main question is does it it just add a few instruction cycles or does it stall everything for prolonged periods, can the  GPU access be disabled ?

I imagine any non-deterministic variance for bare metal code would be in the order of microseconds whereas it could be milliseconds with an OS on top; would that generally be correct ?

User avatar
exartemarte
Posts: 373
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
Contact: Website

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 11:16 am

Don't underestimate the satisfaction of blinking an LED!

I've been using microcontrollers, as well as PCs, for longer than I care to remember, but with any new device/language/whatever the first thing I do is blink an LED. As, I suspect, do most other hardware hackers.

They're also handy for testing and debugging - in the early stages it's often useful to substitute an LED for the motor, detonator, Large Hadron Collider or whatever else is eventually going to be controlled.

Talking of which, have we all seen these rapid prototyping LED arrays? Very useful on a breadboard.

k3v1nc
Posts: 10
Joined: Tue Apr 17, 2012 2:40 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 1:44 pm

I wonder how many hobbyists are going to burn out the GPIO pins trying to drive things without proper voltage/current considerations… it might take awhile before you can get your hands on a replacement board, so be careful with your first one, and properly isolate the Raspberry Pi when attempting to control things with the GPIO pins!

k3v1nc
Posts: 10
Joined: Tue Apr 17, 2012 2:40 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 1:54 pm

exartemarte said:


Don"t underestimate the satisfaction of blinking an LED!

I"ve been using microcontrollers, as well as PCs, for longer than I care to remember, but with any new device/language/whatever the first thing I do is blink an LED. As, I suspect, do most other hardware hackers.

They"re also handy for testing and debugging – in the early stages it"s often useful to substitute an LED for the motor, detonator, Large Hadron Collider or whatever else is eventually going to be controlled.

Talking of which, have we all seen these rapid prototyping LED arrays? Very useful on a breadboard.


Everyone"s a fan of of the Blinkenlights. It seems quite appropriate given that the goal is to offer the world an opportunity to go back to the technology environment of the 70s and 80s that fostered computer tinkering, and being excited by writing a program that controlled an led with your computer.

Check this guy"s project out, he re-created a Kenbak-1 computer using an Arduino to emulate the hardware, and then gave it a miniaturized version of the original case complete with blinkenlights and pushbutton machine code programming: http://www.funnypolynomial.com.....enbak.html

That project is a use case for IO pins and LEDs if I've ever seen one.

firstplacefranz
Posts: 21
Joined: Wed Apr 18, 2012 6:25 pm

Re: Whats the point of Gpio pins?

Thu Apr 19, 2012 9:52 pm

How are the pins numbered. In the Code on the wiki the GPIO pins are numbered, GPIO 1, GPIO 0, ect. What is the ordering of these pins? which is 0, and 1?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12224
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Whats the point of Gpio pins?

Fri Apr 20, 2012 12:49 am

bredman said:


mahjongg said:


The R-PI has on its GPIO header:

8 GPIO parallel I/O pins, that can control:

...

* Dynamite sticks

...

* trip wires


I sometimes worry about people on this forum.


LOL

Return to “General discussion”