GPIO for any PC or Laptop: Adafruit FT232H

GPIO for any PC or Laptop: Adafruit FT232H

????

Add GPIO to any PC or laptop running Windows, Linux or macOS using an Adafruit FT232H USB breakout board. Here we set things up, control some LEDs using Python code, and then communicate over I2C with a BME280 temperature, pressure and humidity sensor. The Bmax B1 Plus video I refer to is here: https://www.youtube.com/watch?v=UGcWLgAk5kA The Adafruit FT232H GPIO breakout is available from many retailers including: Amazon.com: https://amzn.to/3kJ19zi Amazon.co.uk: https://amzn.to/3kHBabC Adafruit (US): https://www.adafruit.com/product/2264 Pimoroni (UK): https://shop.pimoroni.com/products/adafruit-ft232h-breakout-general-purpose-usb-to-gpio-spi-i2c Note that the above Amazon URLs are affiliate links from which I earn a commission. Adafruit's excellent setup instructions for their FT232H breakout are here: https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h/setup You can download my LED test code here: https://www.explainingcomputers.com/sample_code/LED_Test.py And my final BME280 code that writes data to a spreadsheet is here: https://www.explainingcomputers.com/sample_code/Sensor_Spreadsheet.py Note that the above BME280 code expects to find a spreadsheet called Weather.xlsx in the folder Python_Code -- you will need to edit the code to point it to whatever location you put this file in. A blank Weather.xls spreadsheet can be found at: https://www.explainingcomputers.com/sample_code/weather.xlsx More information on using openpyxl to store sensor readings (or any other data) in a spreadsheet using Python is contain in my Raspberry Pi Weather Station video: https://www.youtube.com/watch?v=ChQpD2gsC20 The exact BME280 sensor used in the video is available from Pimoroni here: https://shop.pimoroni.com/products/bme280-breakout Note that, as mentioned in the video, to use the above Pimoroni sensor with the Adafruit CircuitPython library, you will need to edit the file called basic.py found in the adafruit_bme280 folder to change the I2C address from 0x77 to 0x76 (or you could cut the connection on the top of the BME280 module to change its address to 0x77). If you use an Adafruit BME280 module, then this change is not needed. :) For additional ExplainingComputers videos and other content, you can become a channel member here: https://www.youtube.com/channel/UCbiGcwDWZjz05njNPrJU7jA/join More videos on computing and related topics can be found at: http://www.youtube.com/@explainingcomputers You may also like my ExplainingTheFuture channel at: http://www.youtube.com/@explainingthefuture Chapters: 00:00 Introduction 01:05 GPIO Options 05:29 Setup 22:33 LEDs Test 14:22 Sensor Readings (BME280) 18:27 Wrap #GPIO #FH232H #Adafruit #explainingcomputers

Advertisement

LEAVE YOUR COMMENT

LATEST COMMENTS

