Adding GPIOs To The Raspberry Pi With The Camera Interface

GPIOs

The Raspberry Pi Model B+ was just released, and now everyone who picks one of those up has a few more GPIO pins to play around with. For the millions of people with the two-year-old version of the Pi, we’re still stuck with the same old, same old: 17 GPIOs on the big header, and that’s about it as far as toggling pins goes.

The Broadcom SoC on the Pi has far more GPIO pins than are broken out on the large header, and a few of those go to the CSI camera interface. These GPIOs can be broken out with a few flat cables (Portuguese, Google Translatrix), giving you four more GPIOs, and this technique can also be used with the new, expanded Model B+.

The CSI camera connector has two I²C lines that go directly to the camera, controllable in Linux as GPIO0 and GPIO1. There are two more GPIO connectors on the CSI connector controllable as GPIO5 and GPIO21. By carefully slicing and soldering wires to a flat cable, these GPIO lines can be broken out onto a breadboard.

There’s a video below demonstrating these GPIO lines being used to control a few LEDs. Of course, anything that is possible with a normal Raspi GPIO is possible with the CSI connector GPIO lines.

[Read more...]

Input And Output On A Single Pin

IO

[Emilio] has a Raspberry Pi with a few sensors running totally headless. It’s a great way to gather data and post it on the Internet, but for the rare occasions when the Pi needs to be turned off for maintenance, [Emilio] needs to connect a monitor, a keyboard, and a mouse. Not a perfect solution when a simple pushbutton and indicator LED would suffice. There’s one problem with adding a simple button and LED combo: there’s only one GPIO pin available in the setup. That’s nothing a few resistors won’t fix.

After wiring up a very simple circuit on a piece of perfboard, [Emilio] met his design goal of being able to tell if the Pi was running and giving it a software reset button using only a single GPIO pin. The circuit requires only two resistors, and the software to make everything run – a simple Python script – toggles the pin between input and output, checking if the button is held down for five seconds. If it is, the Raspi powers off for [Emilio]‘s routine maintenance.

phatIO uses file system to control external hardware

[Andrew Smallbone] wrote in with a link to his latest open source project. This is phatIO, a USB I/O device that uses a mass storage file system for control. The idea is that any operating system can manipulate files on a USB storage device. This enumerates as mass storage, and any alterations you make to its file system will result in pin manipulation on the I/O header.

We’ve long been Linux advocates and enjoy the fact that everything on a *nix system is a file. This simply extends the idea across multiple platforms. [Andrew's] guide for the hardware gives an overview of how the system is structured. The top ‘io’ directory contains sub-directories called mode, pins, status, and a few others. Inside the directories are files for each pin. Writing to these files has much the same effect as writing to a data direction register, port register, or reading a pin register on a microcontroller.

The board is not yet in production and the github link to his hardware files gives us a 404 error. But there is code available for several software demos. After the break we’ve included video of the phatIO driving a Larson scanner.

[Read more...]

A Simple Method for Expanding Arduino IO Capacity

Although there are other ways to do this, [Rod] has decided to write up his method of using two Arduinos and the I2C protocol to expand an Arduino’s IO capacity. As seen in the picture above, you’ll sacrifice 2 analog pins, but if you happen to need IO and have an extra Arduino lying around, this could really help. [Rod] also notes that this method could be used with many Arduino’s in parallel if the situation called for it. The code for this simple hack is included as well, so be sure to check out his site if you want to try this idea.

Some other solutions for extra IO would be to buy an Arduino Mega with 54 digital IO pins or the Muxshield which gives you 48 IO (and is stackable for other shields). An advantage of using the two Arduinos, is that if they are needed to be split in the future for different projects, this could be done. It’s good to have options for your IO needs as every hack is different.

Check out the video after the break to see everything being hooked up.

[Read more...]

Arduino I/O Speed Breakdown

[Jee Labs] has worked out how long it takes for an Arduino to perform various I/O operations. Predictably, analogRead() takes the longest, followed by analogWrite(). Arduino really falls behind when it comes to digital pin I/O: digitalWrite() takes a whopping fifty times longer than a direct bit write to a port register!  This is something to take into consideration when you are looking to do some beefy I/O with an Arduino. Perhaps this I/O performance will be addressed in the future with Arduino 1.0.

Follow

Get every new post delivered to your Inbox.

Join 96,467 other followers