584,808 active members*
5,235 visitors online*
Register for free
Login
Page 1 of 3 123
Results 1 to 20 of 41
  1. #1
    Join Date
    Apr 2013
    Posts
    1788

    Linux help needed

    I have an Arduino Leonardo based keyboard emulator that identifies as an HID device and I am able to enter shortcuts for CycleStart, Pause and Reset. It has worked perfectly for years.

    I have recently created an Arduino Leonardo based clone of a Tormach SmartCool. After adding the appropriate entry to dev/udev/rules.d (SUBSYSTEMS=="usb", KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", SYMLINK+="zbot_schnozz", GROUP="dialout", MODE="0666") it is recognized by PathPilot and seems to work perfectly.

    All is good until I plug in the Arduino based keyboard emulator and the SmartCool stops working. I assume that the problem is related to having two devices with the same VID/PID (2341/8036). What is the solution?

  2. #2
    Join Date
    May 2015
    Posts
    684

    Re: Linux help needed

    I don't understand why you would bother to use custom hardware that introduces an additional level of complexity with a keyboard emulator that is not real time when the features you want can be done in HAL with just two input pins. Slightly different but here is run/step pause/resume with a couple of warning lights thrown in for good measure!
    https://youtu.be/5NYhmYO4mCs
    Rod Webster
    www.vehiclemods.net.au

  3. #3
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    Quote Originally Posted by rodw View Post
    I don't understand why you would bother to use custom hardware that introduces an additional level of complexity with a keyboard emulator that is not real time when the features you want can be done in HAL with just two input pins. Slightly different but here is run/step pause/resume with a couple of warning lights thrown in for good measure!
    https://youtu.be/5NYhmYO4mCs
    Thanks for the information; I may do something similar. But seriously, CycleStart doesn't really require "real time" response! A keyboard emulator is trivial to program and means that *NO* changes to PP are required. It just worked until now. I'd rather make parts than have to re-apply changes after every PP update or be concerned that I have introduced a subtle bug.

  4. #4
    Join Date
    Nov 2012
    Posts
    591

    Re: Linux help needed

    You should be able to set the Arduino VID/PID using some define in the sketch.

    Personally, I use Teensy controllers instead of the Leonardos, as I find their software vastly better than the Arduino ecosystem. Arduino is pretty much the blind leading the blind :-(

    As for "why emulate a keyboard?" I agree with the answer: It's plug-and-play, and doesn't need any changes when a new version comes around. Mine sends Alt-R for green button, space for yellow button, and ESC for red button. Works well for what I need it for!

  5. #5
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    I need to redo my keyboard emulator box to include alt-U/alt-D to adjust the SmartCool so maybe I'll use a Teensy this time. How does one change the VID/PID for a Teensy?

    I've used the Arduino IDE for Teensy but what is your environment of choice? As a hobbyist a major advantage of Arduino vs Teensy is cost. A Teensy is nice but I can get a NanoV3 from China for cdn$3.00 (delivered, no tax, no duty) while a Teensy LC is cdn$24.99 + tax. It is nice to put something together and not bother to salvage the components.

  6. #6
    Join Date
    Nov 2012
    Posts
    591

    Re: Linux help needed

    Regarding VID/PID, the internets say:

    The Teensy LC is part of the teensy3 folder in the core files, the relevant file to change is /teensy/avr/cores/teensy3/usb_desc.h you just have to scroll down to whichever interface you are trying to change and set it there.
    Regarding cost: If you believe that the Arduino folks themselves deserve or need no money from you, and the subsidy of the Chinese postal service and skirting of your own Canadian rules is OK, then buying clones from China is of course cheaper! Compared to even a single cutter, the cost of a Teensy LC direct from PJRC seems insignificant. I think the step up in quality with the Teensy line is well worth the money. You may of course have a different opinion :-)

    https://www.pjrc.com/teensy/teensyLC.html -- $11.65, plus $3.83 US mail shipping. Dunno if that's also good for Canada.

  7. #7
    Join Date
    Mar 2020
    Posts
    218

    Re: Linux help needed

    I'm utterly useless with respect to the original question but is there any chance you'd be willing to share the commands from pathpilot to the smart cool? I can write my own program to parse and react but going through some of the other threads here on the subject, the last I read was you were looking into what actually got sent on the USB line but hadn't figured that out yet.

  8. #8
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    I don't have the protocol documented other than in my notes. However, I have attached the relevant Python module from Tormach (it is Copyright GPL so it should be OK to post). I renamed the file from .PY to .TXT to allow uploading.

    A brief summary of the protocol:
    PP sends a message to the SmartCool for every change in aim and to turn the air blast ON/OFF. The "WS00010030xxxx" command sets the angle. The "2+" and "2-" commands control the air blast. To recognize a SmartCool, the reply to a "VE" command must contain "Z-Bot SCHNOZZ". There are a number of other variations of the "WS0001" command to configure the Dynamaxil servo but I believe that they can be safely ignored. PP expects the SmartCool to send an acknowledgement of ".\r\n" after each message but it retries if nothing is received.

    If you examine the Tormach code I would appreciate any comments on the lines:
    #high school geometry
    central_angle = math.degrees(math.atan((length + self.V_MOUNT_DISTANCE+self.vertical_adjustment)/self.H_MOUNT_DISTANCE)) # center slot computation
    offset_angle = math.degrees(math.atan(self.S_DELTA_DISTANCE/math.sqrt(length**2 + self.H_MOUNT_DISTANCE**2)))
    They appear to miscalculate the offset_angle which results in an aiming error. I would appreciate a confirmation of the problem from any users of a real SmartCool before I report it to Tormach!

  9. #9
    Join Date
    Mar 2020
    Posts
    218

    Re: Linux help needed

    Much appreciated. Perhaps a "smartcool" will be in my future sooner than anticipated.

    Regarding your questions on the math, the horizontal and vertical distances are defined in the HAL but the adjustment is preset to 0 with the comment that the user will set that. If you had aiming issues I would be curious of the following:

    Are your horizontal and vertical mount distances the same as the "real" smartcool?
    Did you set the adjustment value after installation?

    The presence of the adjustment variable and the ability for the user to make changes suggests that tormach expects aiming issues after installation so perhaps thats all you were running into? That said, if your horizontal and vertical distances are not the same as the predefined values, that's going to throw the calculations off no matter what. You might be able to set the adjustment to get one tool length correct but a different length could still be off. I'd have to plot out some points to know if the error ends up being significant but picture a 1" circle and a 10" circle both with a horizontal line from center to the OD. Moving that line by the same degrees in both circles will result in a much larger vertical change in the 10" circle than the 1"

  10. #10
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    I decided to scrap my original SmartCool clone that was based on an RC servo and am now making one using a stepper. I found the jitter in positioning annoying plus a servo is prone to failure of gears/ potentiometer and motor brushes. I suspect that a stepper based one will last longer than I will! BTW, my current plan is to have SmartCools on opposite sides of the spindle so there is some justification for building my own instead of just buying it from Tormach.

    Yes, the plan is to have identical geometry to Tormach's. My current version has an LCD display for the angles and status but no actual nozzle moving part yet. I created a spreadsheet based on the geometry (and verified in CAD) to calculate the angles. My results differ from the Tormach calculated values by as much as 4 degrees with short tools. Consider that Tormach uses a fixed result for offset_angle when it should actually be the atan of a length determined by the sin/cos of central_angle. Or I suppose that I might completely misunderstand things. Corrections welcomed!

  11. #11
    Join Date
    Nov 2012
    Posts
    591

    Re: Linux help needed

    If they use a fixed offset, then yes, they will be off. That being said, that coolant stream isn't exactly precise to the thou :-)

    The innards of the Smart Cool uses a Dynamixel AX-12 servo, which is approximately a souped-up high quality RC servo with better resolution encoder and serial control rather than PWM.

    I think servos can last as long as steppers. Perhaps not the AX-12, which still uses a potentiometer, but any magnet-based one will have the lifetime of the motor. Which in most of these is brushed, though -- ideally, you'd have a brushless motor with solid state drive and contactless magnet encoder, and it'll last for as long as the capacitors in the electronics last :-)
    (The caps are always the first thing to go, if there aren't motor brushes involved.)

  12. #12
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    Jwatte, I agree that an RC Servo with BLDC and magnetic sensor should, other than possibly the gears, have a very long life. Something like the Hitec HSR-M9382 servo would be perfect except for overkill in torque and price (us$185!). Is there a reasonably priced alternative?

  13. #13
    Join Date
    Mar 2020
    Posts
    218

    Re: Linux help needed

    So you're saying as tool length decreases the positional error increases? Put the other way, the longer the tool, the more accurate the positioning?

  14. #14
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    Quote Originally Posted by soofle616 View Post
    So you're saying as tool length decreases the positional error increases? Put the other way, the longer the tool, the more accurate the positioning?
    That is my conclusion but I could easily be wrong. I believe that the error is about 4 degrees with a short tool and as little as 1 degree with a 10 inch long tool. You could always adjust it to be perfect for perhaps a 4 inch tool and the error at the extremes would be reduced. As jwatte mentioned flood coolant is not a tiny stream and wiggle mode further reduces the accuracy requirement.. On the other hand I use a Trico MQL with mostly small short tools so it matters more to me. Besides, I favour over engineering!

  15. #15
    Join Date
    Nov 2012
    Posts
    591

    Re: Linux help needed

    I'm saying there will be probably two points where the position is "exact" and then between those points the position will be slightly off one way, and outside those points, the position will be slightly off the other way. This is what happens when you try to approximate a linear function (length of tool) using a convex function (tangent of rotation angle.)

    This is an illustration. The black line is the "distance" we want to approximate. The orange line is what you get when you turn "distance" linearly into "angle." The red line is the adjustment factor.

    FooPlot | Online graphing calculator and function plotter

    It is possible to calculate the correct angle, using atan2() or some other inverse trigonometric function, if you know the exact geometry, and at that point, you'd get "perfect" aim rather than an approximation. Also, it looks like the SmartCool code does try to do this -- file "configs/tormach_mill/python/hal_zbotschnozz.py" line 285. However they add the two results of calling "atan()" together, which is not correct -- they need to add the offsets on the inside and then call atan() at the end, which may explain why it's not "perfect" and may need some futzing/adjusting.

    Also, the code has so many forks, for simulator/mill/router/lathe. Some of this (other than the UI) probably would be better with a single codebase using variation points where needed, but it is what it is ...

  16. #16
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    Again, I agree. However, it is actually slightly more complicated than you wrote. You need to determine the approximate angle (atan(hoff/voff)), calculate the rotation offset based on that angle, add the two offsets, and repeat since an analytic solution is not obvious to me (but is probably obvious to one more skilled!). The second iteration gets to within a small fraction of a degree of the right answer. Not wishing to modify PP I have addressed the problem by adding a linear fudge in my code and the results agree with my spreadsheet to less than a degree.

  17. #17
    Join Date
    Dec 2008
    Posts
    740

    Re: Linux help needed

    I hate threads like this they get me interested in topics that I should leave well alone. I considered creating a SmartCool clone some time ago and decided it wasn't the solution I was looking for… but now I think, with some modification, it could be quite useful.
    Do you normally track the tool tip or Z-Zero?

    Regarding the calculation:
    Quote Originally Posted by kstrauss View Post
    If you examine the Tormach code I would appreciate any comments on the lines:
    #high school geometry
    central_angle = math.degrees(math.atan((length + self.V_MOUNT_DISTANCE+self.vertical_adjustment)/self.H_MOUNT_DISTANCE)) # center slot computation
    offset_angle = math.degrees(math.atan(self.S_DELTA_DISTANCE/math.sqrt(length**2 + self.H_MOUNT_DISTANCE**2)))
    They appear to miscalculate the offset_angle which results in an aiming error. I would appreciate a confirmation of the problem from any users of a real SmartCool before I report it to Tormach!
    The calculation of the central_angle uses the sum of 3 height values:
    (length + self.V_MOUNT_DISTANCE+self.vertical_adjustment)
    but the offset_angle uses only the square of the length parameter.

    Assuming I understand the meaning of all these parameters in the offset_angle calculation I would replace:
    length**2
    by:
    (length + self.V_MOUNT_DISTANCE+self.vertical_adjustment)**2

    and also replace atan() with asin().

    Step

  18. #18
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    Quote Originally Posted by TurboStep View Post
    I hate threads like this they get me interested in topics that I should leave well alone. I considered creating a SmartCool clone some time ago and decided it wasn't the solution I was looking for… but now I think, with some modification, it could be quite useful.
    Do you normally track the tool tip or Z-Zero?
    Step
    I`m intrigued. What modification(s) do you think would be useful?

    What is best to track probably depends on the type of tool being used. Tracking the tip of a drill seems useless so follow Z0. For an endmill a wiggle between Z0 and the
    tool tip should work well but I don't believe that is an option.

  19. #19
    Join Date
    Dec 2008
    Posts
    740

    Re: Linux help needed

    Quote Originally Posted by kstrauss View Post
    I`m intrigued. What modification(s) do you think would be useful?

    What is best to track probably depends on the type of tool being used. Tracking the tip of a drill seems useless so follow Z0. For an endmill a wiggle between Z0 and the
    tool tip should work well but I don't believe that is an option.
    Well you've already guessed the first change - to oscillate between the tool tip and Z0. There's the easy way and the "correct" way but both require changes to at least the hal_zbotschnozz.py file (the correct way obviously requires more).
    I don't use flood and I find the ends of the nozzles to be too far away from the cut for a fogbuster or air blast. I may be very wrong but I suspect this distance is necessary in order for the slave SmartCool on the left side to clear the ATC. I would perhaps prefer a different geometry but I've only just started thinking about that.
    Using two opposing SmartCool nozzles (one left and one right) the airflows will also oppose each other and partially cancel. Combined with their comparatively limited chip clearing capability and their distance to the cut I wouldn't expect them to be very effective (perhaps I'm just too pessimistic?). Do you have any experience with this?
    Step

  20. #20
    Join Date
    Apr 2013
    Posts
    1788

    Re: Linux help needed

    No experience but lots of thoughts <G>!
    I didn't realize that a slave nozzle assembly was available. Perhaps I missed it but I don't believe that it is mentioned in the installation manual. Also Tormach goes to considerable effort to relocate the coolant feed. That said, Tormach does call their current product "Single Unit Control Module" so maybe a dual version is planned. Certainly a dual could be implemented without PP changes if the two sets of nozzles are properly aligned. That is my current plan.

    I believe that I earlier mentioned that I use a Trico MQL unit rather than flood so I have the same problem. Having the nozzle far from the tool is a problem both for best application of coolant and the best use of air to clear chips. It would be great if the nozzle could extend/retract to be near the cutting area. This would not require PP changes but it seems mechanically problematic. I've also been looking at how to best deliver a low-turbulence air blast at a distance. There are a number of patented designs but I haven't yet done any actual tests.

    I agree that directly opposing nozzles may be less effective than two at right angles or even three nozzles 120 degrees apart.

    Any comments or suggestions gratefully received!

Page 1 of 3 123

Similar Threads

  1. new to linux- where exactly is LINUX CNC located in the computer?
    By js412000 in forum LinuxCNC (formerly EMC2)
    Replies: 4
    Last Post: 03-03-2014, 11:00 PM
  2. Help Needed replacing corrupt Centroid M-400 Linux Flash Card
    By RDOpp in forum Uncategorised MetalWorking Machines
    Replies: 0
    Last Post: 12-11-2013, 05:30 PM
  3. Linux/EMC file conversion help needed
    By raytor in forum LinuxCNC (formerly EMC2)
    Replies: 1
    Last Post: 04-26-2005, 05:32 PM
  4. New help needed PLZ !! BDI Linux
    By k-linkz in forum LinuxCNC (formerly EMC2)
    Replies: 1
    Last Post: 03-18-2005, 08:13 AM
  5. BDI Linux
    By ynneb in forum LinuxCNC (formerly EMC2)
    Replies: 16
    Last Post: 08-03-2004, 10:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •