Wouldn't it be neat if you could connect a MIDI device to an Arduino or some other microprocessor? Or use a USB keyboard to "talk to" an Arduino?
You can! Not hard. Not expensive. And those aren't the only USB devices the device discussed here can connectto other electronics.
The device is the . It is the Hobbytronics.co.uk USB Host Controller.
For £16.20, plus reasonable p&p, 8/20 you can connect Midi devices, USB keyboards, FTDI serial-from-USB interfaces. You can use a flash memory stick (aka "thumb drive") into you Arduino. (For reading or writing.)
And this isn't just for the hobbyist. People building "plug and play" systems for commercial purposes find the modules save them development headaches. Why reinvent a wheel?
In my view USB in general is the best thing since sliced bread. If you weren't involved with computers before USB came along, be grateful. Very grateful.
But USB is generally used by people on "big", "grown up" computers.
"What's the Hobbytronics gizmo good for??", I hear you wail.
It let's the people who work (or play!) with microprocessors such as the Arduino access the convenience of USB. The Host Controller lets any electronics that can "talk" TTL serial communicate with a wide selection of USB devices.
There's a good summary the different things the board can serve at the main Hobbytronics page for the USB Host Controller... and that page also has links to take you to the individual pages discussing each firmware package's details. Those pages cover technical details- they aren't just sales pitches. Someone spent a lot of time on those pages. Read them, if you are trying to use the controller.
When you order one of these, you specify how you want it configured, i.e. what firmware you want loaded into it before it is sent to you.
And that firmware determines what the board does... but only for as long as you want to use your board that way.
You can (for free) change (yourself) what the board does! By changing the firmware in it, you "turn it into" a "different device".
Change the firmware, and the same bit of hardware does a different job. The whole "menu" of alternate firmware is online. I downloaded all the packages when I ordered my first controller. (Have a look at the list above for the different wants the board can gratify.)
Changing the firmware may be a new skill to master, but there is very good guidance on the Hobbytronics website. No special hardware is needed.
What started life as, say, an interface for a Midi device can "become", say, an interface to a USB keyboard or USB memory sticks.
The board has nine pins. Some of them always have the same purpose. The role of others changes depending on what firmware is loaded.
"0V": the "ground" pin. This must be connected to the "zero volts" side of your source of voltage for the board, and it will be connected to the ground of everything the USB plug is connected to. (Nothing new here. Except in special cases, where you are deliberately seeking isolation (and go to some trouble to achieve it!), you want the grounds of all parts of your project connected. (This is one of those "everyone knows" things that often cause problems for budding electronic engineers.)
"3v3": This pin provides to you a source of 3v3. If you want 3v3 for some of the circuits you are connecting to the board, you can connect them to this pin. Do not connect circuits which would need more than 250 mA. (From what I've just said, I hope it is obvious that this pin does not have to be connected to anything. Many pins need no connection.)
That's all of the pins that always have the same role, regardless of the firmware is in the device. What the other pins do will be discussed shortly, but the excellent documentation at the Hobbytronics pages would actually be a better source for you. There's one for each of the firmware packages.
Apart from the pins for "0v" and "5v", which must always be used as above, you can... and should... just leave other pins connected to nothing, unless you know you need to connect them for some purpose.
In every case, at least one more pin will be in use. But in some cases, only one more pin needs connecting to anything.
"Rx/ Tx": In almost every case, something comes from the attached USB device. Usually, it is passed on as a stream of serial data. That will data leave the Hobbytronics Host Controller via the Controller's "Tx" pin. (Sometimes though, the data is present as the state of pin. (High or low. For example, when the Host Controller has the firmware that makes it an interface for USB keyboards, the "SS" pin will be high when a key is pressed, low when not. (With an Arduino, don't worry about having to "watch" the main input "continuously". Although there is not handshaking, the Arduino has a buffer for incoming serial data. The data is captured and waits in a queue until it is convenient for you to deal with it.)))
The "Rx" pin is for inputs to the board... not always for passing on to the attached USB device. For instance, if you are using the firmware that makes the board a keyboard interface, the microcontroller can tell the board to use a different baud rate. (That is an optional matter... you can just "fall in with" the board's default data rate, unless you want to change the baud rate.)
"SS": This isn't always used. In the cases I've noticed, it is used for signals to the microprocessor. For instance, with the keyboard interface, SS goes high when a key pressed, low when released. Don't assume it will always be an output. Read the excellent documentation at the Hobbytronics pages. (Have I mentioned this?)
"SDA", "SCL", "A": These are used less frequently. When they are, their roles are explained in the Hobbytronics page for the firmware concerned. Don't worry about the fact that they have alternate names ("SDI", "SCK", "SDO").
As I said- there's a good summary the different things the board can be... (Midi interface, Keyboard, Flash drive...) at the main Hobbytronics page for the USB Host Controller... and that page also has links to take you to the individual pages discussing each firmware package's details. Technical details- not just sales pitches!
Ever tried to make a "time of day" clock with an Arduino? WHAT were they thinking (long, LONG before Arduinos were around) when "they" decided a day has 24 hours, an hour 60 minutes? And don't get me started on calendars! (While I'm at it... did you know that "seconds" were once divided into 60 "thirds"? I guess that's where the name "seconds" came from here. But the fact that "a third" was a sixtieth of a second must have been hard on kids just learning about fractions in general.)
How did I get off on this digression? The answer is:
The USB Host Controller has a "bonus" feature: It offers Time of Day Clock and Calendar services.
The host controller... whichever firmware you have loaded... is an RTC. You've heard of RTCs? They are "real time clocks", which often means clock-and-calendar... and it does in this case. The Hobbytronics USB Host Controller gives you easy access to the current time of day, and the date.
Now... don't get too excited... it isn't an all singing, all dancing solution.
You must somehow "re-set" the clock each time the device powers up. (There are various ways to do this... both manual and electronic.) But once initialized, the documentation claims that the RTC should be accurate to within a few seconds per day. Details of using the clock are in the Hobbytronics documentation for the Flash Memory Stick firmware.
Well.. a "non-gotcha", actually.
This board doesn't care if you are working with 3v3 or with 5v. Other than needing 5v supplied to it, for it to do its thing.
The inputs to the host controller will tolerate 5v, but will also see 3v3 levels as "on".
The outputs are capable of driving the inputs of both 5v and 3v3 devices.
Do not assume that all electronics are this forgiving! Mix and match the wrong pair of devices, one 5v, the other 3v3, and you will permanently damage one or both of them. (I suppose this is the place my lawyer would like me to say that while I hope you find what's here useful, I warrantee nothing and accept no responsibility at all anything you do (or don't do) after reading any of my pages.
Forgive me if to you the following is obvious. It isn't obvious to everyone!
This a little "gotcha" that has plagued me for years- specifically in this area, and more generally...
When you are thinking about connecting things, the DIRECTION of data flow is important. Duh. But I get confused. As follows, I think...
Take a keyboard as an example.
When you press a key, the electronics in the keyboard creates what is output from the point of view of the keyboard, but input from the point of view of the thing it is plugged into.
"Flash Memory Stick"? You know these things! Though maybe by a different name? "Thumb Drive"? The "thing" that replaced floppy disks? About the size of your thumb, when they first came out? You plug them in, and then you can read files from them, write files to them. And there are things that work like a memory stick, but you stick an SD card (or similar) into them to provide the "memory". (More properly called "storage" by the way, but whatever, ya' know. Like "you got this, Man" (or WOman), I hope?)
How do you "do storage" across a serial link??
Here's where if you do remember the bad old days before USB you have an advantage.
Even before "before USB", there was "before the Mac and Windows". A GUI-less world. (And it was a nicer place, in some ways.)
If you wanted to save a file, instead of clicking a "Save" button, you typed (gasp) "Save MyFile.txt".
To see what was on a storage device, e.g. a floppy disc, you typed "DIR". And a list of the files appeared on your screen.
To create a folder... they were called directories... you typed "MD HobbytronicsFirmware" for Make Directory.
And so on. And that's exactly how you work with a memory stick, through the Hobbytronics USB Host Controller. It will be a "learning experience" for many, but there's no rocket science or flaky stuff.
I hope that has been helpful? I hope you will give Hobbytronics a try, some $upport. In a world increasingly monopolized by "the big boys"... with the resultant loss of innovation... the "little people" need you more than ever.
The page in front of you is a completely new page, created 8/20 (during the Days of Covid!), from scratch. After I finished it, I discovered I'd written one like it previously. Argh. You can see my December 2014 of an earlier version of this device, if you like! I guess we can have confidence in the device's maturity! Anyway, if you want more or less what is above again, said differently, maybe covering a few bits I missed here, try the old page. Do you, as I do, find that reading something "twice" helps you catch things you didn't actually understand the first time I read them? (Even though you thought you had.)
Speaking of "little people", * I *, your faithful tutorial author, could use some support too! Please mention this page and my other efforts on social media, in forums, etc?
Please get in touch if you discover flaws in this page. Please mention the page's URL. (wywtk.com/ec/iva/iva402UsbHost.htm).
If you found this of interest, please mention in forums, give it a Facebook "like", Google "Plus", or whatever. If you want more of this stuff, help!? There's not much point in me writing these things, if no one feels they are of any use.
Unlike the clever Google search engine, this one merely looks for the words you type, so....
* Spell them properly.
* Don't bother with "How do I get rich?" That will merely return pages with "how", "do", "I"....
Please also note that I have three other sites, and that this search will not include them. They have their own search buttons.
My SheepdogSoftware.co.uk site, where you'll find my main homepage. It has links for other areas, such as education, programming, investing.
My SheepdogGuides.com site.
My site at Arunet.
Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.
....... P a g e . . . E n d s .....