Barcode scanning to run gcode

More
03 Apr 2016 11:20 - 03 Apr 2016 11:27 #72614 by beltramidave
Sorry for the short reply. I thought it was someone here that helped me figure this out before.
In Linuxcnc, the keyboard shortcut to open a file is the lowercase o. If you include o in your gcode filename (otest.ngc)
and then create a barcode from that filename, scanning it will open the file.
I used an free online program to create the barcode. I was using a Honeywell scanner 3800G. There is also a way to run the program too. Will try and find that doc from Honeywell. I decided not to use that as I wanted the operator to make sure they were ready first.
Was really quite simple. Hope this helps.


File Attachment:

File Name: barcodegenerator.doc
File Size:1,365 KB



File Attachment:

File Name: Scannerset...odes.doc
File Size:38 KB
Attachments:
Last edit: 03 Apr 2016 11:27 by beltramidave.
The following user(s) said Thank You: eFalegname

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 12:03 #72703 by andypugh

In Linuxcnc, the keyboard shortcut to open a file is the lowercase o. If you include o in your gcode filename (otest.ngc)


I assume, then, that your barcode scanner acts as a keyboard emulator and sends keystrokes?

I am sure there must be more resilient ways to do it :-)

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 12:23 #72705 by beltramidave
I am sure there are other and possibly better ways, but this is what I came up with...with my very limited knowledge of Linux and scanners.

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 17:15 - 04 Apr 2016 17:19 #72728 by eFalegname
Sorry for not answering before I was looking for a convenient and reliable barcode scanner and found this which is completely linux compatible Inateck BCST-20 WiFi



I was able to add to the axis-remote script the -R (--run) command to start the opened Gcode in Axis (following ArcEye axis-remote for version 2.6 of linuxcnc), then I modified the bash that JT suggested:
if axis-remote -p
then 
axis-remote /home/efalegname/linuxcnc/nc_files/matrix_1.ngc
axis-remote -R
fi
When the Barcode scanner arrives I will be able to continue looking for a solution because now I don't get how you can run a python script and a Gcode from a barcode label...I'm a bit confused.
Last edit: 04 Apr 2016 17:19 by eFalegname.

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 18:06 - 04 Apr 2016 18:55 #72731 by BigJohnT
I wrote a little python script this morning that when ran will scan one bar code with a USB webcam then send the parsed results to axis-remote to load the file. I don't have the code in front of me right now or I'd share.

JT
Last edit: 04 Apr 2016 18:55 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 20:20 #72736 by eFalegname
well I'm almost desperate I want to see the script so I can go to sleep tonight please Big John share it

Please Log in or Create an account to join the conversation.

More
04 Apr 2016 21:00 - 04 Apr 2016 21:11 #72739 by TurBoss
Hi

Can you set the scanner to send data via rs232

I was able to do it with a honeywell voyager just by change the wiring (specified in manual)

so you dont have to focus the app to get the data

edit: sry nothing in the manual indicates that this is posible :(
Last edit: 04 Apr 2016 21:11 by TurBoss.

Please Log in or Create an account to join the conversation.

More
06 Apr 2016 22:54 #72876 by BigJohnT

well I'm almost desperate I want to see the script so I can go to sleep tonight please Big John share it


Sorry got side tracked this morning trying to get someone up and going... I'll dig it up in the am and post it.

JT

Please Log in or Create an account to join the conversation.

More
07 Apr 2016 07:50 #72896 by eFalegname
:laugh: ok I'm still waiting for you without shutting down the computer.

Please Log in or Create an account to join the conversation.

More
07 Apr 2016 11:20 #72900 by BigJohnT
Ok, here you go... it's rather short and lacking in the error checking department but functions.
#!/usr/bin/python
import os
import subprocess
from sys import argv
import zbar

# Create a Processor
proc = zbar.Processor()

# Configure the Processor
proc.parse_config('enable')

# Initialize the Processor
# more checking is needed here as it might be video1
device = '/dev/video0'
if len (argv)> 1:
    device = argv [1]
proc.init (device)

# Enable the preview window
proc.visible = True

# Read at least one barcode (or until window closed)
proc.process_one()

# Hide the preview window
proc.visible = False

# Extract results
for symbol in proc.results:
    # Do something useful with results
    print 'decoded', symbol.type, 'symbol', '"% s"'% symbol.data
    file = os.path.expanduser('~') + '/linuxcnc/nc_files/' + symbol.data
print file

if subprocess.call(['axis-remote', '--ping']) == 0:
	print 'Axis is running'
	subprocess.call(['axis-remote', file])
else:
	print 'Axis not found'
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.243 seconds
Powered by Kunena Forum