Re: [Emc-users] Encoder as MPG over serial?

2010-10-01 Thread Edward Bernard
Thanks Colin. Your suggestions on how to proceed will be a useful roadmap for 
me. You might be interested in this to save pins on the Arduino: 
http://www.web4robot.com/SerialLCD.html. . I haven't seen a better price for 
such a unit and the others don't support the additional inputs.

Best regards,
Greg





From: Colin Kingsbury ckingsb...@gmail.com
To: emc-users@lists.sourceforge.net
Sent: Thu, September 30, 2010 11:58:02 AM
Subject: Re: [Emc-users] Encoder as MPG over serial?

I'm starting up a blog at http://ckcnc.wordpress.com to document what I'm
working on. There's nothing much there yet but there will be more over the
next couple weeks. I've got all the pieces working, what I need to do know
is tighten everything up. I'm designing a board that will have two encoders
(MPG and Spindle/FRO) and switches for axis and scale selection, continuous
feed, and cycle start/pause/single block, plus maybe a few extra depending
on what I can squeeze in.

What I'm playing with right now is adding an LCD display that could act as a
remote DRO, which would be really nice to have on a pendant. It's tempting
because a 20x4 display can convey a ton of information with 6 output pins
from the Arduino. But, I am running tight on pins as it is, and I feel like
I'd prefer to have hard LEDs for things like the axis and scale selections,
rather than forcing people to read an LCD. Of course, a Max7219 -segment LED
driver gives me 64 outputs from 3 pins, so maybe if I can get both to
work more power!

But I'm also unsure about how much data I can reliably push through the
wire. I can do all the core stuff with single-byte messages very easily, but
a DRO message requires 7 for a value like X12.345 (using ASCII), and it gets
messier if your messages have different lengths. So I'm just not sure how
far I am from running into contentions between, say, HAL pushing position
updates to the DRO, and the MPG wanting to move the axis. In principle
there's plenty of bandwidth at slightly higher speeds like 19200 or
57600bps, but my sense is these can be sufficiently less reliable that I'd
prefer to be really conservative, especially if I start selling the board.

Anyway, for your hacking in the meantime, my main suggestion is to build the
stack up in stages like this:

- Write your Arduino sketch with one or two inputs and outputs. Test it with
the serial monitor until it's doing exactly what you think it should.

- Write a minimal Python program you can run from the command line, and make
it talk to the Arduino, again using the serial monitor to verify everything.

- Add the HAL component to the Python program, and test it from the command
line with halrun to verify it's setting pin values as you expect.

- THEN, and only then, link it up with your GUI of choice.

Basically, my experience was that the vast majority of my problems were
actually in getting Python and the Arduino to communicate as I wanted.
Getting Python to communicate with HAL was almost trivial.

Colin-
 Your post was quite timely for me as I just recieved an Arduino with the
 intention of creating exactly the same setup for my gantry router. If you
 could
 share your code it would be a tremendous help and quite possibly save me
 from
 having my head explode. :)

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



  
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Encoder as MPG over serial?

2010-09-30 Thread Colin Kingsbury
I'm starting up a blog at http://ckcnc.wordpress.com to document what I'm
working on. There's nothing much there yet but there will be more over the
next couple weeks. I've got all the pieces working, what I need to do know
is tighten everything up. I'm designing a board that will have two encoders
(MPG and Spindle/FRO) and switches for axis and scale selection, continuous
feed, and cycle start/pause/single block, plus maybe a few extra depending
on what I can squeeze in.

What I'm playing with right now is adding an LCD display that could act as a
remote DRO, which would be really nice to have on a pendant. It's tempting
because a 20x4 display can convey a ton of information with 6 output pins
from the Arduino. But, I am running tight on pins as it is, and I feel like
I'd prefer to have hard LEDs for things like the axis and scale selections,
rather than forcing people to read an LCD. Of course, a Max7219 -segment LED
driver gives me 64 outputs from 3 pins, so maybe if I can get both to
work more power!

But I'm also unsure about how much data I can reliably push through the
wire. I can do all the core stuff with single-byte messages very easily, but
a DRO message requires 7 for a value like X12.345 (using ASCII), and it gets
messier if your messages have different lengths. So I'm just not sure how
far I am from running into contentions between, say, HAL pushing position
updates to the DRO, and the MPG wanting to move the axis. In principle
there's plenty of bandwidth at slightly higher speeds like 19200 or
57600bps, but my sense is these can be sufficiently less reliable that I'd
prefer to be really conservative, especially if I start selling the board.

Anyway, for your hacking in the meantime, my main suggestion is to build the
stack up in stages like this:

- Write your Arduino sketch with one or two inputs and outputs. Test it with
the serial monitor until it's doing exactly what you think it should.

- Write a minimal Python program you can run from the command line, and make
it talk to the Arduino, again using the serial monitor to verify everything.

- Add the HAL component to the Python program, and test it from the command
line with halrun to verify it's setting pin values as you expect.

- THEN, and only then, link it up with your GUI of choice.

Basically, my experience was that the vast majority of my problems were
actually in getting Python and the Arduino to communicate as I wanted.
Getting Python to communicate with HAL was almost trivial.

