Sending serial commands via RS232 to a device by G-code

348 views
Skip to first unread message

Nils Kulak

unread,
Feb 17, 2017, 5:13:27 AM2/17/17
to Smoothieware Support

Dear community,

 

I'm facing a rather uncommon problem and I've been trying to find a solution here but wasn't successful so far. I need to tell a RS232 controlled stepper what to do (as a master). It takes serial commands like "GO01" to move to a predefined position 01 or "CP" to return the current position. I would very much like to set it in the G-code as it needs to be timed with the rest of the movements.

 

Am I thinking in the right direction to possibly include the commands as a M117 and try to parse the output through UART (via TTL-RS232 adapter)? Or could you think of a smoother solution?

 

Thank you in advance and any kind of idea is very much appreciated!


All the best,

 

Nils

Daniel Dumitru

unread,
Feb 17, 2017, 5:21:55 AM2/17/17
to smoothiewa...@googlegroups.com
Hi,
As I know smoothie accepts commands over serial 0. It's same as those have been sent over USB.
It's easy achievable ,  you just need a rs232 to ttl adapter.

Daniel

--
You received this message because you are subscribed to the Google Groups "Smoothieware Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-support+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nils Kulak

unread,
Feb 17, 2017, 5:26:25 AM2/17/17
to Smoothieware Support
Hi Daniel,

thanks for the very quick reply!

I want to achieve the opposite. The Smoothieboard needs to send commands (GCode triggered) to the other device as in being the master, not the slave...

Any ideas for that?

Cheers,

Nils

Daniel Dumitru

unread,
Feb 17, 2017, 5:35:57 AM2/17/17
to smoothiewa...@googlegroups.com
This should be fairly simple to register on some Gcodes and send your own commands.

Beautiful thing about smoothie it's that it's very modular ! Thanks to Arthur !

To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-support+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Triffid Hunter

unread,
Feb 17, 2017, 5:59:32 AM2/17/17
to smoothiewa...@googlegroups.com
There's no way you're gonna get congruent timing over async serial. That's why all the modular serial-bus 3d printer electronics projects have fallen flat.

Having said that, you could concievably take over the debug port and issue gcodes down it from a module you write. I'm not sure how much work it will be to decouple everything from the debug port but I suspect you'll have to touch smoothie's code in several places.

Another possibility is doing soft-serial from a spare GPIO - preferably a PWM pin so you can use the on-chip timers to help with bitstream generation. I don't believe there's any soft-serial code in smoothie at the moment, so that might be the path of greater difficulty.

Do you need to read anything back from your serial controller, or just issue commands and hope for the best?

Nils Kulak

unread,
Feb 17, 2017, 6:19:26 AM2/17/17
to Smoothieware Support
OK, wow, this is great to get started.. Thank you Daniel and Triffid!

1) the exact timing is not super essential and a second delay won't harm in my specific case. It controls the flow of liquids which is anyways delayed and will most likely run for at least 30 seconds or so.

2) to receive information would be nice but not a must have. The other device is very reliable (though the serial might not be). I was thinking to just send the command three times to make sure it got through if I can't receive and double check.

I was also thinking about the debug port or the USB port (I'm sending the g-code via TCP/IP). I think the GPIO option may very well be beyond my abilities.

Again, thank you!
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-support+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Smoothieware Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-support+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

robin bussell

unread,
Feb 17, 2017, 9:12:41 AM2/17/17
to smoothiewa...@googlegroups.com
I'd be inclined to use a small microcontroller with a uart, like an
arduino nano, to monitor a GPIO on smoothie (controlled by the switch
module) and talk to the stepper over serial as necessary.

Cheers,
Robin.
> <javascript:>> wrote:
>
> This should be fairly simple to register on some Gcodes and send
> your own commands.
>
> Beautiful thing about smoothie it's that it's very modular !
> Thanks to Arthur !
>
> On Fri, Feb 17, 2017 at 12:26 PM, Nils Kulak <nils....@gmail.com
> <javascript:>> wrote:
>
> Hi Daniel,
>
> thanks for the very quick reply!
>
> I want to achieve the opposite. The Smoothieboard needs to
> send commands (GCode triggered) to the other device as in
> being the master, not the slave...
>
> Any ideas for that?
>
> Cheers,
>
> Nils
>
>
>
> On Friday, February 17, 2017 at 11:21:55 AM UTC+1, Daniel wrote:
>
> Hi,
> As I know smoothie accepts commands over serial 0. It's
> same as those have been sent over USB.
> It's easy achievable , you just need a rs232 to ttl
> adapter.
>
> Daniel
>
> On Fri, Feb 17, 2017 at 12:13 PM, Nils Kulak
> <nils....@gmail.com> wrote:
>
> Dear community,____
>
>
>
> I'm facing a rather uncommon problem and I've been
> trying to find a solution here but wasn't successful
> so far. I need to tell a RS232 controlled stepper
> what to do (as a master). It takes serial commands
> like "GO01" to move to a predefined position 01 or
> "CP" to return the current position. I would very
> much like to set it in the G-code as it needs to be
> timed with the rest of the movements.____
>
>
>
> Am I thinking in the right direction to possibly
> include the commands as a M117 and try to parse the
> output through UART (via TTL-RS232 adapter)? Or
> could you think of a smoother solution?____
>
>
>
> Thank you in advance and any kind of idea is very
> much appreciated!____
>
>
> All the best,
>
>
>
> Nils____
>
> --
> You received this message because you are subscribed
> to the Google Groups "Smoothieware Support" group.
> To unsubscribe from this group and stop receiving
> emails from it, send an email to
> smoothieware-sup...@googlegroups.com.
> For more options, visit
> https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "Smoothieware Support" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> smoothieware-sup...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "Smoothieware Support" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to
> smoothieware-sup...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Smoothieware Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to smoothieware-sup...@googlegroups.com
> <mailto:smoothieware-sup...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages