# want GPIO



## blah44 (Jan 27, 2014)

I have a Raspberry Pi running Lunix and I have been having all kinds of fun connecting ADCs, sensors, etc. This is simple and works well enough, but got me thinking about my FreeBSD PC. Can I somehow get GPIO pins, through a PCI card or otherwise, on a plain jane PC? Would FreeBSD support them?

Thanks!


----------



## SirDice (Jan 27, 2014)

You can install FreeBSD 10 on a Raspberry Pi 

But if you're looking to experiment with a desktop or laptop PC you can 'abuse' the parallel port. It has 8 controllable I/O pins.


----------



## blah44 (Jan 27, 2014)

I would love to but FreeBSD hates all my SD cards, and no one has a solution except for buying more and more until you find one that works -
http://forums.freebsd.org/viewtopic.php?f=11&t=43596

Thanks for the parallel port note! I will definitely check that out.


----------



## wblock@ (Jan 27, 2014)

What is this "parallel port" you speak of? 

The FTDI USB to serial adapters have some surprising abilities: http://hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode/.  I don't know how accessible that would be from FreeBSD.  There are USB to GPIO modules (for example http://numato.com/8-channel-usb-gpio-module), and lots of microcontrollers could be used as gateways.  Arduino works on FreeBSD, ask me how I know   Like with the FTDI chips, the hard part could be the software.

And it depends on inputs or outputs.  Microphone inputs can be used as analog inputs with appropriate input filtering.  The keyboard LEDs could be used as digital outputs.


----------



## SirDice (Jan 28, 2014)

wblock@ said:
			
		

> What is this "parallel port" you speak of?


Old farts know it as the printer port, even older farts know it as Centronics  Although newer PCs don't seem to have one any more. But there are still cards and USB to parallel converters available and they're dirt cheap. They're the easiest way to get 8 I/O pins. With a bit of bit banging you can use a couple of the control pins as input or output too. With the I/O pins you can easily drive a transistor which in turn can turn on a LED. With a bit more electronics you can switch a relay instead of a LED.


----------



## SirDice (Jan 28, 2014)

blah44 said:
			
		

> I would love to but FreeBSD hates all my SD cards, and no one has a solution except for buying more and more until you find one that works -
> http://forums.freebsd.org/viewtopic.php?f=11&t=43596


I have a couple of SanDisk cards that seem to work well.


----------



## wblock@ (Jan 28, 2014)

The nice thing about USB is that it gives a measure of isolation from the main computer.  Maybe not a lot, but more than a native parallel port.  A USB to parallel adapter may not give direct access to the pins, and could require building some circuitry to handle the parallel handshake lines.  That same type of thing could be done over Ethernet with an old parallel JetDirect, too.


----------



## darwimy (Feb 8, 2014)

Do you want to use FreeBSD on your Pi or on your PC? On the Pi you may get away with FreeBSD 10 and the gpio() bus system. I have not used it, but it supports 'device bcm_gpio' which sounds promising. Perhaps the i2c bus (iicbus()) does work on the Pi, too.

On my laptop I have used iicbus with the parallel port bit banging circuit (lpbb()) several times, but it requires a parallel port and is horrible slow. Another option is to use a FT245 USB to parallel FIFO. Those work similar to the well known FT232, but instead of a serial interface they provide a 8 bit parallel interface. Great for bit banging.


----------