Colin-
 Your post was quite timely for me as I just recieved an Arduino with the
 intention of creating exactly the same setup for my gantry router. If you
 could
 share your code it would be a tremendous help and quite possibly save me
 from
 having my head explode. :)

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Encoder as MPG over serial?

2010-09-29 Thread Colin Kingsbury
For anyone who was curious, I figured this out last night and it turned out
to be a lot easier than I thought. Basically, all I needed to do was use the
MPG howto from the wiki (
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Hooking_Up_A_MPG_Pendant), and
instead of mapping the encoder inputs to the parallel port pins, I created a
phaseA and phaseB pin in my Python HAL component, and mapped to those. For
once, everything actually worked on the first try.

I did notice one small error on the wiki page, which was the omission of
'setp' in the calls to set axis.N.jog-vel-mode. I edited the page to add
this.

On Tue, Sep 28, 2010 at 1:14 PM, Colin Kingsbury ckingsb...@gmail.comwrote:

 So, thanks to an assist from Jeff Epler and Chris Radek, I've gotten my
 Arduino-HAL interface more or less fully functional with both inputs and
 outputs. My purpose for this is to build a human-machine interface (read:
 control panel for my mill). So far I've gotten it to turn input pins in
 HALUI on and off, and turn external LEDs on and off based on the status of
 output pins.

 What I'm wondering about is how best to work an encoder into this.
 Currently, the way I'm doing it is to have the arduino read the encoder
 outputs and convert them to a signal which represents one pulse in the CW or
 CCW direction. The Python script receives the signal, and then jogs the
 appropriate axis in the + or - direction for 1/10th of a second. So far, the
 motion seems smooth (on screen, I haven't tried it on one of my machines
 yet), but I'm wondering if there's a better way. The catch is that I'd like
 to keep this on the serial connection, both to save the parallel port pins,
 and also for the elegance of being able to do everything over the Arduino's
 USB cable.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Encoder as MPG over serial?

2010-09-29 Thread Edward Bernard
Colin-
Your post was quite timely for me as I just recieved an Arduino with the 
intention of creating exactly the same setup for my gantry router. If you could 
share your code it would be a tremendous help and quite possibly save me from 
having my head explode. :) 


Thanks,
Greg





From: Colin Kingsbury ckingsb...@gmail.com
To: emc-users@lists.sourceforge.net
Sent: Wed, September 29, 2010 11:12:22 AM
Subject: Re: [Emc-users] Encoder as MPG over serial?

For anyone who was curious, I figured this out last night and it turned out
to be a lot easier than I thought. Basically, all I needed to do was use the
MPG howto from the wiki (
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Hooking_Up_A_MPG_Pendant), and
instead of mapping the encoder inputs to the parallel port pins, I created a
phaseA and phaseB pin in my Python HAL component, and mapped to those. For
once, everything actually worked on the first try.

I did notice one small error on the wiki page, which was the omission of
'setp' in the calls to set axis.N.jog-vel-mode. I edited the page to add
this.

On Tue, Sep 28, 2010 at 1:14 PM, Colin Kingsbury ckingsb...@gmail.comwrote:

 So, thanks to an assist from Jeff Epler and Chris Radek, I've gotten my
 Arduino-HAL interface more or less fully functional with both inputs and
 outputs. My purpose for this is to build a human-machine interface (read:
 control panel for my mill). So far I've gotten it to turn input pins in
 HALUI on and off, and turn external LEDs on and off based on the status of
 output pins.

 What I'm wondering about is how best to work an encoder into this.
 Currently, the way I'm doing it is to have the arduino read the encoder
 outputs and convert them to a signal which represents one pulse in the CW or
 CCW direction. The Python script receives the signal, and then jogs the
 appropriate axis in the + or - direction for 1/10th of a second. So far, the
 motion seems smooth (on screen, I haven't tried it on one of my machines
 yet), but I'm wondering if there's a better way. The catch is that I'd like
 to keep this on the serial connection, both to save the parallel port pins,
 and also for the elegance of being able to do everything over the Arduino's
 USB cable.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



  
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Encoder as MPG over serial?

2010-09-28 Thread Colin Kingsbury
So, thanks to an assist from Jeff Epler and Chris Radek, I've gotten my
Arduino-HAL interface more or less fully functional with both inputs and
outputs. My purpose for this is to build a human-machine interface (read:
control panel for my mill). So far I've gotten it to turn input pins in
HALUI on and off, and turn external LEDs on and off based on the status of
output pins.

What I'm wondering about is how best to work an encoder into this.
Currently, the way I'm doing it is to have the arduino read the encoder
outputs and convert them to a signal which represents one pulse in the CW or
CCW direction. The Python script receives the signal, and then jogs the
appropriate axis in the + or - direction for 1/10th of a second. So far, the
motion seems smooth (on screen, I haven't tried it on one of my machines
yet), but I'm wondering if there's a better way. The catch is that I'd like
to keep this on the serial connection, both to save the parallel port pins,
and also for the elegance of being able to do everything over the Arduino's
USB cable.
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users