what to do with this 3+ axis dental cnc machine - Page 3

Page 3 of 4 FirstFirst 1234 LastLast
Results 25 to 36 of 39

Thread: what to do with this 3+ axis dental cnc machine

  1. #25
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    Your outline of your chip selection process was very helpful..I mean I am still terrible at it, but at least that process minimizes my frustration. I have started building the circuit, got most of the basics done (pwr connections, oscillator, ect)

    I was just starting to work out the 5->3.3 voltage dividers when I remembered the encoder signal goes straight into the driver. So i popped open the data sheet, confirming those signals do go into the driver. Now there are internal connections between the original computer & the driver rack, so maybe its just a passthrough.... Then looking at the block diagram (see page 14), there are several indications of +-12v. And on page 16(pinout), there are two pins labeled +-12v OUT. (Other where refereed to as AUX voltage). Thought these might be the Monitors (I & N), but those are separate outputs on the pin out. I am have a bit of trouble understanding the flow and what is happening, but I think there is at least a chance that driver itself was handling the PID. From the block diagram, we see the encoders go into Frequency -> voltage converter (not familiar with those) and then become -Tacho input. All I can work out for sure is that the driver itself was doing SOMETHING with the encoder signals....Can you shed some light as to what is happening there?

    the encoders have A, B and I outputs (as well as there inverted compliments). The "I" channel is just 1 div / rotation. The driver does not seem to use this (or even bring it in as an input), but in theory, this sounds like a useful feature to ensure there were no missed divisions on the encoder. But theory doesn't always match up to practical applications, and I have no experience with that. So I turn to you for advice.


    re: programming header - how does this connect to the computer? Its been a long time since I have tried anything with that, but I recall making a header -> serial cable. So do I need to buy / make a cable for this? And then what software to flash the chip (i think atmel studio? ) Then once the bootloader is flashed, I can upload sketches through usb like a normal arduino? Also curious what you write code in? The arduino IDE is cute, simple & great for beginners...but kind of useless for building sizeable projects. I had switched to Sloeber, which is built inside eclipse. I went with it because I knew the interface a little bit from some JAVA programing I did. So what do you recommend?



  2. #26
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    but I think there is at least a chance that driver itself was handling the PID.
    The datasheet doesn't indicate that it can do that.

    From the datasheet:

    Four modes can be selected by DIP switches on the board:
    * Speed control using tacho signals
    * Speed control using encoder signals
    * IxR compensated speed control
    * Torque or current control
    So, it looks like that it can control how fast the motor is turning, but not where it's going to - that would have to come from someplace else; in this case that will be coming from the board you are designing now. For the system as you found it from the surplus dealer, I think it was coming from the embedded PC; and getting turned into an analog voltage on that big proprietary board.

    All I can work out for sure is that the driver itself was doing SOMETHING with the encoder signals....Can you shed some light as to what is happening there?
    I would expect for the encoder signals to go to at least two places (in no particular order): the Maxon ADS_E 50/5 servo amplifiers (used to determine the velocity of the motor and make it match the input control signal); and that proprietary board. On the proprietary board, I would expect it to go thru the RS422 receiver (which converts it from differential signals - A and A', B and B' - to standard single ended TTL); and then into the MAC4124 quadrature decoder chip (which decodes the signal and maintains a 24 bit counter, for tracking the position of the machine axis in question). The MAC4124 chip should then be read by the embedded PC; and that value is used along with the commanded target position (received from the external PC, presumably) to generate the PID value.

    Re: I input.

    This is useful for two things: double-checking for lost position and doing a precise homing operation.

    However, the way quadrature inputs work, they are fairly noise resistant - if a single line toggles back and forth, it's interpreted as the axis moving one way and then back in the opposite direction by a single step. In order to get out of position; the noise has to match a full quadrature cycle.

    Doing a precise homing operation is accomplished by backing into a limit switch, and then moving forwards until the I line toggles; you then know exactly where you are to within the precision of your encoder.

    I would allocate an input on the PCB for reading the I signal; but I wouldn't worry about actually writing the code to use it initially - I'd get the machine moving properly first. I would also allocate an output to send the I signal back to Grbl (perhaps just a pass-through buffer), along with an error signal to send back if/when you implement an error watchdog.

    re: programming header - how does this connect to the computer?
    With a programming adapter. I use an AtmelICE; but I got it back before the Microchip<->Atmel merger... they're a little $pendy now.

    At least according to this: https://forum.arduino.cc/index.php?topic=532385.0 the Segger JLink Mini Edu is supposed to work also... and it's only $18: https://shop-us.segger.com/J_Link_ED..._p/8.08.91.htm

    And then what software to flash the chip (i think atmel studio? )
    Depending on the programmer you end up with, it may need a command-line utility; or it may also be directly supported by the Arduino IDE.

    Then once the bootloader is flashed, I can upload sketches through usb like a normal arduino?
    That's the idea.

    Also curious what you write code in?
    Xcode and BBEdit - but that's because I primarily work on a Mac.

    The arduino IDE is cute, simple & great for beginners...but kind of useless for building sizeable projects.
    I just use it as a front-end for the compiler - it's convenient and mostly self-contained (and a whole lot smaller to download than Atmel Studio). Also, I can say to people "Just download the Arduino IDE; download the .zip from github, open the .ino, select your board's serial port, and hit 'Upload'".

    I had switched to Sloeber, which is built inside eclipse. I went with it because I knew the interface a little bit from some JAVA programing I did. So what do you recommend?
    I recommend that you use what you're most comfortable with. For this project; it should be small enough to do in the Arduino IDE itself; but if you have favorite editor go right ahead and use that.

    Owing to the fact that you can't really put a breakpoint in and run a debugger without having everything literally crash (real-time process and all) an IDE for this basically boils down to a text editor and a method for doing the build-upload cycle... so the exact choice isn't as big of a deal as it is when doing conventional desktop or server programming.



  3. #27
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    The datasheet doesn't indicate that it can do that.
    just wishful thinking on my part I guess.

    the noise has to match a full quadrature cycle.
    that's interesting and useful. as well as the precise homing method, I assume that only works with non-contact systems that have room for you to go beyond the switch? I have hall effect end stops, so not a problem, just curious.

    -So we got 3 lines coming into samd21 from the encoder A, B & I. They need to be voltage shifted down to 3.3v, was going to do this with a simple voltage divider, but I also want to optically isolate everything. In the past I have used optoisolators to up logic level signals to drive power mosfets (5v ardunio out -> 10v needed for mosfet). Any reason I cannot do the same to drop the voltage to 3.3v?

    -does usb run on 3.3v? i know V+ from the computer is 5V, so that definitively needs to be routed in through the voltage regulator, probably having a common input from the dc jack- will that be ok when usb is connected and power supply? and then I need to divide the data lines to drop to 3.3v right? and ground is ground.

    -the motor driver has an (2) aux outs of +-12vdc --should that be used as the power supply to create the analog control signals (ie the rails of the op amps)? kinda seems like what its there for. or if the reason for the op amp was to create the virtual ground, and I already have +12 & -12v, could I not use NPN's on the +side and PNP on the -side? Even if its not advisable to use the aux outs of the driver, I am likely going to use an atx ps to power the controls, I will have -12 & +12 from there.

    -and now the question that is causing me the most concern: why are there two analog control signals (both -10 to 1+0) ? It SEEMS like you only NEED 1, if its negative spins one way, positive goes the other. I have to assume there is some advantage or intended method for using a differential amplifier on two "set values"? I just cannot envision a strategy for producing these signals, specifically the amplitude. I get that if setpt1 < setpt2 is will go a certain direction, but lets set setpt1 =0v and setpt2=5v...how does the driver act differently with sept1=0, setpt2=10v ? Does that up the output voltage resulting in a faster movement proportional to the change in difference? So then would setpoints(0,10) produce the same movement as (-10, 0). If so, what sort of logic could be used to determine those values? I am usually pretty good at the big picture stragies, but this one has me dumbfounded at the moment. This is a growing concern as this logic greatly determine accuracy & responsiveness (along with PID tuning).

    And while we are at it, is there a PID library you recommend? I have used a few different ones in the past, not in love with any of them, so watcha got?

    --the motor driver has current monitor outputs +- 10vdc, how do I read that back into adrunio so that information is available (dealing with the <0V side of that)?

    I would also allocate an output to send the I signal back to Grbl (perhaps just a pass-through buffer), along with an error signal to send back if/when you implement an error watchdog.
    -that brings up some communication questions I had: is the intent to set up the axis boards such that GRBL on the main control board treats it like a stepper driver with a step & direction pin? (vs. using SPI or something to talk board ->board)

    -does GRBL have anything built in for closed loop systems? Mostly curious about error handling....for example if steps are missed, can GRBL make adjustments to catch up?

    -burning bootloaders --a quick search showed an option of using an arduino as the programmer. I have only seen that for avr arduinos, not sure if it would work for the samd21. I have some arduinos laying around, is that worth a try? Others use a qfp48 test socket (not sure how that connects to a computer)--I like the idea of being able to test / burn the bootloader before I solder (since this work is a bit more fine than what I am used to).


    re:IDE --i hear ya, back in the day I wrote plenty of c in notepad. What I like about eclipse(which also is just a front end for the arduino compiler) is mostly the interface-setup very much like windows explorer, files open in tabs kinda of like ardunio, except only the ones you want are open & they can be re ordered (two of my pet peeves about arduinoIDE). It also has some nice features like being able to view the code for a function by hovering over the function call without navigating to a different window. One thing that sucks about it is file paths...it doesn't like spaces in folder names or [ ] which i use a lot bring common use folders to the top of the list. and fyi, there is a OSX version too, you might want to check it out.

    Thanks again for all your help, I get more out of reading a few paragraphs from you than I do from reading for hours! Hope ya had a nice weekend (i got 6" of snow in chicago)!

    Last edited by mtraven; 11-04-2019 at 01:03 AM. Reason: revised section about usb


  4. #28
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    worked out a bit of the logic...all of this is predicated on grbl doing all the motion planning and spits out a step & direction signal. And I am just going to refer to 1 output signal(from samd) for now. I am lost on why the drivers have two inputs that both go from -10 -> +10. It all makes sense to me if you have 2 inputs, both >0V, one cw, one cww || 1 inputs that goes from -10 to +10v where <0 is cw and > 0 is ccw. And, if I understand correctly, those inputs are set up as differential op amp. Meaning the driver will amplify the difference between setpt1 & setpt2. I am sure I am missing the reason this is set up this way.

    So we have step & direction, a third piece of information can be derived from the rate of step pulses, call is pulse rate. In my previous post, I wasn't sure where the information to determine amplitude would come from and that's it. So I can keep a short history of pulse rates and determine how fast grbl is telling it to move. The length of that history (or maybe buffer?) could have some tuneable parameters to fine tune this translation.


    as I was typing this I realized there is an alternative method of deriving the amplitude of the output signal: That would be to track real position (encoders) vs instructed position (grbl step/dir signals) and use the difference to scale the output signal, + or - would correspond to CW & CCW. This seems simpler, perhaps using a combination of pulse rate & position differential to generate the analog outputs. Still haven't worked out the specifics of how and where the PID loop fits in. I'm not stuck, just starting to think about it right now...i think I am going to find that its input will be real position, setpoint = instructed position, output= ???? (here is where I get lost....how do I derive 2 +-10 analog signals from this) But if I can work out that last part, the pulse rate will be inherent in the position differential (ie faster pulses will cause greater diff, that drives motor faster).


    edit add on -- just can across some reading on differential input servo drivers....it seems this is to combat "common mode voltage" and thus one of the signals is a reference. I think I am still correct about there being redundant inputs that produce the same outputs, but now that I see there is a reason for it, I can sleep well tonight and probably game out the rest of my strategy tomorrow.

    Last edited by mtraven; 11-05-2019 at 05:29 AM.


  5. #29
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    as well as the precise homing method, I assume that only works with non-contact systems that have room for you to go beyond the switch?
    Actually, no - you don't have to go past the switch, you just go up to it; and now you know that you are in "rotation zero" of the ballscrew. Then, go forwards (away from the switch) until the I signal toggles. Then set the master machine position variable to some preset value that takes into account how far you typically have to move away from the switch - so, for example, if you have 10mm/turn ballscrews (just to pick a round number), and you know that the I signal toggles about a half a turn from where the switch toggles; you might set the machine position to +4mm (half a turn's worth of distance minus a mm to give it some "air" before it hits the switch when you tell it to go to position 0.000).

    -So we got 3 lines coming into samd21 from the encoder A, B & I.
    For software efficiency reasons, I'm going to suggest that the A and B inputs be on adjacent bits in the same IO port. PA06 (SAMD21G pin 11, Arduino pin 8) and PA07 (SAMD21G pin 12, Arduino pin 9) look like good candidates.

    The are three reasons that come to mind why you might not be able to use any specific optoisolator in this application; but with care in part selection that may be overcome. 1: The encoder's outputs need to be able to drive the LED in the optoisolator as well as anything else hooked up to them (or you need to put a buffer of some sort in front of it - perhaps a RS422 receiver that gets it's power and ground from the same supply as the encoder?). 2: Speed of the optoisolator - some of them are quite slow, so make sure you pick one that's fast enough to handle the encoder's output frequency. 3: Probably obvious, but some optoisolators require 5 volts on the output side to operate, so do make sure that it works at 3.3v.

    For clean edges, I would probably be looking for a logic-output optoisolator (i.e, one that has internal signal condition circuitry and a push-pull output); and not a simple phototransistor or photodiode output.

    -does usb run on 3.3v? i know V+ from the computer is 5V, so that definitively needs to be routed in through the voltage regulator, probably having a common input from the dc jack- will that be ok when usb is connected and power supply?
    Put a diode in between the USB +5v line and the power-input on the PCB. That will keep the board from back-feeding the USB port.

    and then I need to divide the data lines to drop to 3.3v right? and ground is ground.
    No, you don't need to do anything with the USB lines; they go directly into the SAMD21.

    On the Arduino schematics, there's some diodes that connect to the D+ and D- lines. These are just ESD protection diodes; they don't otherwise affect the signal. It's possible to do without them, but of course, better to have them.


    -the motor driver has an (2) aux outs of +-12vdc --should that be used as the power supply to create the analog control signals?
    I think that would be a good idea. I've had another look at the datasheet for the ADS_E drivers; and I'm thinking that instead of a virtual ground; a level shifting amplifier pair is a better idea (there's probably a formal name for this, but I dunno what it is). One reason is that I can't find a spec for common-mode voltage tolerance on the inputs to the ADS_E drivers... so I'm trying to come as close to what the data sheet shows in the minimum configuration section.

    I've attached two schematics for an opamp configuration that should do what's desired.... well, at least iCircuit says so.

    One has a voltage regulator shown in it, the other doesn't - the voltage regulator is to smooth out any noise in the -12v supply coming from the ADS_E board. If that voltage is relatively clean; a simple capacitor on the PCB between -12v and ground may be sufficient.

    could I not use NPN's on the +side and PNP on the -side?
    Yes, you could build it out of discreet parts, but given the above situation (and the need to isolate the DAC from the voltage shifting and amplification stages) I think you will wind up with more devices on the PCB that way; going the opamp route you just need a LM324, a handfull of resistors, and a trimmer to fine tune it.

    Even if its not advisable to use the aux outs of the driver, I am likely going to use an atx ps to power the controls, I will have -12 & +12 from there.
    That would work also; just make sure the whole thing has a common ground. Actually, there's that embedded PC in there... so... does it already have a suitable power supply (ATX or something like it)?

    -and now the question that is causing me the most concern: why are there two analog control signals (both -10 to 1+0) ? It SEEMS like you only NEED 1, if its negative spins one way, positive goes the other.
    Yes, you only need one signal... but...

    I have to assume there is some advantage or intended method for using a differential amplifier on two "set values"?
    Sort of. The reason this is usually done is for noise and ground loop rejection. If you send a voltage and it's inverse (or even just a reference ground) down a pair of wires in the same bundle (preferably a twisted pair) any electromagnetic interference will tend to affect both wires the same; so that the result is they both move up and down in voltage from the noise in unison, and the differential voltage is unaffected.

    but lets set setpt1 =0v and setpt2=5v...how does the driver act differently with sept1=0, setpt2=10v ?
    For the case of setpt1=0v and setpt2=5v, the differential (setpt2 - setpt1) is +5v; so the driver will spin the motor at 50% of the maximum speed that it can.

    For the case of setpt1=0v and setpt2=10v, the differential (setpt2 - setpt1) is +10v; so the driver will spin the motor at the full maximum speed that it can.

    If you have a case of setpt1=7v and setpt2=3v then you will get a differential of -4v; and the driver will spin the motor backwards at 40% of maximum speed.

    Does that up the output voltage resulting in a faster movement proportional to the change in difference?
    Yes.

    So then would setpoints(0,10) produce the same movement as (-10, 0).
    Yes.

    If so, what sort of logic could be used to determine those values?
    Assuming that by "logic" you mean how to convert from the desired velocity as a value in a variable in the software to the voltages that go into the Maxon ADS_E boards; half of the work would be done by setting the DAC on the SAMD21 to velocity+512, where velocity is a signed integer in the range of -512 to +511. The other half of the work is performed by the opamp.

    This is a growing concern as this logic greatly determine accuracy & responsiveness (along with PID tuning).
    Actually, no - the accuracy and responsiveness is principally a function of the update rate of the system, the encoder resolution, the servo amplifier bandwidth & power, and the PID tuning. Unless it's really, really awful, the signal conditioning going from the SAMD21's DAC to the +-10v differential inputs on the Maxon ADS_E servo amplifier boards doesen't play that big of a role - it just has to get approximately the right value to the ADS_E boards (and if it's off a little bit, the PID algorithm will correct for it, just as if it was an external drag on the motor).

    And while we are at it, is there a PID library you recommend? I have used a few different ones in the past, not in love with any of them, so watcha got?
    I don't have any favorite; I would suggest just going with whatever you've had the best luck with in the past.

    --the motor driver has current monitor outputs +- 10vdc, how do I read that back into adrunio so that information is available (dealing with the <0V side of that)?
    You don't need that value to do the PID operation; but if you really want to you could put another opamp on there and shift the voltage up into a range that the analog inputs on the processor can accept.

    -that brings up some communication questions I had: is the intent to set up the axis boards such that GRBL on the main control board treats it like a stepper driver with a step & direction pin?
    That's easiest. Otherwise you're looking at some fairly major modifications to the core motion engine of Grbl.

    -does GRBL have anything built in for closed loop systems? Mostly curious about error handling....for example if steps are missed, can GRBL make adjustments to catch up?
    No, it doesn't, but there should be no missed steps unless you have a rather bad noise problem in the interconnects between the Grbl processor and the SAMD21s, and/or the encoders and the SAMD21s.

    Missed steps from the mechanical side of things would, of course, be taken care of by the PID loop running on the SAMD21.

    -burning bootloaders --a quick search showed an option of using an arduino as the programmer. I have only seen that for avr arduinos, not sure if it would work for the samd21.
    I've only seen that described for a SAMD21 when you have another Arduino Zero with the EDBG chip on it; and you have to hack that Zero up to get at the pins needed to do the bootloader programming. Basically, the idea was to solder some wires onto the EDBG so that it's talking to the external SAMD21, and not the one that came soldered down to the Arduino Zero.

    I think I'd just get the J-link, or something like it.

    Others use a qfp48 test socket (not sure how that connects to a computer)--
    I'm guessing that they had something rigged up to a programmer like an AtmelICE or a J-Link.

    I like the idea of being able to test / burn the bootloader before I solder (since this work is a bit more fine than what I am used to).
    If you have good magnification, and a good soldering station with a nice big tip on it, and pleny of flux, it's actually easier than it looks. There's lots of QFP hand soldering videos on youtube; searching for "drag soldering qfp" gives a bunch of results. The one from Dave Jones (EEVBlog) covers QFPs starting at about 19:20 or so. I get better results than he did because I use paste flux and basically drown the pins in flux; however it is more of a clean-up hassle afterwords to get all the paste off the finished board.



    Re: Eclipse.

    I've had various versions on my machine over the years (typically something will have an IDE that the manufacturer built on top of Eclipse)... compared to BBEdit, it's huge - BBEdit is a ~13mb download; and expands to ~36mb on my drive. Also, I already must have XCode on my machine in order to compile my OS X and iOS software...

    __________________________________________________________________________________________________


    So I can keep a short history of pulse rates and determine how fast grbl is telling it to move.
    The PID function/library should be doing that for you.

    as I was typing this I realized there is an alternative method of deriving the amplitude of the output signal: That would be to track real position (encoders) vs instructed position (grbl step/dir signals) and use the difference to scale the output signal, + or - would correspond to CW & CCW.
    That's the P in PID. P = Proportional.

    the pulse rate will be inherent in the position differential (ie faster pulses will cause greater diff, that drives motor faster).
    That's the idea. The I term combats "following error" (among other things), and D tackles acceleration.

    it seems this is to combat "common mode voltage" and thus one of the signals is a reference.
    Ya know, I should probably read the whole post before writing a response. Um... yeah, that's one reason.

    Attached Thumbnails Attached Thumbnails what to do with this 3+ axis dental cnc machine-vreg-png   what to do with this 3+ axis dental cnc machine-without-vreg-png  


  6. #30
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    -home switch thing was kind of a "duh" moment for me, I just hadn't though it all the way through.

    -you cleared up usb nicley and I think I will include those ESD diodes you suggested

    -ill just get the jlink programmer

    -my history with opto isolators is as follows: Early on(years ago) I burnt out a few arduino boards and they weren't so cheep back then. Since then it has been standard practice for me to isolate all outputs. Never done it on the inputs because that is usually a signal derived from the VCC of the ardunio. Furthermore, I have a LOT of older electronics....I bought the remaining inventory of a out of business radio shop. Lots of older IC's and lots of isolators. It took me a while to realize some (most) were really slow by today's standards and its super hard to know that's your problem without a scope. Any opto isolators I use for this project would be new and specifically selected. Though it seems like you don't think they are required, so maybe I just stick with the divider.

    -current monitor: i know its not part of PID, but I think having access to that information could prove useful. I know on commercial machines, they are able to tell when I tool needs to be changes based on feedback from current sensors on spindle & staging motors. Like the "I" value on the encoders, probably leave it out to begin with, but I still need to plan for that addition.

    For software efficiency reasons, I'm going to suggest that the A and B inputs be on adjacent bits in the same IO port. PA06 (SAMD21G pin 11, Arduino pin 8) and PA07 (SAMD21G pin 12, Arduino pin 9) look like good candidates.
    I am glad you mentioned this, I think I would have gone the other way in spreading them out. As I understand it, it is critical that those signals be read at the same time, I take it that is possible with the pins you recommended. Is the efficiency you are talking about being able to read 1 register with both bits? Step & direction also need to be on interrupts, I take it putting those on adjacent ports is also good idea.

    -seeing you can included schematics put a big smile on my face! I need to study them, I know they look simple, but I really suck at looking at a circuit & discerning what all is happening. No time for that till tonight, but for now I have 2 questions: a) the MC79L06BP voltage regulator is -6V, in my mind that should be -10v, but I am sure I am missing something? b) I need (2) of either circuit you drew, one for each output, correct? Or can I just I have one and then the other line be just a 0V reference..then I would have +-10 to 0. It seems you knew /assumed that a 10V differential represents 100% motor speed....but you have up to 20V differential, so what happens if you run setpts(-10, 10)...if 10V is 100%, that's probably going to error out on the driver or just let the smoke out, right?

    ...setting the DAC on the SAMD21 to velocity+512, where velocity is a signed integer in the range of -512 to +511.
    I am only familiar with analogWrite() on arduino and that has to be 0-255. Previously you taught me that the DAC is fundamentally different than a pwm output on arduino. So my question is, can you just set that to a negative value (ie analogWrite(-255)) ?

    I really enjoy learning from Dave, he taught be all about op amps yesterday! Not watched his soldering tutorial(I will), but I did watch some others and feel a lot more confident about it. I do need some upgrades in tooling, my goto soldering iron is temp controlled, but its just a pot with no feedback and the only tip I have for it is past its prime. I've got a nice one with a bunch of tips and 4 lead aviation connection laying around for a while but no power supply to use it. I think its time to make a power supply for it and put it to use. Its been like a year since I have done any major electronics work, so this will be good for me to get back into the swing of things. Will also provide a good refresher course on PID libraries and tuning.

    on the note of cleaning boards after soldering...I flux the hell out of stuff. I have always used a stiff nylon brush(toothbrush) and isopropyl alcohol (medical / electrical grade -99+%). I scrub it and then use a little syringe of ISO to squirt/rinse. That a decent method? Always been curious if its safe to submerge the entire board in iso? I also have an ultrasonic jewlery cleaner that I have wondered if I could use to clean boards?

    Missed steps from the mechanical side....
    that really what I was talking about...so if it falls behind, the PID will "try harder" to bring it back..i get that now. But since you brought up the missed encoder signals, if setup properly, are there literally NO missed signals? My past experience says definitely not, but this is a whole new system. I was thinking there should be something to tell me it missed an encoder signal and then adjust the position in the sequence such that at the next reading the sequence is corrected.

    feeling quite a bit better about this project now.



  7. #31
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    Any opto isolators I use for this project would be new and specifically selected. Though it seems like you don't think they are required, so maybe I just stick with the divider.
    Check the voltages with respect to the system ground with a multimeter (and on the encoder connections; be sure to rotate the encoder while watching the meter). For protection, you could put some unidirectional TVS (Transient Voltage Suppression) diodes across the inputs if you want. Also, by setting the values of the resistors in the voltage divider high enough, excess current would be limited should a spike occur.

    Re: IO port pins. It's not critical that they be read in the same clock cycle, because the CPU is running so much faster than the maximum rate of the encoder; however, by having them on the same port adjacent to each other the CPU load to read the encoder is cut by about a third, down to one load, two shifts and a bitwise and. Then the bit pattern can be examined and an increment or decrement operation taken on the master position variable.

    Step does need an interrupt, but direction does not need to be on an interrupt; as you can just read that value at the time of the step interrupt (the direction bit is always set by Grbl - or any other CNC, for that matter - before the step bit is toggled).

    Re: the opamp schematics. It's probbably possible to combine some of those stages; but I did it the way I did so that the signal processing proceeded in distinct steps: buffering the SAMD21's DAC output, generating the -1.65v signal to use as an offset for the SAMD21's output (adding a -1.65 volt signal to a 0-3.3v signal will shift it down to be -1.65v to +1.65 volts); doing the actual offset by combining the two voltages, and amplifying the resultant -1.65v to +1.65v up to nearly -10v to +10v.

    Handling the current monitor signal from the Maxon ADS_E drives would proceed in similar manner: buffer the input, scale it down from +10v to -10v with a resistor voltage divider that will output +1.65 volts to -1.65 volts, generate a +1.65 volt offset voltage, and sum that with the scaled down input to shift the signal up to 0 to +3.3v; which can then be fed into an analog input on one of the processors. I'll cook up a schematic that shows what I mean when I get a chance.

    a) the MC79L06BP voltage regulator is -6V, in my mind that should be -10v,
    You need to generate a -1.65 volt signal to use to offset the DAC's output so that instead of it being 0 to 3.3v, it's centered around 0 volts. Given that half of 3.3 is 1.65, and you want to move it down by half of it's range, that's where the -1.65 volts came from.

    Using a resistor voltage divider you can derive that -1.65v signal from anything that's more negative than -1.65v... you just need to pick the right values for the resistor (and/or adjust the trimmer pot to get it dead-on).

    I picked that particular voltage regulator because it was a) cheap, b) DigiKey had about twenty thousand of them in stock when I looked, and c) easy enough to drop in to the circuit (thru-hole TO-92 package, and only the recommended standard stability caps as the other required external components).

    However, any similar voltage regulator can be used; and it doesn't need to be -6v --- you just need to adjust the values of the resistors in the voltage divider accordingly. I would suggest that if a regulator is needed because the -12v supply isn't very clean, that the regulator have a bit more headroom than two volts, so I probably wouldn't pick a -10v regulator; I'd probably go for something in the -5 to -8 range.

    I need (2) of either circuit you drew, one for each output, correct? Or can I just I have one and then the other line be just a 0V reference..then I would have +-10 to 0
    I did this with the intent that it follow the example shown in the Maxon ADS_E datasheet's "minimum wiring" section as close as possible. So... just one per axis card. The other line is a 0v reference (and that's what they are showing in that section - one of the setpoint inputs is tied to the ground terminal on the ADS_E, and the other has a potentiometer going between the +12v and -12v outputs of the ADS_E. Signal-wise, this setup should be comparable to what the datasheet shows.

    It seems you knew /assumed that a 10V differential represents 100% motor speed....but you have up to 20V differential, so what happens if you run setpts(-10, 10)...if 10V is 100%, that's probably going to error out on the driver or just let the smoke out, right?
    That's what the datasheet indicates as the full-range extent of the setpoint inputs. However, I did not find absolute maximum voltage ranges for the inputs. Presumably, at some point something will break and the smoke will escape; but can't seem to find a spec for where that limit is... so, I'm trying to stay conservative in what gets fed to the Maxon drivers (I'm guessing that if they are replaceable, they wouldn't be cheap). I also don't know if the drive will simply saturate at a value that's over 10v differential (i.e, pedal-to-the-metal, so to speak), or if it will trigger an error (or do something weird, like run backwards - some circuit designs will invert their outputs if the valid input range is exceeded).

    I am only familiar with analogWrite() on arduino and that has to be 0-255.
    This switches the Arduino API to allow the full resolution of the hardware:
    https://www.arduino.cc/reference/en/...iteresolution/

    So my question is, can you just set that to a negative value (ie analogWrite(-255)) ?
    No, the ADC API expects an unsigned integer value. After switching the range of AnalogWrite to the full 10 bits, you get the negative values by sending in values less than the half-way point... which is why I said to use velocity+512; at negative velocity values, the result will be less than the 10-bit halfway point; at positive, it will of course be greater than that halfway point. Of course, there's no reason why you couldn't do something like:

    static void inline setVelocity(int32_t velocity) __attribute__((always_inline)) { analogWrite(velocity + 512); }

    ... and just call that from the main PID handling loop.

    I scrub it and then use a little syringe of ISO to squirt/rinse. That a decent method?
    It's close to what I do... except I use a spray bottle full of 99% isopropyl.

    Always been curious if its safe to submerge the entire board in iso?
    Well, as long as a) it's totally dry before powering it up; and b) you don't pass out from the fumes or set yourself on fire... generally speaking, most components don't have a problem with being dunked in isopropyl. Those that do will generally state so in their datasheets and/or have seals on them that say something like "Remove after washing".

    I also have an ultrasonic jewlery cleaner that I have wondered if I could use to clean boards?
    Ultrasonic cleaners are used for cleaning PCBs, but my experience with low-cost jewelry cleaners is that they just don't have the power to do anything much to the gunk on a board. I don't know what you have, exactly, so I don't know how effective yours would be.

    Not a recommendation; just something that I've seen in various places on the internet: https://bransonic.com/
    I've also heard that some people use their electronics cleaner solution to good effect in cheap Chinese cleaners (well, mid-priced; a couple of hundred bucks for one that's got the requisite power & a bath heater).

    if setup properly, are there literally NO missed signals?
    That is the idea. This is basically an extension of how any computer operates internally: if there's a missed signal going from, say, the CPU to RAM, the machine will crash.

    However; it is possible to make an inference for certain combinations of the previous read encoder state, the current state, and the direction that it's moving, such that you can recognize a skipped state and either throw an error or try to correct for it (although I do think I would log the error in a diagnostics counter somewhere so that you would know that you've got an issue).

    FWIW, encoders that have more than just two bits are more noise-immune because there's more "distance" between identical states as the encoder spins, so more missed or spurious states can be handled before the situation becomes too ambiguous to correct for.

    Last edited by __Britt; 11-06-2019 at 01:46 AM. Reason: Typo


  8. #32
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    Check the voltages with respect to the system ground with a multimeter (and on the encoder connections; be sure to rotate the encoder while watching the meter). For protection, you could put some unidirectional TVS (Transient Voltage Suppression) diodes across the inputs if you want. Also, by setting the values of the resistors in the voltage divider high enough, excess current would be limited should a spike occur.
    I will have to put the whole thing, at least the electronics, back together to test it. I was planning on doing that anyways, although I don't have full control of the machine, but I can get it to run its homing sequence. Observing what the stock system was doing will be useful. Wouldn't that be a good place to use my new old scope? And on the voltage divider, your saying if my desired ratio was 2:1 that could be accomplished with a 2k & 1k, but doing it with 20k & 10k or even bigger, will help limit spikes?

    Re: the opamp schematics. It's probably possible to combine some of those stages; but I did it the way I did so that the signal processing proceeded in distinct steps
    personally, I like that, much easier for me to understand. Still need a couple clarifications though. So I know the rail connections are not shown on diagrams, those would go to the +12 and -12v source from the driver correct? Is the ground in you schematic, 0V (the same 0V that provides the reference input)? Also, you had recommended the lm324, I chip I happen to have in inventor. Its a quad opamp, so I just need one of those to do the circuit you drew right?

    *1*
    I'll cook up a schematic that shows what I mean when I get a chance.
    that would be cool, but don't post it just yet. I think you have given me enough for to work it out and I would like to try to do that on my own, but I'm sure i'll need your answer key soon enough.

    output signals: Still a bit perplexed by this, but lets see if I have it right. So one of the inputs is ALWAYS a 0V ground reference, lets call it setpt2. Would that just be a connection to the ground of the arduino? Then setpoint 1 is the result of the circuit you drew, when 0> spins one way, <0 spins the other. That is all determined by the positional feedback PID loop. That sound right to you?
    (I'm guessing that if they are replaceable, they wouldn't be cheap)
    no they are not, saw a few used on ebay for $100. But new, they go for $250-400 each. Kind of mind blowing to me, its just a DC motor driver..so like an H bridge and then current limiting and such. If that happened, I would probably replace with something else, or consider building my own driver. But lets try to avoid that! On the note of these old ass electronics--that embedded pc is listed in many ebay auctions, usually in the $2000-$3000 range! The pc, even in 2003, is rather humble but also very specific. So is this just legacy cost? It would be cool if I could sell that to help fund some more advanced features of this machine.

    with low-cost jewelry cleaners...
    yah that what I have, maybe I will just try using it for the final cleaning, after I have gotten most of the gunk off it.

    I got my sam21d dev board yesterday, damn that samd is small! I was feeling good about soldering after watching videos, but the scale was not quite there in the tutorials. Anyways, the board was $12 and at my front door in 24hours. it seems unlikely that I will be able to buy the components & have the boards printed for less than that, so I am debating whether I should just go with the custom sheild approach. I think I will do that for at least the first one anyways, see how it goes and decide what to do for the others.

    I noticed you use the "XXXnn_t" variable format, I discovered that with my last big arduino project and I very much prefer that.

    I am just curious, are you a teacher or something? You seem very patient and are quite good at explaining. I starred at the schematics you drew for like an hour and gained nothing, then you gave me that nice narrative in your last post and things starting clicking fast.

    My soldering station project has rolled over into another day, so I will finish it tonight and then get going on the prototype axis card.

    Are there any other forums you would recommend to discuss this stuff? I am very thankful to have caught your very knowledgeable eye, but you seem to be the only one.

    Last edited by mtraven; 11-06-2019 at 08:09 PM. Reason: addon *1*


  9. #33
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    And on the voltage divider, your saying if my desired ratio was 2:1 that could be accomplished with a 2k & 1k, but doing it with 20k & 10k or even bigger, will help limit spikes?
    Yes, but it's also possible to go too far with this and not have enough current going thru it to drive the chip's input; and as the current goes down, noise goes up. Also, do keep in mind that the driver that's putting out the voltage is effectively shorted to ground thru the resistors, so you do want to make sure that the total resistance is something that the driver can handle without a problem. It's something of a game of tradeoffs...

    So I know the rail connections are not shown on diagrams, those would go to the +12 and -12v source from the driver correct?
    Yes. Those schematics were from iCircuit, a simulator, and it doesn't model the power supply connections going to the op-amp packages - it just assumes that you have a perfect supply and that the opamp is capable of outputting infinite current. In the real world, power connections and decoupling caps, of course, are required.

    Is the ground in you schematic, 0V (the same 0V that provides the reference input)?
    Yes. The 0v and grounds need to be shared between the SAMD21 and the Maxon drivers; as well as the USB port. Theoretically, the entire system's grounds should be at the same potential; but the usual real-world caveats apply (star grounding where possible, avoiding ground-bounce prone setups, etc).

    Also, you had recommended the lm324, I chip I happen to have in inventor. Its a quad opamp, so I just need one of those to do the circuit you drew right?
    Basically, yes. There are a wide variety of opamps that would work; however that one is reasonably cheap, has the specs needed, and is more-or-less ubiquitous. As opamp applications go, this isn't a terribly demanding one.

    So one of the inputs is ALWAYS a 0V ground reference, lets call it setpt2. Would that just be a connection to the ground of the arduino?
    Yes. Note that the +12v supply, -12v supply, Arduino, and setpt2 must all share a common ground (setpt2 would, of course, be directly connected to that common ground, which leaves setpt1's voltage relative to that common ground - this keeps the whole thing "speaking the same language" so-to-speak).

    Then setpoint 1 is the result of the circuit you drew, when 0> spins one way, <0 spins the other. That is all determined by the positional feedback PID loop. That sound right to you?
    Yes.

    its just a DC motor driver..so like an H bridge and then current limiting and such.
    There's a little more to it than that - it's got it's own internal PID loop that controls the motor's velocity and makes it spin at the commanded rate, regardless of load. It doesn't, however, control the position - if the motor gets knocked out of position, the Maxon driver won't bring it back to where it was; nor can you tell the Maxon driver to "go here". However, if you do have a position-controlling PID loop (such as the one you are building) it's entirely feasible to just have a simple H-bridge doing the power output for the motor - many integrated servo drives are set up that way.

    that embedded pc is listed in many ebay auctions, usually in the $2000-$3000 range! The pc, even in 2003, is rather humble but also very specific. So is this just legacy cost? It would be cool if I could sell that to help fund some more advanced features of this machine.
    Partly legacy cost (including the fact that it fits specific machines & software and will have been certified to work in certain applications); partly ruggedization; partly form-factor.

    I got my sam21d dev board yesterday, damn that samd is small!
    Did your dev board use the QFP or the QFN package? The QFN - with no pins sticking out of it - is considerably smaller than the QFP.

    XXXnn_t
    That's part of the C standard, and the Arduino build system includes it automatically for .ino files... #include <stdint.h>

    Coming from an Objective-C/OS X background, my general preference is to make variables, functions, and (although not relevant for Arduino, as it's an Objective-C thing) selectors camel-case: thisIsAFunction(XXAClass *thisIsAPointerVariable); where XX is replaced with a prefix unique to the library or project from which it came (for example, I have one application called Trace and it's got classes like TrNode, TrSegment, and TrRS274xOutputTarget - Tr is the prefix for the Trace project).

    I am just curious, are you a teacher or something? You seem very patient and are quite good at explaining.
    I've been told I'm good at explaining things... but, no - I'm a software consultant specializing on the Mac and iOS platforms. My CNC and electronics experience is self-taught, and although I've got a fair amount of experience doing it now; I don't consider myself an expert. I answer what I know; but there are areas where I know I'd be hopelessly lost (please don't ask me to design a radio from discrete transistors, and especially don't ask me to do it with a minimum of parts!). I definitely don't consider myself to be equivalent to a degree-ed electrical engineer like Limor Fried (a.k.a LadyAda from AdaFruit).

    Also, please note that offering an opinion is easy; being right about it is more challenging!

    Are there any other forums you would recommend to discuss this stuff?
    EEVBlog forum? https://www.eevblog.com/forum/index.php
    AVRFreaks? https://www.avrfreaks.net/
    StackOverflow? https://stackoverflow.com/
    And of course, there's the Arduino forum: https://forum.arduino.cc/

    but you seem to be the only one.
    I get the feeling that most people here have only gone as far as assembling pre-packaged modules... and not to the level of trying to build their own controllers from parts (not surprising really, though - this is a CNC machining forum, not an electronics engineering forum). I just happen to have an odd set of experiences and interests that intersect here...



  10. #34
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    ....not have enough current going thru it to drive the chip's input;
    thats good to know, and I getting into that ballpark at 10k : 20K or is that more when you get up into mega ohms?
    Basically, yes. There are a wide variety of opamps that would work; however that one is reasonably cheap, has the specs needed, and is more-or-less ubiquitous. As opamp applications go, this isn't a terribly demanding one.
    my question was a bit unclear, I was asking if its ok to take the 3 op amps from the schematic you drew and run then into a single quad op amp chip. Like could that create interference issues or something. I think the answer is its fine, but I just want to confirm.
    it's got it's own internal PID loop
    is this whats picture in the block diagram for the driver? I thought it looked like a PID loop...thats why I was hoping it handled generating the analog input signal. I know thats not what it is doing, but it is a similar looking circuit, no?

    I can see the pins on the samd21, so that makes it a QFN. I am not saying I cant do it and I will at certainly at least try, its just intimidating. That might change when I get my soldering iron station going. My old one is on its last leg and causing me a lot of soldering frustration.

    (not surprising really, though - this is a CNC machining forum,
    yah I really came here looking for more general advice on what to make of the machine...then decided thats not really the firs step, its swapping out the brain. Thanks for the forum recommendations, I will check them out.
    That's part of the C standard, and the Arduino build system includes it automatically for .ino files... #include <stdint.h>
    has it always been? When I learned C back in high school (2002 ish), it was all int, doubles, words, ect. My understanding is that the size of those was not fixed across different architectures. Then when I got into arduino, they were using the same vars. Then last year when I really started studying some of the libraries I used, I can across the _t nomenclature and have used it ever since. Only complaint I have is that int8_t i doesn't roll of the key board as smoothly as int i. From your explained naming system, I think we would be able to read each others code fairly easily. I use camel case as well...its also how I do nearly all file names and I have been doing that pretty much since I started coding. The crazy thing is, before you called it camel case, I have NEVER heard that term before, didn't even cross my mind that there was a term for it!

    re: common grounding --I have some experience with this, both good and bad. I understand the need to have a common reference(ground) voltage, where I have been troubled in the past is when I bring opto isolators into the picture. My question is if you take the ground from the power supply that is supplying power to the output of the opto and connect it to the common system ground, does that not break the optical isolation?
    I get the feeling that most people here have only gone as far as assembling pre-packaged module
    the "why make it when you can just by it type"......I fall more into the "why buy it when you can make it" mindset. More so with mechanical things, but slowly getting there with electronics too.



  11. #35
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    thats good to know, and I getting into that ballpark at 10k : 20K or is that more when you get up into mega ohms?
    That depends on the chip's input, the noise tolerance & environment it's in, and how fast the edges of the signal need to be. Typically, I start taking a second look at things when I'm seeing values over 100k to 200k - but, that's just a rule of thumb for the typical signals that you'd find on an Arduino-like device; it doesn't always apply.

    if its ok to take the 3 op amps from the schematic you drew and run then into a single quad op amp chip. Like could that create interference issues or something. I think the answer is its fine, but I just want to confirm.
    It should be OK; if it's not then I would first suspect things other than in-package interference (like a bad chip, power supply issue, or a particular layout being prone to oscillation - rare, but it can happen). As mentioned earlier, that schematic is from a simulator program; but hasn't been tested on real hardware - but, as you've got the chips, I would suggest rigging it up on a breadboard and playing with it.

    is this whats picture in the block diagram for the driver?
    More-or-less. It might not technically be the classic PID function (I've only skimmed that schematic), but it's got a fair bit of feedback circuitry to it.

    I can see the pins on the samd21, so that makes it a QFN.
    Um... typo?

    Pins = QFP, Quad-Flat-Pack.
    No Pins = QFN, Quad-Flat-No-lead.

    its just intimidating.
    With good magnification, what looks insanely difficult at first is remarkably easier when you actually go to do it. When I first got my stereo microscope, I expected it to help, but I was surprised by just how much it helps. (This is predicated on not having a biological issue such as a neurological tremor in your hands or arms).

    has it always been? When I learned C back in high school (2002 ish), it was all int, doubles, words, ect.
    No, it was first introduced in C99. Beforehand, you had to make your own - which caused a fair number of problems...

    My understanding is that the size of those was not fixed across different architectures.
    It isn't - and that also caused a fair number of problems... which is why stdint.h was created.

    The crazy thing is, before you called it camel case, I have NEVER heard that term before,
    Well, yourVariablesHaveHumpsLikeACamel! ( can't claim to have coined the term - I first encountered it when reading the OS X developer documentation yea many years ago. You know you're getting old when... the machine you cut your teeth on is listed as an 'antique'; and the songs on it - which you can remember when they came out - start getting played on the local classic rock station! )

    My question is if you take the ground from the power supply that is supplying power to the output of the opto and connect it to the common system ground, does that not break the optical isolation?
    Well, it definitely couples the two ground systems. The other end can float about relative to that ground, without necessarily forming a path for current to flow between the two systems (an analogy might be two flashlights with metal cases so that one terminal of the battery connects to the case --- you can touch them together, and then they have a common ground, but no current can flow between the two of them; so even if one runs on, say, 3 volts, and the other runs on 3000 volts, one won't fry the other).

    There's four issues with using optoisolators --- 1: can you drive the LED? 2: can the output of the optoisolator drive the rest of the circuit? 3: do you need the transfer function to be linear (this mostly matters when dealing with analog signals)? and 4: is the optoisolator fast enough for the signal you are trying to send?

    For the encoders, you don't need to worry about item 3; because the signal is either on or off -- so, with proper selection of a suitable component, you probably can use an optoisolator here (item 1 might be a concern, depending on what else the encoder has to drive).

    However, for the signals going to the setpoint inputs of the Maxon ADS_Es, that would pose a significant issue; as you want it to be more-or-less linear in it's transfer of signal (as with most things, there are ways around this, but it gets complicated).



  12. #36
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    215
    Downloads
    0
    Uploads
    0

    Default Re: what to do with this 3+ axis dental cnc machine

    Um... which SAMD21 dev board did you get?



Page 3 of 4 FirstFirst 1234 LastLast

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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

what to do with this 3+ axis dental cnc machine

what to do with this 3+ axis dental cnc machine

what to do with this 3+ axis dental cnc machine