/ hacking

FT232H GPIO Breakout board

Recently I've received many different micro controller boards but one that has rally caught my eye is the Adafruit FT232H.

alt

But why? Well it enables any computer to have GPIO pins that can be controlled using Python similar to the Raspberry Pi.

The board comes as a kit, which requires a series of header pins to be soldered to the board. Not too difficult and a great excuse to break out my Antex XS25 soldering iron for a tinkering sessions.

The FT232H comes with a number of GPIO pins, some are standard digital pins (on / off) but others are SPI, I2C, UART and JTAG. So you get plenty of connectivity for the $14.95 price tag. I'm all for a bargain and this is a great piece of kit for the money.

I followed the guidance provided by Adafruit and I had the board working within 30 minutes.

At the time of writing the FT232H library uses Python 2.7 only, but I really hope to see a Python 3 library one day, but hey for hackers Python 2.7 is all good!

Testing...testing

alt

So what do I do to test my board...I blink an LED...Well I blinked three of them!

import Adafruit_GPIO.FT232H as FT232H

# Temporarily disable the built-in FTDI serial driver on Mac & Linux platforms.
FT232H.use_FT232H()

# Create an FT232H object that grabs the first available FT232H device found.
ft232h = FT232H.FT232H()

red = 5
green = 6
blue = 7

ft232h.setup(red, GPIO.OUT)  # Make pin C0 a digital output.
ft232h.setup(green, GPIO.OUT)  # Make pin C0 a digital output.
ft232h.setup(blue, GPIO.OUT)  # Make pin C0 a digital output.


# Loop turning the LED on and off and reading the input state.
print 'Press Ctrl-C to quit.'
colour = (5,6,7)
while True:
        for i in colour:
                ft232h.output(i, GPIO.HIGH)
                sleep(0.5)
                ft232h.output(i, GPIO.LOW)
                sleep(0.5)

The keen eyed amongst you will notice that the ft232h library is very similar in structure to the RPi.GPIO on the Raspberry Pi...BONUS!

So an extension activity was needed. I never got the chance to finish it but I got one of the three buttons I wanted to work. The goal of the code was to create three push buttons on a breadboard, when pressed a sound is played using the Pygame library. In the short time that I had I managed to create a red alert button...just need a few LED and a starship now.

# Import standard Python time library.
from time import sleep

# Import GPIO and FT232H modules.
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.FT232H as FT232H
import os,sys
import pygame

# Temporarily disable the built-in FTDI serial driver on Mac & Linux platforms.
FT232H.use_FT232H()

# Create an FT232H object that grabs the first available FT232H device found.
ft232h = FT232H.FT232H()

red = 5
amber = 6
green = 7

ft232h.setup(red, GPIO.OUT)  # Make pin C0 a digital output.
ft232h.setup(amber, GPIO.OUT)  # Make pin C0 a digital output.
ft232h.setup(green, GPIO.OUT)  # Make pin C0 a digital output.
ft232h.setup(3, GPIO.IN)
ft232h.set_high(3)
ft232h.setup(4, GPIO.IN)
ft232h.set_high(4)
ft232h.setup(3, GPIO.IN)
ft232h.set_high(3)

def player(vid):
        os.system('totem'+(vid))

def audio(audio):
        pygame.init()
        pygame.mixer.init()
        pygame.mixer.music.load(audio)
        pygame.mixer.music.play(1)
        sleep(1)
        pygame.mixer.music.stop()



# Loop turning the LED on and off and reading the input state.
print 'Press Ctrl-C to quit.'

try:
        while True:
                if ft232h.input(3) == False:
                        for i in range(3):
                                audio('/home/les/Desktop/red_alert.mp3')
                        
except KeyboardInterrupt:
        ft232h.set_high

So the FT232H is not a Raspberry Pi but it does give you plenty of GPIO pins for tinkering and hacking from your laptop. If this were a magazine review I'd give it 4/5

You can pick up an FT232H from Adafruit for $14.95 in the US or for UK readers Pimoroni have them for £13.50