# Using USB keyboard as input device

**URL:** <https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766>\
**Category:** HMI & Visualization\
**Tags:** vc4\
**Created:** [November 4, 2024, 12:27pm UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766 "2024-11-04T12:27:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TDerks](https://avatars.discourse-cdn.com/v4/letter/t/FF8800/32.png) [@TDerks](https://community.br-automation.com/u/TDerks)\
**Post date:** [November 4, 2024, 12:27pm UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/1 "2024-11-04T12:27:54Z")

</div>

Hello,

As the title says, I want to use a USB keyboard as an input device for my PLC.  
I’ve been doing some research and I’ve found some library’s for USB (AsUSB, dvframe), But I don’t think this is what I’m looking for.

I’ve also been able to find the “USB-Keyboard” hardware module, this one needs a visualization object to map its inputs. Although I don’t fully understand how this works.

I’m currently doing an internship and don’t have much experience with PLCs so  
please excuse my lack of knowledge.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![carl.hidestal](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/carl.hidestal/32/4370_2.png) [@carl.hidestal](https://community.br-automation.com/u/carl.hidestal)\
**Post date:** [November 4, 2024, 3:48pm UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/2 "2024-11-04T15:48:05Z")

</div>

Hello,

Without knowing the answer but being curious… I think it helps if you provide a bit more information. What do you want to do with the keyboard? Text input on an HMI? Using the keys as inputs to the program?

BR  
Carl

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [November 4, 2024, 4:03pm UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/3 "2024-11-04T16:03:19Z")

</div>

Quite nice general overview was provided by Alexander.

> [@Automation runtime in APC3100](https://community.br-automation.com/t/automation-runtime-in-apc3100/4544/12):
>
> Hi, I haven’t read the whole thread to be honest, but for me it sounds a bit like a misunderstanding: as I remember, Visual Components 4 does not support mouse operation at all. VC4 was designed exclusively for use with touch panel hardware, in the AR no mouse support is integrated and cannot be configured. a USB Keyboard can be connected (like you’ve done already), but it’s not acting like a “normal keyboard” - it is more used like a “free configurable bunch of hardware buttons”… if you …

For more detailed answer we will need definitely more info from you.

---

<div class="post-metadata">

**Author:** ![TDerks](https://avatars.discourse-cdn.com/v4/letter/t/FF8800/32.png) [@TDerks](https://community.br-automation.com/u/TDerks)\
**Post date:** [November 5, 2024, 7:05am UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/4 "2024-11-05T07:05:30Z")

</div>

Thank you for your response,

A “free configurable bunch of hardware buttons” is exactly what I want to achieve.

In the configuration of the keyboard, under “Key mapping file” is an option for “VC/USB-Keyboard.dis”. Is this what I need? when I try to open it, I get the error: “There is no visualization object mapped to the file VC/USB-Keyboard.dis. To open a visualisation in HW-mode please map a suitable visualisation object”.  
I’ve created a VC4 object in my logical view, but I’m not sure what I can do there.

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [November 5, 2024, 8:14am UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/5 "2024-11-05T08:14:39Z")

</div>

We are little bit in circle of knowing nothing. So lets start from beginning, what hw do you have in plan to use for your visualization and what kind of visualization (VC4, mappView,.) do you have in plan to use?

---

<div class="post-metadata">

**Author:** ![TDerks](https://avatars.discourse-cdn.com/v4/letter/t/FF8800/32.png) [@TDerks](https://community.br-automation.com/u/TDerks)\
**Post date:** [November 5, 2024, 8:56am UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/6 "2024-11-05T08:56:53Z")

</div>

I am not planning to use any visualisation for my project. I simply want to be able to detect button presses from a keyboard.

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [November 5, 2024, 10:01am UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/7 "2024-11-05T10:01:40Z")

</div>

So you have PLC with USB interface and you would like to read cyclically input from external keyboard plugged into the USB. For this usecase, if Im not mistaken, you have to use AsUSB library. There are samples included and I think barcode reader sample is the right one, because it acts usually as a USB keyboard.

[https://help.br-automation.com/#/en/4/libraries/asusb/samples/samples\_asusb.html](https://help.br-automation.com/#/en/4/libraries/asusb/samples/samples_asusb.html)

If Im mistaken then I hope that anyone else from community can correct me 🙂

---

<div class="post-metadata">

**Author:** ![corne.geerts](https://avatars.discourse-cdn.com/v4/letter/c/FF8800/32.png) [@corne.geerts](https://community.br-automation.com/u/corne.geerts)\
**Post date:** [November 5, 2024, 10:08am UTC](https://community.br-automation.com/t/using-usb-keyboard-as-input-device/4766/8 "2024-11-05T10:08:35Z")

</div>

You should look at the AsUsb library.  
The AsUSB - USBNodeListGet() should be able to detect the USB-keyboard.  
Look at one of the samples and adapt it for the keyboard.

You will also need functions from the DvFrame library to read the data from the keyboard.  
See also one of the samples in the AS-Help for this.

I did not find a specific USB-keyboard sample, but perhaps someone else has made it.
