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:
• Testing a $100 Mini PC...
The Adafruit FT232H GPIO breakout is available from many retailers including:
Amazon.com: amzn.to/3kJ19zi
Amazon.co.uk: amzn.to/3kHBabC
Adafruit (US): www.adafruit.com/product/2264
Pimoroni (UK): shop.pimoroni.com/products/ad...
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: learn.adafruit.com/circuitpyt...
You can download my LED test code here:
www.explainingcomputers.com/s...
And my final BME280 code that writes data to a spreadsheet is here:
www.explainingcomputers.com/s...
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: www.explainingcomputers.com/s...
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:
• Raspberry Pi Weather S...
The exact BME280 sensor used in the video is available from Pimoroni here: shop.pimoroni.com/products/bm...
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:
/ @explainingcomputers
More videos on computing and related topics can be found at:
/ @explainingcomputers
You may also like my ExplainingTheFuture channel at: / @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
Пікірлер: 658
Back in the day, standard serial and printer ports could be used as GPIO. That was the first time I was controlling electrical devices using a computer.
@ahmad-murery
Жыл бұрын
Exactly what I was thinking of, anyway, I think using parallel port was easier to start with since it doesn't require any coding/decoding circuit
@hilldweller2
Жыл бұрын
@@ahmad-murery Those were the days my friend, we thought they'd never end. But they did. Personally I think a picoW or ESP32 has so much more to offer, so why did they bother with this ?
@ahmad-murery
Жыл бұрын
@@hilldweller2 So true my friend👍, anyway, I think having a direct access to GPIO will open the doors again for some applications (windows apps for example) to easily read/control external machines at a low cost.
@briankleinschmidt3664
Жыл бұрын
Oh yes. The banded wires. Radio Shak to the rescue.
@zetaconvex1987
Жыл бұрын
Actually, you could probably do something almost identical today. You can set up serial connections to MCUs, although they will admittedly actually be routed via USB. Send bits over the computer's pseudo serial port to indicate whether pins should be high or low.
I worked for an industrial controls company back in the early to mid-1990s. All that equipment used to cost tens of thousands of dollars. Now you're showing us the current state of the art. My 1990s self is marveling at what has become of that industry.
GPIO is such a nice thing to have. I always enjoyed having GPIO available on my Commodore 64 for projects. When everything went to "standard PC" I had to do go through all sorts of nonsense hacking the parallel port into a GPIO-like interface. Now we finally have good options again.
@gordonlawrence1448
Жыл бұрын
There used to be ISA bus and that was easy to turn into GPIO. Unfortunately that went 20 years ago.
@adilsongoliveira
Жыл бұрын
I did a lot of this using 8255s, 4066s, optoisolators and such.
@davestorm6718
Жыл бұрын
@@adilsongoliveira I was going to write an integrator program for windows for a RF spectrometer and this is exactly what I was looking for ( both reading and turning on/off small valves), though, I'm going to attempt this in C++ instead of python.
@rustykoenig3566
Жыл бұрын
LOAD"*",8,1 !!! lol
We need more people like you in the world, Chris. Thank you for doing what you do.
I appreciate you continuing to show off different aspects of computer I don't tend to think about, or am otherwise unaware of. Thank you.
Absolutely fantastic content ... as Brian said (paraphrase here) you make it look easy! In reality it is, but it seems easier when I watch you do it. Thanks for sharing and the work you do making anything seem possible.
@dh2032
Жыл бұрын
editing the video helps too. 🙂
Good topic indeed, but even more: your way of presenting contents (here and other videos) is pleasurable and enlightening. Thank you for all that!
Fantastic! A product review with a 'road test' and a run through the Owner's Guide. Thank you, Professor...🇺🇸 😎👍☕
Thanks for all your videos, Chris. This video (GPIO for any PC or Laptop: Adafruit FT232H) is something I never knew was possible with MacOS. Too cool!
I am very grateful to you for the new video! Now there is a chance to expand the functionality of a retro laptop, before that I theoretically represented communication via LPT and a CNC machine 🎉
Finally! After a 40 year wait there is now an affordable way to give a PC as much functionality as the BBC Micro's user port. Another great video, the code is a bit more complex than poking to the User 6522.
@wayland7150
Жыл бұрын
Yeah but would you really want to bit bang a BME280 over the BBC user port? It's nice to have a library to do that for you.
Another great video, Chris - hadn't realised these breakout boards for adding GPIO to a PC existed, could be very handy!
Wonderful!!!!! I have a bmax B2-S arriving today (caught a great sale/discount, $104 versus usual $130-$160). Needed it since I threw away several old very slow laptops.. I've been looking for details on how to handle sensors, I2C and DIO natively using python from a "PC" and it sure looks like this is the definitive guide. Like others I had missed several steps when looking on my own. I have a ton of ESP32s that work great but I also wanted to be able to log, graph and view the data easily under linux or Windows without needing a separate device to handle the data acquisition.. this seems to fit the bill. I've always loved this channel!! Been working professionally with electronics and computers since 1973
Now this is a product that is seriously needed! Thanks for reporting on it! I tend to be slow to catch the newest trends these days.
What fun! You turned the mini PC into a PC Pi. Looking forward to your next video!
At 5:19 Samantha the soldering iron.... I do not remember seeing Samantha before! Nice to meet you!!
Another good day's work, Chris. I always saw the Raspberry Pi's main use not being for teaching juniors coding but in the lab recording data reliably. Your video has me thinking of using it with a breakout board for ventilation control system in a busy bar/restaurant. Cheers.
I've never seen this channel before but as a 45 year old I have to commend the style of video and how reminiscent it is of quality BBC science programmes from the 80s!
@ExplainingComputers
Жыл бұрын
Thanks, and thanks for watching. :)
I feel inordinately pleased to have reproduced your flashing LEDs using the MCP2221A breakout board. Thanks for this video - it opens a world of possibilities!
@ExplainingComputers
Жыл бұрын
Fantastic. This sounds like a great result. As you say, with things setup and working, there are so many possibilities . . .
I can't get excited about the board, but, oh boy, have you produced the definitive video on Superb Soldering. That was awesome.
Great for testing code & stuff before you connect things to your precious Pi. Thanks for that video!
Nice to see Adafruit get a plug. Nice demo/tutorial, too!
A fantastic utility, GPIO. A little tricky to setup but I'm sure with your video things are going to be very easy. Great video!
Have a good rest of your weekend Christopher. As Always, Be Smart and Stay Safe.
As I always say, every Sunday morning is Christmas morning when you listen to Christopher!
I'm sorry, but it's just NOT a proper Sunday without a very informative & delightful visit with our true gentleman of a friend Christopher & Explaining Computers! 😇
Lovely graphics with nice typefont on over-labels. Great video.
Thank you very much for this material! Brilliant as always. I can't wait for the next episode.
This is a really important video, as this is the sort of thing that could be used for school science. Get a cheap old PC, get one of these boards, and start to create your own monitoring system built. Lots of potential with it, thanks for making this video.
@ExplainingComputers
Жыл бұрын
I like your thinking here. :)
@parshvapatel8484
Жыл бұрын
@ExplainingComputers Is it possible to do same with old smartphone an it would give it a new life?? If yes then I have a request to make a detailed video on setting this up on some good python ide on smartphone. Thank you❤ and I like your explanation old school and easy to understand.
Awesome stuff. such a wide range of qwicc and other boards waiting to talk to a general purpose PC, the possibilities are endless. Thanks for the introduction to electronics for PCs.
Excellent demonstration of democratization to access the world of GPIO. Great job! Respectful greetings to Samantha for her high precision work!
This is very exciting ,and opens up many more possibilities for test and measurement systems.
Sorry for being tardy, I’m training for a long distance running event in April. Excellent lesson today, thanks.
Thanks for posting this! With Raspberry Pi's being so difficult to find this looks to be an excellent alternative!
Adafruit has got some really great stuff - I would love to see more of it (:
Over my head Mr. Barnatt. You are such an intelligent fellow!
Thanks Chris, I'll keep that in mind. It's definitely an eye-opening idea with great potential for good things. Checked price - in my regular shop it's 20 GBP.
My first job out of high school was working at a radio shop where I learned to tune radios (before PLL frequency synthesis), install and service "car phones" and most interestingly build police squad cars by installing radios and light bars. I have several colorful stories from those days, like the time I repeatedly pressed a "man down" button on a portable police radio before I knew what it was, or the one where I did a "test drive" of a newly built squad car like the Dukes of Hazard. But this story comes to mind because of something in this video. One aspect of the construction of a squad car was to add circuitry for something called "wig-wag" lights. That is the connection of relays to flash the headlights alternately left and right about once per second. The LED's in this video are alternating at about that rate and reminded me of this time I left work exactly on time, and I was in a hurry to get home. I was speeding like usual and behind me I saw the dreadful wig-wags and really thought me house was cooked. I dug out my license, registration and proof of insurance. Well, I was surprised when the officer didn't ask for them but addressed me by name. It was Sargeant Deeghan who came to visit me at work but I wasn't there. So he chased me down on the highway! He wanted to ask about the function of one of the radios and didn't want to wait until tomorrow, ha ha. Well I laughed all the way home after he also gave me a verbal warning about my speed. That day was a good day to have the police Sargeant as my friend. 13:15 So then, I hope you will remember that an alternating pair of lights is called "wig-wag" lights. 😀
Fascinating tool. It'll likely to provide respite to people suffering RPi shortage. Interesting tutorial like always.
This is one of my favorite channels. I learned a lot from them.
Just bought one. Thanks to EC for demoing it. One thing though my OCD is going crazy at exit () rather than exit()
Thanks, Chris. It’s always good to know the options we have nowadays to do whatever our (engineering) hearts desire.
I'll have some projects for this one, but I've gotta walk before I can run. Thanks for another great video.
@ExplainingComputers
Жыл бұрын
Greetings Steve.
This is excellent and very timely! I have just ordered some sensors and knew I would have to get down to using Micropython, GPIO etc. This video has given some ideas about helping my daughter to use sensors on a PC, despite having no Raspberry experience. I find you have already issued videos which will be really useful such as your RPi Weather Station. Thanks!
@ExplainingComputers
Жыл бұрын
Good luck -- and you are right, there are several of my previous videos that may be of assistance -- including the one where I built an anemometer. :)
@williamstevenson2649
Жыл бұрын
@@ExplainingComputers AND the RPi Plant Watering and Time Lapse Photography videos! I've only been thinking recently that I ought to get down to time lapse with a Camera Module 3. Thanks again
This is so very exciting. Chris you just made my day. I have a couple old low power Thin Clients that I installed Linux Mint on that only draw about 6 watts when running. So with the Adafruit interface It could easily be used for temperature and presents detection as well as the most important "Flashing LEDs" Yes!!. Haven't really played with Python much, so this is great motivation to do so. Thank you again Chris for an excellent tutorial. 👍😎
First time I "talked" to anything through an UART-like connect was to clear SMART registers on a bricked Seagate drive (the ones that once in a few hundred cycles froze on start-up). Felt so haxxory!
This is a very powerful and useful tutorial for not only GPIO, but also for Python... Thatnk you..
I love you, Samantha the soldering iron!!! Anyway, another great video! Another example of how anything is possible with computing. :)
@ExplainingComputers
Жыл бұрын
Thanks for your support. :)
@Praxibetel-Ix
Жыл бұрын
@@ExplainingComputers Aw, you're welcome, my friend! I hope that you're doing okay today. :D
Great tutorial! I like how these breakout boards are dirt cheap and you can just use a computer you already have. Unlike the RBP, cheap x86 computers to run linux and python are everywhere.
perfect timing, i was looking at those since yesterday and considered buying one
I always wondered why I never see these things being advertised everywhere. This is really handy for makers.
This is fantastic! I’m just getting started with electronics and the Pi’s GPIO, and just assumed I’d have to dive into the SBC ecosystem. It’s just awesome I can use my x86 and x64 relics to explore GPIO, although with a little research I guess I could have accomplished this w the Pico and sub variants. Thanks!
@wayland7150
Жыл бұрын
I'd say that the way Chris has shown it here on the PC is no different to using an SBC, it's the same compiler and IDE! What would make this more PC compatible would be some API calls you can make from say Visual Basic or MS Excel or even batch files or scripts.
Its a wonderful module that gives computer direct access to gpio's Thanks Chris !!
Great tutorial. Just another example of your wonderful lessons. Thanks.
That is a great way to get GPIO on a PC without much muss or fuss. Also, it was nice to meet Stephanie - I never knew that was her name :)
Sunday greetings all! Hope everyone is doing well.
You packed a lot in this one. It's like you've done it before. I'm not sure if I could do all that in a week. I usually have several missed steps and mistakes. I screw up so much, that I account for it when I plan any project.
@Reziac
Жыл бұрын
Chris cheats. He has two Sundays in every week. ;)
Direct and indirect IO is a matter of interpretation. Fundamentally both the FTDI and Pico approaches use USB to communicate IO reads and writes. It is 100% possible to load a Pico with firmware such that it emulates exactly the FTDI part.
Well done! I am looking forward to making use of some older hardware that is just waiting to be up-cycled into something useful like a weather station or home automation item.
Your videos never fail to impress. Thank you.
Very interesting as ever I appreciate how Much you explains things in your videos
Excellent video. I’m just about ready to try my first project utilizing GPIO. It’ll be a garage door opener running on a Raspberry Pi.
I thought about doing some logging, but rather than connecting sensors to a PC USB port I'd use an esp32 or pico w, setup a simple web page and retrieve the values using a cron job (wget) and storing in a csv. I could do logging this way on many sensors in different locations with less software libraries. Also an esp32 is cheaper than a ft232h.
@Henry-sv3wv
Жыл бұрын
that and there is firmata or Python picod module
Very nice way to use the pc and IO thanks for the instructions I have just moved to Linux Mint Deb so will have a go as soon as I purchase the FT232H board.
@ExplainingComputers
Жыл бұрын
Good luck!
Great video I actually wondered if this existed after I started playing with the GPIO on Raspberry pi.
Great video. If you have a BME280 with a different address, like in this case, you can simply specify it when you initialize the library instead of editing the value in the library. This also makes installing updates much easier.
@ExplainingComputers
Жыл бұрын
Good to know, thanks. :)
Thanks Chris, just the ticket. Adafruit have also provided a port for the Pico as the bridge which I intend to try as well.
Greetings. :) Another great watch. Looking forward to working with this piece of hardware.
Another great video and a new toy, er tool. Thank you for these videos.
always such interesting videos with my muffin and hot tea. 🥳 Back in the DOS-PC days people came up with clever printer port projects. Now with these sweet little add-on boards the creative ideas are fantastic even 16 bit+ ADC/DAC channels. 😎 Thanks a lot.
@timnixon2889
Жыл бұрын
We had a "type and talk" device.. connect to the printer port and whatever you sent would be spoken aloud.. circa 1984
@qzorn4440
Жыл бұрын
@@timnixon2889 very interesting. Thanks.
@stefanl5183
Жыл бұрын
@@timnixon2889 There was a board that B G micro used to sell way back then that had a Couple of TI speech synth chips on it. You could connect it to a serial port them just send text to it.
@stefanl5183
Жыл бұрын
" Back in the DOS-PC days" Dos was the key! Because Dos ran in real mode you could do anything. You could read and write directly to any IO port or memory address. Obviously modern operating systems don't allow that. With modern operating systems applications run at PL3 and the kernel and maybe some low level device drivers run at PL0. That means that normal software cannot access IO ports directly. That means to do this under modern operating systems you must write a device driver and create somekind of API that will be used by your applications to make calls to that driver. That complicates things quite a bit. Also some modern operating systems, like the newer versions of windows even require drivers to be approved and signed by microsoft. That usually puts it out of reach by the average hobbyist. Interestingly enough, one exception to this is RS-232 com ports. These can still work because there are drivers and API calls already built into windows that allow you to open, close, read, and write to those ports. Thanks to backward compatibility with old school terminal applications this still exists. Unfortunately RS-232 ports are getting harder and harder to find on modern PCs.
BTW, your Bmax mini PC presentation was so compelling that I ordered a Bmax from China. They were fresh out of stock locally which was probably your fault. :)
On python you can press control r and then type, to look for commands in the buffer (history) You can do that on bash too, and on most programs that use the "readline" library Great video
The PCB close up shots are getting even more amazing!
@ExplainingComputers
Жыл бұрын
:)
There are many ways to give a PC gpio capability. As noted in other comments, a PI or Arduino can be used by running a protocol over the serial link. The protocol used by the FT232H could be supported on other platforms. In the past I have used Web Midi in chrome browser to do gpio over a Midi interface to an Arduino. ( Optical isolation both ways with 5 pin Din Midi ) depending on latency etc, you may want to run some parts on the PI/Arduino and others on the PC.
Thank you very much for your wonderful videos! They are very informative and well presented! Keep up the good work!
Thanks, it was an awesome experience. I learned so much. Much success to you. 😊😊
Thank you for the fun video. A great birthday gift for me. Best wishes.
@ExplainingComputers
Жыл бұрын
Happy birthday!
Samantha the soldering Iron 😂
Great show Chris. I had given up on getting io on pcs. Now I have some ideas 💡 thanks
Aren't you just perfect... Thank you sir! Keep up the good work :)
Love it! So coherent and nicely presented ♥
While a green led when plugging something in is very exciting indeed, it's even more exciting to see a 'breadcrumb' on a breadboard (at 12:29 near the ft232ic). 😆 I guess next would be a Blender video about creating and then printing a new case for the B-Max B1 Plus with integrated, easily accessible FT232H pin header. Thanks for a very nice video and Happy Easter! 🐇🐰🥚
@ExplainingComputers
Жыл бұрын
I only noticed the crumb in editing. No idea how it got there! Thanks for watching. :)
To avoid having to reenter the environment variable each time you startup Linux you can add export BLINKA_FT232H=1 to, for example, your .bashrc file
@ExplainingComputers
Жыл бұрын
Good tip, thanks for sharing.
@wildfox1994
5 ай бұрын
or you can add "import os os.environ["BLINKA_FT232H"] = "1" import board import digitalio" at the beggining of your python script
An appreciated video. Great news from Adafruit as well.
Project videos are the best! Thanks!
What an interesting video I never cease to be amazed by Chris's content. I didn't know about Samantha, she does make very neat soldered connections!! It's got me thinking of other applications it could be applied to, like a model railway (railroad) layout, signalling, block control & setting points etc, the code would be quite interesting to write but what an experience :)
@GizmoFromPizmo
Жыл бұрын
Excellent application idea!
@alanthornton3530
Жыл бұрын
@@GizmoFromPizmo It just makes me wonder how long it'd take to do the coding?
For the much lesser cost you can actually use ESP32 boards directly and get more pins and other options. And also control from the USB port.
@petermuller608
Жыл бұрын
Different target market
As always, a very well done Video. Thank you very much.
Amazing, I was just looking for this!
Waited since forever for something like this, though there are probably dozens of ways to do it. +10 years ago Arduino, etc came at the right time for stand alone projects. It got in the way of development for direct USB GPIO to/from the computer.
Another great video!.. cheers Chris!
Great video as always Thanks for sharing your experiences with all of us 🙂
Watched for years you are brilliant
@ExplainingComputers
Жыл бұрын
Many thanks. :)
Back in the Borland Delphi days I used to use a Delcom IC it used USB and you could control about 10 leds it was great.
Thanks Prof! Enjoyable concept and presentation...
Excellent tutorial! Small correction, at 11:40 video shows two 47 Ohm resistors(yellow,purple,black), referred as "470 Ohm current limiting resistors". Keep up the good work!
@ExplainingComputers
Жыл бұрын
Thanks for this. Whilst the resistors are there to drop the voltage, this in turn drops current, and resisitors so positioned in series with an LED are always referred to as "current limiting resistors". See, eg (and lots of places!): www.mouser.com/blog/dont-burn-out-calculating-led-current-limiting-resistor
I've wondered for a very long time why this kind of thing isn't more common.
Ah, I love these Sunday morning hacking sessions with Chris.
When I saw this I thought it was a rerun of a 1970's Open University TV course with the haircut and presentation style, 'so' of the era. But it wasn't. Interesting video none the less.
Greattttttt Video !!! I was waitign for !!!!! when examples with potentiometers and buttons... ?