How to Connect a PC Keyboard to an Arduino?

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

Комментарии •

  • @galier2
    @galier2 2 года назад +16

    Excellent. I just wanted to use an arduino to replace my keyboard on my old Apple II clone which is horribly bad (bounces like hell). I thought I would need an USB shield but thanks to your trick I might away without it.

    • @paulciarelli9453
      @paulciarelli9453 Год назад +1

      By the way, thank you for the excellent explanation.

  • @buddysnackit1758
    @buddysnackit1758 Год назад +10

    This video was awesome. No fluff. Direct to the point. Easy to understand. A+

  • @vaughan.gittel
    @vaughan.gittel 2 года назад +3

    thanks for explaining in really good detail it was a good walk through for me. i learnt a lot of little things along the way!!

  • @samsorrell6982
    @samsorrell6982 Год назад +1

    Excellent project!

  • @michaelo2l
    @michaelo2l 23 часа назад

    Very useful, many thanks

  • @kb3cxe
    @kb3cxe 2 года назад +1

    This is a great video. Very informative, and lightyears ahead of me. Your are very easy to understand. Thank you.

  • @pauljcampbell2997
    @pauljcampbell2997 2 года назад +2

    This is very good. Thank you!

  • @deJean1951
    @deJean1951 Год назад +1

    This video was awesome.

  • @user-mr3mf8lo7y
    @user-mr3mf8lo7y Год назад +1

    Much appreciated.

  • @fl366
    @fl366 Год назад +1

    Very good!

  • @AjinkyaMahajan
    @AjinkyaMahajan 2 года назад +2

    Wonderful.
    Thanks!!!

  • @restaurantattheendofthegalaxy
    @restaurantattheendofthegalaxy 11 месяцев назад +1

    I love it thank you!

  • @timobreumelhof88
    @timobreumelhof88 2 года назад +1

    Very cool! Have been looking for some kind of a solution but all were kind of difficult. I'll try that on my esp32s!

  • @johnthompson4011
    @johnthompson4011 Год назад +1

    Bro is a genius

  • @PeetHobby
    @PeetHobby 2 года назад +8

    This only work on special old keyboards when usb was just introduced, modern cheap usb don't support this anymore.

    • @DoctorVolt
      @DoctorVolt  2 года назад

      Thank you. This is the main reason when it does not work.

    • @peircedan
      @peircedan Год назад

      I have tried three brands of keyboard and none of them have shown signals on my scope yet.
      EDIT: Looking up new keyboards that support both USB and PS2 I find there are some still available but they are not low price! One example is from Adafruit.
      EDIT2: After more looking I see one can get a better price purchasing a PS2 only keyboard but it is still almost twice the cost of some low price USB keyboards.

  • @jb0433628
    @jb0433628 Год назад +1

    Good job !!

  • @Mr.Vikas.Maddheshiya_097
    @Mr.Vikas.Maddheshiya_097 Год назад +1

    Thanks man

  • @unglaubichuberlieber8048
    @unglaubichuberlieber8048 Месяц назад

    gut gemacht...bravo!!! bravo!!! bravo!!!

  • @amulpatel
    @amulpatel 4 месяца назад

    Thank you!

  • @batinayunsel
    @batinayunsel Год назад +1

    S+ video, can i run it without using 10k resistor?

  • @Theodor1st
    @Theodor1st Год назад +1

    Ha ha! My cat also likes to rest on the laptop keyboard...

  • @OnnieKoski
    @OnnieKoski 4 месяца назад

    This is brilliant. I wonder if I can get it to write the input from the keyboard to an SD card 🤔

  • @JohnJohn-gy2st
    @JohnJohn-gy2st Год назад +1

    Hello
    Clock and data are output in keyboard

  • @sagarkarsh8963
    @sagarkarsh8963 Месяц назад

    Very Good thanks

  • @issahassane1
    @issahassane1 Год назад

    great video ! could you tell me more about the oscilloscope software that you are using and these two things that you have hooked on the resistors ? Thanks in advance

    • @DoctorVolt
      @DoctorVolt  Год назад

      It's the probes of my USB oscilloscope. I'm using a Hantek6254BC

  • @qweqwerty7537
    @qweqwerty7537 Год назад

    Sir, thanks for your guide, i have a problem in a moment, when you got 3 bytes of data in 2:44, i got 4 - 6 samples. I`m not a pro in programming, may you give an advice how to fix this and read correctly the keyboard? On oscillo i have the same picture.

    • @DoctorVolt
      @DoctorVolt  Год назад

      Maybe you pick up the "make code" when you press the key plus the "break code" when you release it. Together that's 4-6 bytes. Try pressing the key, then holding it a bit before you let go of it. Then you'd see this better.

    • @qweqwerty7537
      @qweqwerty7537 Год назад

      @@DoctorVolt , thanks for your answer. When i`m holding the button, some bytes are repeated lika you showed in video, but sometimes another byte is mixed in this scope. Excuse me, what is the 'make code' and 'break code'? While testing , i pressed only 'q' and 'w' on the keyboard. And when i press 'q' i had, for example 77 FF EF FF 77, and when i press 'q' again i had 7F EF EE FE. It`s not the correct symbols i have, its like showing the situation i got. Sorry for long reading, thanks for your time.

    • @josh2112
      @josh2112 18 дней назад

      @@qweqwerty7537 I think by "make" and break", he meant key press and key up

  • @yt4krist0f
    @yt4krist0f 11 месяцев назад +1

    Cool!

  • @thoyibbasarah3302
    @thoyibbasarah3302 Год назад

    How to read any unique serial data when pressing key. I collect into database and use for comparing what the key is pressing.

  • @stulora3172
    @stulora3172 5 месяцев назад +1

    Would it be possible to read out and use a universal USB game controller with this technique?

    • @DoctorVolt
      @DoctorVolt  5 месяцев назад +1

      Yes, it might work with old ones.

    • @stulora3172
      @stulora3172 5 месяцев назад +2

      @@DoctorVolt I learned how to interpret osci data in your video, thank you for that. If you find the time, make a video about it! I am more of a programmer than an electronic...er? so once I know where to start, I could easily create a library :)

  • @natriumhydrochlorid
    @natriumhydrochlorid Год назад +1

    Vielen Dank ! 🐈‍⬛

  • @gh-ry8jy
    @gh-ry8jy 4 месяца назад

    Hello, i have à challenge for you. can you make a version for attiny, thanks very much !

  • @paulpixzy5297
    @paulpixzy5297 2 года назад

    How can I use up and down button to scroll the letters and use ok to select letters (to replace the key board )and also save what I have written to eeprom

  • @Tech-Relief
    @Tech-Relief Год назад +1

    this does not work with any of my USB keyboards, apparently only some older keyboards work that way.

  • @thisisgood44
    @thisisgood44 Год назад +1

    i want to do this because i want to troubleshoot my undetected keyboard so that im sure that the problem is on the firmware

  • @davidecosciani9232
    @davidecosciani9232 Год назад +1

    Hi, very nice! Is it possible use an Mega2560 todo this? How manage the INT?

    • @DoctorVolt
      @DoctorVolt  Год назад +1

      Yes, with a few adaptions it will also work with a Mega2560

    • @your-dad
      @your-dad Год назад +2

      Hi davide, how do you made it work on arduino mega? i can't make it work.

  • @mikaelkrisna
    @mikaelkrisna Год назад

    How did u get that keymap array? is that array can be used for all type of keyboard? Such a great video btw 👍

    • @DoctorVolt
      @DoctorVolt  Год назад

      It's taken from a list of PS/2 keycodes which you can find anywhere.

  • @wikomaya5155
    @wikomaya5155 2 месяца назад

    great that what I search

  • @GreenuniverseEuro
    @GreenuniverseEuro 2 года назад

    I guess this will work with nodeMCU aswell.

  • @chainleang5313
    @chainleang5313 Год назад

    If I would like to make it just like a real keyboard of my pc,not print on the LCD sceen,what else should be done?

  • @MohammadHassanSohanAjini
    @MohammadHassanSohanAjini Год назад

    Great video. I'm wondering what is the signaling makes the Caps lock light on? Is it possible to capture the signaling after you press it?

    • @DoctorVolt
      @DoctorVolt  Год назад

      It is the same serial protocol, but in oppoosite direction.

  • @inzaneygo5012
    @inzaneygo5012 Год назад

    Does it only work with an arduino Nano/Micro or is it possible with an Arduino UNO? I am struggling with the keyboard integration

    • @DoctorVolt
      @DoctorVolt  Год назад

      It works with both Uno and Nano, but the keyboard must support the PS/2 protocol.

  • @ademarjunior8906
    @ademarjunior8906 2 года назад +2

    I tried to do this using two different USB keyboards, and the code is in an infinite loop, in the serial appears FF and when I click on any key, nothing appears, I tried to change the BaudRate, but it didn't work, does anyone know what I can try?

    • @DoctorVolt
      @DoctorVolt  2 года назад +1

      Changing the baud rate does not help, because the clock is supplied by the keyboard itself. Also check whether the keyboard does really output the PS/2 signals like shown in the video if you have an oscilloscope or logic analyzer. There are some keyboards around that only send the USB protocol and not PS/2. The Arduino cannot handle this.

    • @ademarjunior8906
      @ademarjunior8906 2 года назад

      @@DoctorVolt Thanks in advance my friend 💚

  • @milanvankoeveringe6596
    @milanvankoeveringe6596 2 года назад +1

    For me it doesnt work, the serial monitor starts to print things without me pressing a button. When i press a button nothing happens :(

    • @DoctorVolt
      @DoctorVolt  2 года назад +1

      Maybe your keyboard does not support the PS/2 protocol. You can Try another (older) one or check the cabling.

  • @Kyle-hb1go
    @Kyle-hb1go 4 месяца назад

    hello could i attach an output to each key

  • @HashirEasa
    @HashirEasa 2 года назад +1

    can you make a basic pc with this and a 16 by 4 lcd display

  • @חייםיבדייב
    @חייםיבדייב Год назад

    hey , im trying this project , im using an old keyboard but it won't get the 5v to light up and i checked the keyboard before , what to you think the problem is?

    • @DoctorVolt
      @DoctorVolt  Год назад

      Because it does not control the LEDs.

    • @חייםיבדייב
      @חייםיבדייב Год назад

      @@DoctorVolt what do you mean? i talked about the connection of the keyboard to the circuit , the keyboard doesn't get 5v to send the letters to the LCD

    • @DoctorVolt
      @DoctorVolt  Год назад

      The keybard cable shoud have 4 connectors: Plus 5V and ground, one for clock and one for data. So I don't exactly understand the issue.

    • @nolimitisme
      @nolimitisme Год назад

      @@DoctorVolt yea we realise that but when the keyboard wires are connected to the circuit it doesn’t send a letter to the lcd , it not even turn on.

  • @SNSISNSJISEJSJS
    @SNSISNSJISEJSJS 2 года назад

    Hey 👋👋 I liked your video soo much but I have a question. Can this be used to make a keylogger ?????

    • @DoctorVolt
      @DoctorVolt  2 года назад

      Yes, but note that the Arduino has only very limited memory to store the key strokes.

    • @yalcndegirmenci
      @yalcndegirmenci Год назад

      @@DoctorVolt how many characters is the limit

  • @Marc_Wolfe
    @Marc_Wolfe Год назад

    SAMD21. Datasheet specifies USB host mode. I'm sure there are others too.

    • @DoctorVolt
      @DoctorVolt  Год назад

      Yes, but Arduino is based on Atmega 328, which has no USB support at all

    • @escapZe
      @escapZe Год назад

      couldn't you hook up a USB module onto a bread board and set it to some pins?

    • @Marc_Wolfe
      @Marc_Wolfe Год назад

      @@escapZe Some times with what people call "bit banging" which can be very tedious to get working for some protocols. UART for example is fairly simple.

    • @escapZe
      @escapZe Год назад

      @@Marc_Wolfe k

  • @GameReviewGeeks-nr5tb
    @GameReviewGeeks-nr5tb Год назад

    Thank you so much I’m trying to make a typewriter that reads everything and saves it to a sad card🎉🎉🎉

  • @jameskidd7906
    @jameskidd7906 2 года назад

    Funky tnx à lot

  • @paulciarelli9453
    @paulciarelli9453 Год назад

    I searched for a long time, but most sites say this is not possible without extra hardware. I'm just a rookie, but I knew there had to be a way to do this electronically. I do have one question though. I have this experiment working with a wired numeric keypad, but it does nothing when I hook up a wireless keypad. I got a good clock and data signal with the wired keypad, but the wireless keypad shows nothing. I'm pretty sure I have my triggers set wrong to catch whatever is going on, but that is just a wild guess. Could you offer your thoughts please?

    • @DoctorVolt
      @DoctorVolt  Год назад +2

      That's because wireless keyboards don't support the legacy PS/2 protocol. They only use USB, of which the Arduino/Atmega328 is not capable at all.

    • @paulciarelli9453
      @paulciarelli9453 Год назад

      @@DoctorVolt Thank you for the quick response.

  • @scussef
    @scussef 2 года назад

    Hello, I want to interface a usb keyboard with an Arduino for an application that involves multiple simultaneous key presses. How could I do this?

    • @DoctorVolt
      @DoctorVolt  2 года назад +1

      This is only possible with modifier keys like Shift, CTRL, Alt. It´s not possible with normal keys like "a" and "b" for example.

  • @sharoyveduchi
    @sharoyveduchi 2 года назад

    Do you still have the schematic and the source code? I clicked on the link but it's not showing up on the "new project hub".

    • @DoctorVolt
      @DoctorVolt  2 года назад

      Here is the new link: www.hackster.io/michalin70/connect-a-usb-keyboard-with-an-arduino-50c077

    • @sharoyveduchi
      @sharoyveduchi 2 года назад

      @@DoctorVolt thank you!

  • @Arek_R.
    @Arek_R. Год назад

    Would it work with a barcode scanner?

    • @DoctorVolt
      @DoctorVolt  Год назад

      It depends on which protocol your scanner is using.

    • @Arek_R.
      @Arek_R. Год назад

      @@DoctorVolt I don't know but when I connected it to Android smartphone it been treated like a keyboard

  • @thalesgustavo8300
    @thalesgustavo8300 2 года назад

    He doubts?? Is there any way to connect a wireless keyboard instead of a wired keyboard? Thank you Thales Gustavo

    • @DoctorVolt
      @DoctorVolt  2 года назад

      I tried with mine, but it didn´t work.

  • @thalesgustavo8300
    @thalesgustavo8300 2 года назад +1

    Could you post the code?

  • @emergencyrussell
    @emergencyrussell 2 года назад +3

    I tested three USB keyboards and finally got one to respond, but it only prints FF.

    • @DoctorVolt
      @DoctorVolt  2 года назад

      If you have an oscilloscope or logic analyzer, you can check if the keyboards really output the signals described in the video. If not, it will not work.

    • @csicee
      @csicee Год назад

      @@DoctorVolt What if I don't have oscilloscope. Is there way to test?

    • @DoctorVolt
      @DoctorVolt  Год назад

      @@csicee Then, a $10 USB logic analyzer from China can do the job. You can get these on Ebay or Aliexpress.

    • @pje_
      @pje_ Год назад

      delivery: 42 days ;-;

  • @escapZe
    @escapZe Год назад

    Is there a version of this with a small LCD?

    • @DoctorVolt
      @DoctorVolt  Год назад

      Of course. You only need to adapt the sktch a bit

    • @escapZe
      @escapZe Год назад

      @@DoctorVolt k !

    • @escapZe
      @escapZe Год назад

      would it still work with a Arduino mega and a shield? I've tried but don't know if I did something wrong.

    • @escapZe
      @escapZe Год назад

      Also what would be the easiest way to find out what level of a resistor I would need?

    • @DoctorVolt
      @DoctorVolt  Год назад

      @@escapZe 10k is a good value.

  • @createrpro57
    @createrpro57 2 года назад

    Hello, it doesn't work on my arduino. When I put data + and data - to 5v of arduino my keyboard turns off because of short circuit of data + and data -. What should I do?

    • @createrpro57
      @createrpro57 2 года назад

      If I just connect data + to pin 7 and data - to pin 6 nothing happens. I have codded that if you press enter, led turns on but nothing happens

    • @createrpro57
      @createrpro57 2 года назад

      I am using arduino uno. Can you help me please?

    • @DoctorVolt
      @DoctorVolt  2 года назад

      If you wired everything correctly and it still doesn´t work, your keyboard might not support the PS/2 protocol. Many of the modern keyboards don´t support this any more.

    • @createrpro57
      @createrpro57 2 года назад

      @@DoctorVolt thank you for answering! In that case i will buy mini USB host shield. I think it will work the same way

  • @csicee
    @csicee Год назад

    I am using PS/2 keyboard and still nothing shows up

  • @m.s.m8918
    @m.s.m8918 2 года назад +1

    Mate how do I make it work for Arduino due because my native pott is use for something else

  • @your-dad
    @your-dad Год назад +1

    I have a problem, I have a ps/2 usb keyboard with rgb leds, and every time i commect the keyboard to the arduino it open and close after half a second, so i tried to remove the transistors, and i discovered that the data transistor connected to the 5v with the red usb wire make this happend, but when i remove the transistor completly it just doesn't open anymore, how do I resolve this?
    Thanks.

  • @pje_
    @pje_ Год назад

    "I blew up my house, is it a good sign? Will it finally work? EDIT: still not working, any advice??"
    😂
    Real question: can I just connect the 5V to Arduino's 5V, not using electronic buckle?

  • @easylogics4785
    @easylogics4785 2 года назад

    Its not USB keyboard.
    It's only PS2 keyboard.
    Because USB keyboard have D+ and D- and PS2 keyboard have data clock +5v and GND.
    He using PS2 keyboard not USB.

    • @DoctorVolt
      @DoctorVolt  2 года назад

      That's right. Only the keyboard connector is USB but the actual protocol is PS/2, as I clearly stated in the video. So the keyboard must be capable of PS/2 for this to function.

  • @Mr.-Fab
    @Mr.-Fab 2 года назад +3

    Red doch einfach Deutsch 🙄

    • @danpedersen5816
      @danpedersen5816 2 года назад

      Warum nur Deutsch? Ich verstehe Englisch besser als deutscher Sprache (that was nowhere near grammatical correct 🤔)

    • @barfu2954
      @barfu2954 8 месяцев назад

      Deutsche Untertitel wären nett.
      Zum Glück für mich ist Dein gesprochenes Englisch noch so deutsch gefärbt, dass sogar ich das meiste verstehe.

  • @necrodrucifver
    @necrodrucifver 6 месяцев назад

    It. Will.work with barcode scanners?

    • @DoctorVolt
      @DoctorVolt  6 месяцев назад

      Maybe if they use PS/2