@philluvschips3787 Says:
at the pip3 install pyftdi - I start getting the error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. messages, I'm not experienced enough to deal with this :(
@adamwalter2573 Says:
Two years have passed, what's the currently proposed solution for GPIO ? I'm slightly tired on RPI and other clones, probably will go for x86 but with a GOOD usb dongle (i2c,spi,gpio,pwm)
@jeremycole3008 Says:
I was getting excited until this guy started the: "Python this, and Python that" If wanted python , or C++ up my rear end, i wouldnt have given my raspberry pi 3 to my son just to get rid of it. Im Old School. On the Commodore 64, you'd send a 0 to 255 number to the data direction register in the CIA chip to tell it which was an input, or an output. Second, next address, Poke the address, with the number you wanted. No BS coding involved. Which brings me to ask a question. If you treat the audio output jack AS your OWN serial output, could a person simply use Quick Basic 64, send out a sound on your audio cord, attach a simple A/D chip to the end, sample the signal, and recover as many GPIO lines as your chip is designed for? And as for input, its already setup as a microphone input, to do it, using maybe a couple of audio transformers for electrical isolation. Anyone tried this yet? I have no clue what so ever how to send data over a USB line, but Im sure I can send audio out to an external A/D converter chip. using a diode and cap to convert the A/C signal to positive D/C
@007ify11 Says:
Can we do the same thing with an ESP32?
@wizzardrincewind9458 Says:
👍🖖
@MarkusBurrer Says:
The need to change something in a library is the reason I don't like things like the Adafruit library
@Hamburgerhackr Says:
"inappropriate libraries" sounds great 15:01
@practicalthinker5545 Says:
I appreciate that you're one of the few creators who approach tinkering with an open mind, exploring all available options rather than being fixated solely on Raspberry Pi like many other YouTubers.
@Bravo_Ventures_LLC Says:
Beautiful information. Thank you. Coputer genius coupled with narrating wit
@Bravo_Ventures_LLC Says:
0:53 Are you saying "x86" ? Can't make it out
@chaoticsystem2211 Says:
pi pico can do the same...
@markarthur1083 Says:
USB LATENCY
@sithummarasighe5465 Says:
Can we develop a robot using a PC hardware please tell me that I really love to know. I hope you reply me my question 😊
@shar0v0 Says:
Well done, nice video! It's inspired me, I'm coder and learning control LED with python script by RPI. Why not make my old laptop become controller if I just want to control a breadboard with some LED? My old laptop has bigger screen, storage, so many ports, comfortable keyboard with touchpad and BATTERIES!  I could take my laptop anywhere, if some parts broken, fans, ram and hdd, just replace it. Even mainboard broken I could buy another junk laptop under $100.
@WJCTechyman Says:
This is an interesting video, I knew some were saying that Mini PCs were the way to go as a Pi alternative, but never understood how you could use it like a Pi until this video. I still would like to get a Pi and play around with it as I am surrounded by PCs. I wouldn't be playing around with it in the development sense at the start, just playing around with it like any other PC to see what it's like and doing PC style things with it.
@1o1team62 Says:
Hi Is it any Cpp library for this module? I need to use gpio in linux but my code is cpp and all source are python!
@panduliv Says:
can u give a video for the same in c++
@pandunm Says:
Hi. How do I implement the same in C++
@pmbguy2212 Says:
It took about 3.2 seconds to subscribe, thank you
@FrancisJudith-d1k Says:
Johnnie Camp
@x_CrossHair_x Says:
I wish stuff like this existed 30 years ago.. The first Computer I used to control external devices was a Commodore 64 (Expansion Port) to control an Amateur Radio Repeater on the Two Meter Band... Using opto-isolators to provide the isolation between 5 and 12 volt Supplies.. It was fun, and very rewarding to make it work.. (Especially) incorporating a phone patch (all before) Cellular Phones.
@perditaolio4163 Says:
I don't understand. What's the difference in this case (led's switching on and off), between a Pico and this FT232H. What is the biggest benefit in use?
@itzmetanjim Says:
headphone jack + python to play custom WAV files: *am i a joke to you* you can get 2 high qualidy DAC analog output + 1 hi quality ADC analog input + 1 ground pin
@9bitjim Says:
I tapped the SMbus to use i2c devices. You just have to find access to the signals somewhere. Cool vid!
@montecorbit8280 Says:
At 5:19 Samantha the soldering iron.... I do not remember seeing Samantha before! Nice to meet you!!
@PsiQ Says:
I would suggest using a usb isolator.. i dont fear so much for the usb ports, more for the hardware outside with crappy switching psu and ESD, maybe grounding loop dangers or badly protected ic pins.
@dung18j Says:
Instead of FT232, I would use CP2112 for both i2c and gpio, plug and play just like Raspberry Pi without any configuration
@nickraphael5382 Says:
Thanks!
@roselugo0112 Says:
Thanks, it was an awesome experience. I learned so much. Much success to you. 😊😊
@dialup6466 Says:
Thanks a lot!
@Reza1984_ Says:
How to bundle this in one application without needing to install all of this? I'm thinking of a shell script but is there an alternative?
@brianhambleton9309 Says:
Very cool! Thanks Chris!
@ALO00.Z Says:
Great tutorial!!
@wildfox1994 Says:
You can add "import os os.environ["BLINKA_FT232H"] = "1" import board import digitalio" at the beggining of your python script so you don't have to set environment every time
@sinchrotron Says:
Everyone advicing to add env var to .bashrc are giving the wrong and destructive advice. One should not install project specific libraries into a system python. Use venv instead, this is a correct way One should not use global env vars but set project specifc vars from inside of the script using os.environ or .evn file which is even better. These vars will persist only while script is running. One should not edit library files :) it makes no sense as on a next deployment your changes will be lost. Use settings instead Peace, guys :) This comment is not for a author because he obviously does not care but for newbies lurking around :)
@billychampy316 Says:
Awesome video!!
@indrayuddroychowdhury6016 Says:
Are there any breakout boards which can do both i2c and spi simultaneously?
@matthewjones517 Says:
Thanks for posting this! With Raspberry Pi's being so difficult to find this looks to be an excellent alternative!
@Igneale Says:
I want to body slam this presenter and congratulate him at the same time. He's at once a terrible personality and good information. It's sad really.
@crystalsheep1434 Says:
Cool
@IraQNid Says:
8:55 you have an evil node of "0666"?
@amyslivets Says:
Hi. Is it possible to do the same with a wemos d1 mini?
@batica81 Says:
Amazing explanation! I managed to make it work under Windows using PyCharm with no issues at all! (It is important to change driver to libusb-win with zadig)
@Sk-Jarir Says:
I was searching for an usb c to gpio converter for mobile i found this video so please try to answer, Can I connect this converter with type c to c cable or OTG with mobile?
@johnkneemtb Says:
Just bought one. Thanks to EC for demoing it. One thing though my OCD is going crazy at exit () rather than exit()
@richardlyd7450 Says:
Another great video!.. cheers Chris!
@raisagorbachov Says:
I must be missing something. It seems to me to be a lot easier just to use a Pi Pico and Thonny than to do all the setup for that.
@curtwuollet2912 Says:
Are the adafruit libs, etc. GPL?
@allistergilbert4564 Says:
Hi, many thanks again. Is it possible to protect the computer usb port from shorts etc coming from the breakout board. Cheers Allister
@terryhayward7905 Says:
Or you could just use an Arduino Uno for about the same price and a lot more I/Os.

More Programing Videos