Go Down

Topic: Interface barcode scanner with arduino yun (Read 10476 times) previous topic - next topic


Dear All,

I wish to interface my USB type barcode scanner with arduino yun board and for the every scan the scanned value should be shown on the serial monitor.  This is my task.

I'm not able to find any HID USB interfacing examples for Arduino Yun board in the software.  If any body guide me to reach the goal, that will be very useful.  If any body have the sample code for HID concept, please share.



But the concept of Arduino yun is different from all other.  It uses brige concept na.  If you find any other links or reference, please let me know.



Oct 18, 2014, 08:49 am Last Edit: Oct 18, 2014, 09:19 am by sonnyyu Reason: 1

Code: [Select]
opkg update
opkg install kmod-hid
opkg install kmod-input-evdev
opkg install kmod-input-core
opkg install kmod-usb-hid

Code: [Select]
ls -l /dev/input/
crw-r--r--    1 root     root       13,  64 Jan  1  1970 event0
crw-r--r--    1 root     root       13,  65 Oct 18 06:27 event1

The barcode scanner is at

Code: [Select]

Now we need compile c program "barcode"

download it from here:


Code: [Select]
/mnt/sda1/barcode  /dev/input/event1
Reading From : /dev/input/event1 (WIT Electron Company WIT 122-UFS V2.03)

[font=Verdana]Caution Yun USB only give out ~4.5V  power supply, use powered USB hub![/font]


All above is about 1D barcode, but it starts fade out.

2D barcode is hot cake now, Opencv and video camera is needed for 2D barcode...


Dear Mr.Sonnyyu,

Thanks a lot for the details.  I can understand your coding steps.  But I do not know the way to impliment the same.  Hence I'm new to both arduino yun and linux and this is my first try in this board, even I understand its bridge concepts,  it's programming ways are confusing me a lot.  Kindly bear and please explain the way to do this in step by step manner.  From where I have to execute "opkg update" command.  What are all the hardware connection I need at that time.




When I try to install "kmod-hid" using - opkg install command, getting error message.

root@Arduino:/# opkg install kmod-hid
Unknown package 'kmod-hid'.
Collected errors:
 * opkg_install_cmd: Cannot install package kmod-hid.

What I have to do.  Should I have to place any file in SD card or should I have to upload any files to processor.  If it is, please share the way.



You missed to run the first command sonnyyu wrote
Code: [Select]
opkg update


I tried it.

root@Arduino:/# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check failed.
Remove wrong Signature file.
Collected errors:
 * opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz, wget returned 4.
 * opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig, wget returned 4.

Updation is failed.  How to solve this.


Maybe the Yun is not connected or the server was down. As you can read it fails to download files.
Check the internet connection and retry


Anybody please confirm my hardware set up is right?

Connected PC and arduino via USB.   Loaded ipk files in SD card card which is inserted in Arduino Yun.  Established internet connection in PC.


If I were you, I will connect ethernet  cable between router and Yun.


I can understand your words. 

Please clarify my doubt.  Is there any way to do "opkg update" without internet connection? Is it possible to download the required packages to SD card? and Can we update the opkg with this files in SD card?

Because in my current set up, I'm using Reliance Dongle for my internet connection.  It is like pen drive and I do not have any router set up.  That's why I'm looking for a alternate idea.


opkg will install the packages from the sd card if you give the full path/file name, something like:

Code: [Select]
opkg install /mnt/sda1/kmod-hid_3.3.8-1_ar71xx.ipk

You need to satisfy the dependencies yourself, for instance you would need to download and install these first:

Code: [Select]
opkg install /mnt/sda1/kmod-input-core_3.3.8-1_ar71xx.ipk
opkg install /mnt/sda1/kmod-input-evdev_3.3.8-1_ar71xx.ipk

Go Up