RS232 Spindle control

More
28 Apr 2019 12:46 #132172 by Mike_Eitel
Replied by Mike_Eitel on topic RS232 Spindle control
Yes rodw, but there can be crazy effects. I've got made complex development around special developed atmel based Linux embedded systems. They do: tty and rs485; 3964r plus modbus, simple plc, SMTP messaging, webserver, multiple ethernet with complex natting plus multiple vpns, and some other minor of my crazy ideas. Lot of that written in python. And the real pain always starts when we were forced to change Linux version.
More than once we found that python had his own way of understanding. Especially when you are near to the os.
Me personally, I do not code a lot anymore, and I do not care the language, but if then I prefere iec61131. Or of it is simple avr, I love Mark Albert's compiler Bascom.
Mike
The following user(s) said Thank You: rodw

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

More
28 Apr 2019 13:46 #132176 by Tower
Replied by Tower on topic RS232 Spindle control

Hi tower. I completely agree with your way.
Have never read that doc. ;-( Will keep it in mind if I ever want to do something unusual.

Yeah, reading the docs tends to be fundamental when trying to solve problems. But I also started studying source codes (of Machinekit) first and it was infinite loop of Go to definitions and I have seen this 50 Go to definitions ago, what does this do again, so I get you.

It's really what I would call a starter. Unhazels all kind of real-time problems.

And I also agree to your not very positive judgment towards python. A language that does not force you to make declarations is bitting you sooner or later ;-)
Mike


Python has huge problems, the versioning is complete (...obscene and profane expletive...). But for this, it is the right tool for the job. With the existence of HAL bindings library and the Serial communication library, it will make the task easier.

The task doesn't look that hard, it should be doable even for a beginner (in a week or so). A nice introduction to problem-solving machine setup.

Yes, I'm much more comfortable with C, but with Python you can get done in 50-100 lines in Python can take over 1000 in C. Particularly if you start playing with API's out there on cloud based systems.


That doesn't really matter. What matter is access to general functionality ready-made libraries with the right licenses. In the aerospace field, where one cannot use non-in-house library even if it is completely free and open, you won't do it in 50 lines even if you stood on your head.

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

More
28 Apr 2019 13:53 #132177 by Tower
Replied by Tower on topic RS232 Spindle control

The easiest would be to energize a relay on spindle on and send that into an arduino.
Use the arduino with a pot to set speed and have arduino send out rs232 message depending on where the pot is set at or even a switch with preset speeds 10 for example. Surely you don't need that much rpm control, its just a drilling machine unless you want to use it for something else.

What I don't understand is how it can be easier? You still have to implement the serial communication protocol, but this time on Arduino. And then you have to implement the digital input, the potentiometer input and transformation function for resistance-to-speed, error digital output for communication error and maybe more.

Who cares if you have to go to Germany before heading back to France. You will get there either way.


Well, if you are on foot (you have to program all of it yourself), then I would care.

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

More
29 Apr 2019 07:09 #132248 by marq_torque
Replied by marq_torque on topic RS232 Spindle control
After reading all, i find 232 communication little difficult compared to ghetto 0-10v to rs232 converter. I m in persuit of finding a friend can help me with Arduino or micro controller, also digging if i can do anything in hal and python

Thanks everyone for your inputs
Ankit

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

More
29 Apr 2019 08:40 #132255 by pl7i92
Replied by pl7i92 on topic RS232 Spindle control
the spindle is 110V and got the standard UVW
so there is a pretty good chance that all the standard VFD can run it

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

More
29 Apr 2019 09:06 #132258 by marq_torque
Replied by marq_torque on topic RS232 Spindle control
I tried 3 different VFD with diff VF curve, acc settings, without even turning a single turn its getting Over current error, this spindle looks like BLDC motor to me, atleast it should run for few turns but its not turning at all, and throwing an error

Sir, its 44V 1000HZ spindle.... VFD support team from my country's authorized stockist said we cant go down this low voltage and this high frequency, VFD supply voltage is 240V single phase and output is 1000HZ max

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

More
29 Apr 2019 13:13 #132279 by bevins
Replied by bevins on topic RS232 Spindle control

The easiest would be to energize a relay on spindle on and send that into an arduino.
Use the arduino with a pot to set speed and have arduino send out rs232 message depending on where the pot is set at or even a switch with preset speeds 10 for example. Surely you don't need that much rpm control, its just a drilling machine unless you want to use it for something else.

What I don't understand is how it can be easier? You still have to implement the serial communication protocol, but this time on Arduino. And then you have to implement the digital input, the potentiometer input and transformation function for resistance-to-speed, error digital output for communication error and maybe more.

Who cares if you have to go to Germany before heading back to France. You will get there either way.


Well, if you are on foot (you have to program all of it yourself), then I would care.


Maybe I should have said easier for me. I do not have experience in the areas of linuxcnc this covers, but if it is anything like some of the black holes that no one can explain, sometimes the easiest route would be to do it the fastest way possible. You can get caught up for weeks at a time trying to figure something out when it can be done a different way, maybe not the most efficient way but one that works, why not? I don't know if this is for a customer or for him, but I know what I would do. sometimes a customer doesn't want to wait an extra 2 weeks or maybe months. Just saying.

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

More
29 Aug 2019 00:48 #143511 by marq_torque
Replied by marq_torque on topic RS232 Spindle control
Hello everyone,

After long struggle i am successful to figure out Terminal command from Termite application in windows


A can send start stop signal and speed command in hex format.


Now can someone guide me how to connect python with Ini, Hal files so it can communicate with this driver.


Thanks in advance
Ankit,

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

More
29 Aug 2019 21:54 #143600 by andypugh
Replied by andypugh on topic RS232 Spindle control
Sounds like a job for a Python component.

linuxcnc.org/docs/2.8/html/hal/halmodule.html

Create pins to accept the spindle speed and (potentially) on/off commands, and to supply any data back from the drive that you might get. Then inside the Python code format the command strings and output them to the chosen serial port.

That last bit is a bit handwavey, I haven't tried sending data to the serial port from Python, but the internet can probably help.
www.google.com/search?q=python+linux+serial+example

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

More
26 Nov 2019 19:54 #151315 by ississ
Replied by ississ on topic RS232 Spindle control
Serial communication from python is quite simple (altough I may be a bit late now).

I made a tool changer controller for my lathe with an atmega88 (little brother to atmega 328 used in Arduino). The controller accepts normal Tx and M6 commands on serial line and responds with OK or ERROR (timeouts, etc).
This is driven from linuxcnc/AXIS with a python module.

Just in case someone is interested I'll attach the code as an example.
ini:
[SERIAL_TOOLCHANGE]
# Custom toolchange controller on serial port
SERIAL_PORT                = /dev/ttyS0
SERIAL_SPEED               = 9600
MIN_TOOL                   = 1
MAX_TOOL                   = 8
FAKE_TOOL                  = 9

hal:
loadusr -W /linuxcnc/bin/hal_serialtoolchange
net tool-change-request     iocontrol.0.tool-change       =>  hal_serialtoolchange.change
net tool-change-confirmed   iocontrol.0.tool-changed      <=  hal_serialtoolchange.changed
net tool-number             iocontrol.0.tool-prep-number  =>  hal_serialtoolchange.number
net tool-prepare-loopback   iocontrol.0.tool-prepare      =>  iocontrol.0.tool-prepared

And the python toolchange controller (.txt added to be able to attach):

File Attachment:

File Name: hal_serial...ange.txt
File Size:9 KB
Attachments:
The following user(s) said Thank You: andypugh, tommylight, kheston

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

Time to create page: 0.092 seconds
Powered by Kunena Forum