How to connect a USB Keyboard to an Arduino Uno using the USB Host Shield

  Рет қаралды 60,716

John Squires

John Squires

3 жыл бұрын

If you need to use a USB Keyboard on a project running at 5v that uses an Arduino Uno or Mega then this is the exact shield that you need. The USB HostShield is very cheap on eBay and does exactly what you want. You just need a library for it and to do a tiny bit of solder-bridge soldering.

Пікірлер: 71
@excalizan7697
@excalizan7697 3 жыл бұрын
Thanks for the good explenation sir. Subbed. Keep it up!
@Drone256
@Drone256 3 жыл бұрын
Just got mine working by following your video. Piece of cake. Thanks!
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
yay!
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
What project are you working on?
@xav500011
@xav500011 2 жыл бұрын
Thanks for showing a couple of 5V solder bridges need to be connected for a USB device to work.
@frederic4108
@frederic4108 2 ай бұрын
Well, there are 3 of them solder bridges plus a wire, more info @ esp8266-notes.blogspot.com/2017/08/defective-arduino-usb-host-shield-boards.html
@DustinWestaby
@DustinWestaby 2 жыл бұрын
This should be the HID Keyboard example included with the USB Host Shield 2.0 library.
@janikarkkainen3904
@janikarkkainen3904 3 жыл бұрын
USB standard is +5V for power, and +3.3V for data. That's why you can't find 3.3v keyboards, as they don't exist. Also the reason why it's a bit complicated to bitbang USB protocol (well, the first hurdle is the +5V to +3.3V logic, or giving +5V to peripherals and running all logic at +3.3v), but yeah the biggest reason USB protocol is complicated to bitbang is that it's a goshdarn complicated protocol to bitbang. PS/2 keyboard protocol is simple. Some USB keyboards still have the possibility to run PS/2 protocol through USB, so you could always try to initialize the keyboard with the PS/2 protocol start command, but mostly the chips have been phased out as nothing hasn't used PS/2 for years...
@gzitterspiller
@gzitterspiller Жыл бұрын
You can bitbang usb, look for USB-V, it is not easy, it is a very fast protocol and it does not use a clock to sync, it uses specially designed circuits to sync... you would very fast MCUs to emulate the hardware by using interruptions, it is possible but hard and not very effective, it is a goord learning experience, by just reading USB-V you learn a lot. But yeah... as you said "the biggest reason USB protocol is complicated to bitbang is that it's a goshdarn complicated protocol to bitbang" is 100% true, hahaha.
@pancreasdragonheart9765
@pancreasdragonheart9765 3 ай бұрын
I'm a few years late, but! Can I turn this around and code something that output simulated keyboard inputs to my computer? Basically some form of bot or tasker: Press spacebar every 30 seconds and send it to my PC.
@felixt.467
@felixt.467 2 жыл бұрын
Hi, great tutorial. I still have one question. Would it be possible to use a splitter and attach a USB mouse and keyboard at the same time?
@pauljcampbell2997
@pauljcampbell2997 Жыл бұрын
Thanks for the video. Very helpful. I'm having a little trouble with the coding side of things. I'm hoping just to send the keyboard characters to display on the serial monitor. Do you have your sample code available to download anywhere?
@gaabswj294
@gaabswj294 Жыл бұрын
how to use the mouse with usb host shield and arduin?
@albertpauw8234
@albertpauw8234 3 жыл бұрын
Great to see how simple this works. Btw, any news on your Z80 Playground project? Do you have any plans of making the circuitboard and/off EPROM available to buy?
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
I've been a bit busy with my beehives, but will return to the Z80 soon. Not sure about making it available to buy yet, but I'll keep you informed. Thanks for following my channel!
@Mauropaz666
@Mauropaz666 Жыл бұрын
It is posible connect a USB extension to be able use a mouse and a key??
@romulosendoromulo
@romulosendoromulo 5 ай бұрын
Thanks!
@yayangmario8550
@yayangmario8550 2 жыл бұрын
why my usb host not working ?? OSC did not start . what happen sir ?
@rodo19724
@rodo19724 Ай бұрын
I have a board with db9 and manhattan cable but can`t read with the shield, the arduino uno, etc. the board is ok, if I connect the manhattan cable to android phone with putty it does communicaet, but, the usb from the manhattan to the shield nothing happends
@kn0389
@kn0389 11 ай бұрын
I want to control my Usb Webcam using arduino uno. Is that possible? My pc webcam is A4tech
@stargazer7644
@stargazer7644 18 күн бұрын
The examples provided in the host shield library are terrible. Most of them don't even have so much as a comment saying what they're expected to do. Thank goodness for this video or I'd not have gotten anything at all working.
@alessandromocci4933
@alessandromocci4933 Жыл бұрын
it's possible connect 2 USB shield?
@SootGizmo
@SootGizmo Жыл бұрын
I bought a USB host shield and soldered it myself. There was no power at all I tried to charge my phone with it, plug in my mouse, etc. Then I bought a pre-soldered one from ebay and the solder looks good. No power either. Trying this on an Arduino Leonardo
@bhonemyintmyatzaw-riz9535
@bhonemyintmyatzaw-riz9535 7 ай бұрын
Hi man! Great video! I was trying to use my 16x2 LCD screen and it started to display some glitchy characters when I typed on the keyboard. Do you know a way to fix it? Thanks!
@Erebus2075
@Erebus2075 Жыл бұрын
tyvm ^^
@ThebusWay76
@ThebusWay76 3 жыл бұрын
Do you perhaps have a video on making a GIMX adaptor for using a mouse and key or any USB devices on a XBOX one or PS4. Thanks in advance
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
Nope, sorry!
@frankandstuff
@frankandstuff Жыл бұрын
Do you have your code hosted somewhere?
@kb3cxe
@kb3cxe Жыл бұрын
This was a good video. I need to enter numeric input to a CNC morticing jig I developing, and I tried using a 4x4 keypad but it wasn't going so well so I thought I'd give a usb keyboard. Will this work? Thank you,
@CircuitBreaker256
@CircuitBreaker256 Жыл бұрын
I bet it will!
@nataliegriveratorres9138
@nataliegriveratorres9138 3 жыл бұрын
I have tried this using instead and I2C LCD Display, and no results. Is this actually possible?
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
Do you mean you want to type on a keyboard and see the result on the display? If so, that is definitely possible!!! I've never worked with LCD though, but if it has an i2c interface there is always a way to get it working in the end.
@The5012
@The5012 8 ай бұрын
For my project, the keyboard receives 5 volts but not enough current to power it. How do you ensure that the arduino provides enough power?
@stargazer7644
@stargazer7644 18 күн бұрын
You can power the shield from a more powerful external 5V power supply if you don't close the 5V jumper next to the 5V pin on the arduino.
@midorishimiz
@midorishimiz 3 жыл бұрын
Can you explain the connection for Arduino Mega? I believe Mega have more pins so I am a bit confused on where to plug the USB host shield in. Thanks!
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
The Mega has all the pins of the Uno, plus some more. So plug it in as it it was an Uno, and ignore the extra ones.
@midorishimiz
@midorishimiz 3 жыл бұрын
@@CircuitBreaker256 thanks! I did it. Is there some code that needs to be running, in order to activate the USB host shield on the Mega board? When I plugged in my USB device, it doesnt light up (no power), thus im thinking the USB shield is not connected prorperly? So we need to run the code first or no?
@midorishimiz
@midorishimiz 3 жыл бұрын
I was trying to connect a USB microphone (have an LED to show if its power on), for my project. I need to record some sounds using this devices. So far, the LED doesn't light up. Hopefully it is executable
@stargazer7644
@stargazer7644 18 күн бұрын
@@midorishimiz Make sure you solder the power jumpers on the host shield as explained in the video. Out of the box the shield won't power up at all.
@mohitgaikwad366
@mohitgaikwad366 3 жыл бұрын
Can it be possible by not using the shield and directly taking I inputs from the USB keyboard.
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
I don't think so, unless you implement the whole of the USB protocol on the Arduino, which would be a lot of work.
@mohitgaikwad366
@mohitgaikwad366 3 жыл бұрын
@@CircuitBreaker256 may I get the schematic diagram of the shield. mohitgaikwad2804@gmail.com
@2010RSHACKS
@2010RSHACKS 3 жыл бұрын
Im about 80% sure I fried my host shield trying to solder those connections. The pcb turned brown and i still ended up with 2 extra holes filled with solder
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
Hmm, I think you need a lower wattage soldering iron or to turn the temperature down. It only takes a tiny blob of solder.
@rufserafin7855
@rufserafin7855 2 ай бұрын
Nice tutorial! Where can I find the source code for the project?
@mrrawrr_5739
@mrrawrr_5739 2 жыл бұрын
:( id happily pay somebody in the UK to get a pre soldered USB host shield.
@stargazer7644
@stargazer7644 18 күн бұрын
You really need to buy a soldering iron and a spool of rosin core electrical solder.
@unglaubichuberlieber8048
@unglaubichuberlieber8048 3 жыл бұрын
thanks !!! have you tried thie keyboard via a usb hub to the shield ??? take care+stay healthy !!!
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
I haven't tried using a USB hub yet, but I know it is possible and the library for this module specifically supports it. I'll give it a go!
@unglaubichuberlieber8048
@unglaubichuberlieber8048 3 жыл бұрын
@@CircuitBreaker256 i have tried it...connecting the usb host shield to a mega2560, then a usb hub 2.0 then i inserted an usb pendrive, it came back usb init failure... the usb hub+usb pendrive( both usb 2.0) both works under linux+win7 without problem...later when the other usb hub arrives, i will try this again , take care+stay healthy !!!
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
@@unglaubichuberlieber8048 for connecting a USB pen drive you should use a CH376 module.
@scottlbaker
@scottlbaker 3 жыл бұрын
Is the demo sketch code available for download?
@scottlbaker
@scottlbaker 3 жыл бұрын
Never mind, I was able to get it working. Thanks for a great video!
@scottlbaker
@scottlbaker 3 жыл бұрын
I modified the demo code to translate/send ASCII to Morse code. I found by experimentation is that it does not seem to like long delays between calls to Usb.Task. I don't know why this is or if there is a work around. Do you have any insights?
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
I think that Usb.Task is supposed to be called regularly, otherwise you would miss Usb events, like key-down. A better option would be to set it up on an interrupt to call it, let's say, 50 times per second. Then put any keys that it gets into a circular buffer. Your main program could drain the circular buffer and the interrupt could fill the buffer.
@scottlbaker
@scottlbaker 3 жыл бұрын
@@CircuitBreaker256 Thanks, I have implemented a fix and it seems to be working well now.
@scottlbaker
@scottlbaker 3 жыл бұрын
@Menno Wormsbecher Sure :) github.com/scottlbaker/morseKeyers
@samrumc2761
@samrumc2761 3 жыл бұрын
Is the source code for this available?
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
It is on my PC. I'll add it to my github repo when I get a chance!
@samrumc2761
@samrumc2761 3 жыл бұрын
@@CircuitBreaker256 thanks!
@marcusk7855
@marcusk7855 3 жыл бұрын
So weird to have a USB chip that is 3.3v when the USB standard is 5v.
@CircuitBreaker256
@CircuitBreaker256 3 жыл бұрын
Well it seems that the bus power is 5v but the signals can be 3.3v
@stargazer7644
@stargazer7644 18 күн бұрын
5V is the USB power supply. That gets regulated to 3.3V for the logic chips inside USB devices.
@uplnejvypatlanec1692
@uplnejvypatlanec1692 2 жыл бұрын
pretty hard to understand the mumbling for non english speaking people :-(((
@CircuitBreaker256
@CircuitBreaker256 2 жыл бұрын
Sorry about that!
@mieszkog2420
@mieszkog2420 2 жыл бұрын
His english is pretty good. I would even say that he sounds like a native to me lol
@rafikakbar8363
@rafikakbar8363 2 жыл бұрын
@@mieszkog2420 the guy on the video is native, but the guy that commented isn't
@carldominicbague
@carldominicbague 2 жыл бұрын
Hello sir! is there a way we can talk to you, like email or social media.
How to Connect a PC Keyboard to an Arduino?
6:12
Doctor Volt
Рет қаралды 51 М.
How does a USB keyboard work?
34:15
Ben Eater
Рет қаралды 3,2 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 4,7 МЛН
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 20 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 85 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 79 МЛН
#407 ESP32-S2 New Arduino USB Functionality: Cool Combination with WiFi
12:31
Easy Arduino PS/2 Keyboard Read Out
6:31
Slu4
Рет қаралды 27 М.
BarCode Scanner with Arduino
4:46
Saravanan AL
Рет қаралды 85 М.
Control your keyboard with Arduino!  Automate simple tasks!
22:48
Programming Electronics Academy
Рет қаралды 65 М.
USB host shield + Arduino Leonado_27/12
1:58
Technical HshopVN
Рет қаралды 386
USB Host Shield con arduino
11:02
SETISAEDU
Рет қаралды 39 М.
Arduino Aimbot Tutorial | Pyserial Tutorial | Tech Breakdown 3
12:58
Satori Digital
Рет қаралды 63 М.
Usb mouse and keyboard on Arduino, CH559 cheap usb host chip
19:25
Aaron Christophel
Рет қаралды 27 М.
How to Convert Laptop Webcams to USB Webcams
5:29
DIY Perks 2
Рет қаралды 664 М.
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 10 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 473 М.
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 2 МЛН