Hello Guest it is December 09, 2021, 09:29:05 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Octathorpe

Pages: 1 2 3 »
1
For those reading this, I've found a way to do what I was after.  I can enter a G code line directly into the MDI input line in Mach3 to accomplish my desired move of the XY table.  To enter the G code line I run a .VBS script through the other data collection application.  The VB script uses SendKeys to pass the text for the MDI input box in Mach3 as shown in the example script below.  I have not done extensive testing and if anyone has any pointers on how to do better housekeeping please feel free to post improvements.  For now it seems to do the trick and allows me to automate the XY stage to collect multiple samples on my apparatus.
--------------------------------
set WshShell = WScript.CreateObject("WScript.Shell")
'AppActivate usng window title name
'Mach3 must already be running
WshShell.AppActivate "Mach3 CNC Controller"

'short delay to allow window to activate
WScript.Sleep 100

'Send ALT 2 to bring up MDI tab
WshShell.SendKeys "%2"

'Short delay because Mach3 needs a delay here
WScript.Sleep 500

'Send ENTER to activate MDI input line
WshShell.SendKeys "{ENTER}"
WScript.Sleep 100

'Send some G Code
WshShell.SendKeys "X1{ENTER}"
WScript.Sleep 100
WshShell.SendKeys "Y3{ENTER}"
WScript.Sleep 100

'Send ENTER to toggle MDI editing line activation
WshShell.SendKeys "{ENTER}"


'see http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
'for SendKeys info and special codes
-----------------------------------------------

2
I have a piece of equipment in my lab that is designed to acquire data from a single sample and store the data in a file.  I have modified the machine by adding a motorized XY stage (no Z) that allows me to move the stage and position additional samples for analysis. I use Mach3 to control the XY stage.  Using VB script within Mach3 I am able to link the data acquisition program to Mach3 (sort of) to automate the data collection for multiple samples

The following is a thread relating to how I used (sucessfully!) a macropump within Mach3 to move the stage between samples:

http://www.machsupport.com/forum/index.php/topic,8252.0.html

I have a new data acquisition program that allows me to sequence events from within the application and these events include the ability to run an external file.  My hope is that I could simply run a VB script to move the XY stage between samples.  The VB script would likely be very simple, but my question is this:  can I control Mach3 using a VB script from outside the Mach3 program?  If both Mach3 and this data acquisition program are running, can I basically use the data acquisition program to execute individual VB scripts that would in turn tell Mach3 to do basic movements (e.g. move 9 mm to the right)?  I know that I can do this easily from _within_ Mach3, but I'm not sure if it is easy to do this by executing a VB from outside of Mach3.

Thanks for any comments or code suggestions that you may be able to supply.

3
The little breakout relay board arrived today.  It only took a short while to get it wired up.  It worked on the first try.  I have added some buttons to the screen to control the relays manually (even got an LED to turn on and off, which is very basic, I know, but it was pretty advanced for me).  I then added some code to the macropump to turn off the power to the motors (not the controller board) and the laser power once the files have reached 96 (the end) and the probe has returned to the home position.  It took me much longer to do the code because it was pretty much trial and error, but it works.

It all seems to function well.  I may try to add some extra features now such as the option of running two or three plates at one time instead of just one.  Overall the system seems to function quite well and is pretty robust so far.  And now I have saved myself a lot of money because I won't have to replace the laser as soon  :D

Thanks, y'all for your help on this.

4
I've ordered a dual relay board.  That way I'll be able to turn off the power to the spectrometer _and_ the power to the motor controller card.  I'll report back after it arrives and I've installed/tested.

5
That is the way that I have it wired - although when I tested it I did not put anything on the 110V side except a voltmeter.  I'll check it again tomorrow and confirm.

A bit of googling suggests that the parallel port is not supposed to drive the relay directly, but rather an external power source is used to drive the relay using the logic signal from the parallel port.  An example schematic is here:

http://www.winfordeng.com/download/rly102_schematic.pdf

This is the part link:

http://www.winfordeng.com/products/rly102.php


6
Hello all,

First, let me say that the system is working very well and I have been collecting a lot of data!  I still run it on two different computers with a switcher, but it works fine that way. 

I am writing now to ask if anyone has a suggestion concerning the wiring of the relay that I would like to use to shut off power to the spectrometer when the data collection is complete.

I have an Opto 22 (mentioned above) relay that accepts 3 to 32 V DC input.  I have been able to identify and wire the pins for an output that I set up in Mach3.  I can use the VB script editor to turn the voltage to this pin on and off.  It sends about 4.25V DC to the output.  I am using a Dell optiplex to drive the on-board parallel port (in ECP mode with no DMA assigned).   When I hook the output from the parallel port to the relay (with nothing on the 120VAC side) the voltage drops to 2.6 C DC and the other side of the relay shows no change.  I suspect that the parallel port can not manage to supply enough current to make the relay function.  I am wondering if the parallel port is wimpy or perhaps I have a relay that needs lots of power.  I would guess that folks have run into this problem before so if anyone has any advice I would appreciate it.

I have a nice parallel port card but it is full height and the Dell that I have (got it free...) has half-height card slots.  I can get a different box and use the card to drive the parallel port if folks think that this will supply enough current to control the relay. 

7
Great!  I ordered a relay.  I think I can figure out the output pins and put the code in there to do the hi/low switching as needed. 

8
I am using a breakout board, I think it is a Xylotec. 

To be clear, although it would also be handy to turn off the juice to the motors, what I want to control is the power cord to the spectrometer.  A Photo-coupled SSR normally open would do it I believe.  Then I coudl send 5V after file 96 and open the relay and kill the power to the spectrometer.  This should be pretty easy once I find the right part.


9
The issue with running on one machine has to do with the spectrometer program.  I don't have the install program for that as it came with the machine.  All I have is the computer with the app installed (and an image of the drive in case it goes down).  So it's  fine that it's running on two machines.  I've got a stack of boxes all going through one KVM switch to run various machines in the lab anyway.

I have a question:  Is there a way to use an output signal (I guess 5V on the parallel port cable) to turn off my spectrometer when the data is finished? The laser source has a finite lifetime.  I'm guessing this would be some kind of power/solenoid type electrical switch.  Is there such a device?  I assume it would be fairly simple to add some code that tells mach 3 to go hi on a certain pin when file #96 is reached, yes? 

10
I set up the system with dual machines - one running the spectrometer instrument, the other Mach 3.  Cross-over cable and shared drives.  It all works fine.

I have set up the first proper data collection in full automation mode and it is currently running!

All of this hard work just so that I can type this message to you while mach 3 is doing my work for me....

Pages: 1 2 3 »