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

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 47

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

  1. #21
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

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

    Where did we land on using the SAMD21 at the primary controller (vs the sub axis controllers)?
    The official version of Grbl on ARM is not out yet. You'd have to use something like this; which is a 3rd party effort: https://github.com/terjeio/grblHAL

    I have not tried to use it yet; so I don't know where it's limitations, pitfalls, or bugs, if any, would be.

    ceramic magnet at the end of the shaft
    Being power steering motors; it would have to have sensors; for two reasons: 1) safety, so it's probably (hopefully!) got a redundant set of them; and 2) it needs to work smoothly at zero to very low RPM, which a sensor-less driver can't do (you don't get any back-emf if it's not moving, so sensor-less drivers start up blindly, and expect the motor to fall into sync as the output frequency increases - works well for RC propellers and rotors on drones; doesn't work well at all for servos, which is what that power steering motor essentially is). However, if the motor was positively geared to the steering box, I suppose the commutation angle could have been deduced from the steering angle sensors.

    honestly I am not sure I totally understand what bootloaders do
    It's more like the first stage of the BIOS on a PC than the operating system - it runs, well, at boot time; and allows you to load the main program onto the flash using something other than the chip's native programming protocol. It's not technically needed if you are using the manufacturer's programmer (or an equivalent) but if you want to have your board be updatable by people (customers or field technicians) using just a standard PC (or smartphone, etc) then you need one. Arduinos, being designed for beginners, were intended to be used with standard PCs - and thus the standard method of sending your main program to the Arduino's processor is over the serial port (or in the case of later Arduinos, the processor chip's built-in USB port); and that's where the bootloader comes in: it runs at startup, checks for specific conditions required to trigger the upload routines, and if those conditions are found, starts to communicate with the upload program running on the PC (the Arduino IDE uses several different command-line programs, depending on which kind of Arduino it's talking to; but for Unos, it's AVRDude - you will have seen that in the build process logs part of the window when sending a sketch to an Arduino). Then, the bootloader copies the man program code that's incoming from the serial or USB port onto the flash, verifies it, and then reset's the Arduino.

    If the requisite conditions for upload are not found at boot time; the bootloader just jumps right into your program's main() function (er, close - it executes the C++ automatic startup routines first, so that your global variable's constructors get called before main()).

    re: crystal - a bit confused here, I understand the relevance of 32.768 khz, but I thought the oscillator was responsible for timing cpu cycles....but how does a 32.768 kh produce a 48 mhz cpu cycle?
    The SAMD21 (and most of the other ARM processors I've encountered recently) use a PLL (Phase Locked Loop) to generate the main system clock. That PLL in turn uses the 32.768 crystal (well, actually it's an oscillator being driven by the crystal, but I digress) to adjust the actual output frequency of the 48Mhz oscillator to keep it right at 48Mhz regardless of supply voltage or temperature fluctuation. Setting this up on the SAMD21 is one of the first things that the bootloader does; and it expects to find that crystal connected (if you wrote your own bootloader - or didn't have one at all; and just did the setup yourself - you could, in principle, omit the crystal and just run the 48Mhz oscillator "open-loop" - and your clock speed would vary, but be somewhat close to 48Mhz, and for some applications that's good enough). I've read comments on forums (I didn't verify this myself by reading the bootloader source code, though) that the Arduino SAMD21 bootloader goes thru a configuration briefly at boot where the 32.768Khz crystal is the only clock running, and is the CPU's clock - so if that crystal is missing or defective the Arduino bootloader will hang there (no clock).

    I figured that soldering down a crystal and two capacitors was easier than re-writing the bootloader and sorting out any communication issues that may spring from not having a dead-on 48Mhz clock rate.

    re: precision voltage reference: is a zener diode sufficient for this, or is that not considered to be a precision reference?
    It isn't, per se - but precision is relative. In this case it will be good enough. Or, there are a bunch of voltage reference ICs available, or for this application, a voltage regulator feeding into a 10-turn trimmer pot would probably be OK.

    encoder: these are hedl 5540 encoders
    Well, they worked OK back when it was doing teeth, so.... sure, I guess? Assuming you are reading the encoders at the full edge count you get four times the optical lines of resolution, so then there's 2000 states per revolution. Multiply that by whatever the ballscrew drive factor is (turns of the motor per inch or MM of travel); and you get the actual resolution of the system (steps per inch or MM, depending on which unit system you are using). Multiply that figure by the desired travel rate (inches or mm per second) and you get the rate in Hz that your quadrature decoder ISR needs to run at.

    Assuming a 1:1 belt ratio, and 5mm per turn ballscrews, that 500 optical lines would give you (500 x 4) x 1 x (1/5) = 400 steps per MM.
    Assuming that you want a 100mm/sec travel rate for rapids, then (100 x 400) = 40000.

    So, for the above example, your quadrature decoder ISR would need to be capable of handling a 40Khz trigger rate.


    It seems like developing these boards is gonna take a bit, I was thinking about ordering a SAMD21 dev board to start familiarizing myself with it, thoughts?
    I would. Any of the SAMD21-based Arduino's will do (or a clone).

    the lead screws have no rear support bearings on any of the axis!
    Wat. Let me repeat myself: Wat.

    Unbelievable. Even cheap chinese ballscrew kits for DIY wood routers include support bearings on both ends.



  2. #22
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    Downloads
    0
    Uploads
    0

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

    thanks for the clarification on bootloaders. As a novice, I will probably load a standard bootloader, whereas is sounds like you do some custom stuff there, right?

    so I will stick to a mega as the main control board, that will be easy enough to upgrade in the future when ARM compatible grbl is more developed.

    Seems like oscillators are kind of like a "reference frequency", but actually generating the cpu clock(s). I don't want any problems there, so not a problem to include the oscillator, just need to decide on which one, some are adjustable...dont think I need that, but there are 2500+ oscillator crystals in the 32.768 frequency on digikey and its like reading a foreign langue to me. SMD chips are strictly re flow right? SOJ seem like ones I can solder by hand? The there are 2, 3 & 4 lead packages. uggg makes my brain hurt.

    on the encoders-- so to get the 4x resolution, you are registering both the rise & fall on two encoders. got it. I am going to pull the stages off tonight and come up with some of those measurements and I will update the math. The datasheet said 100khz max frequency, is that comparable to the 40khz trigger rate you refereed to?

    ball screws --im glad you are as outraged as me. After I calmed down, I thought /looked at it some more...it seems they didn't use rear bearings in order to "cheat" on the travel. They get an extra couple inches where the bearing block would be. Not defending them, I still find it unacceptable, but at least I can see what they were thinking.

    However, if the motor was positively geared to the steering box, I suppose the commutation angle could have been deduced from the steering angle sensors.
    It was pretty close to a 1:1 belt drive to a lead screw replacing the steering rack. I had similar thoughts about the speed this motor would have been designed to do....slow, slight back and forth motion most of the time. but then when you turn, I'll bet that motor has got to drive it pretty fast. I am really interested to see what I can get out of them, speed, duty cycle, torque, ect. Also like to see if I can run them higher than the 12v they were designed for. The motors where $10 /ea, so I am good with taking some potentially destructive risks.



  3. #23
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

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

    whereas is sounds like you do some custom stuff there, right?
    Nope. No need to for what I do. Also, compatibility (well, ease of use, really) with the standard Arduino workflow is important for anything I intend to release as open-source.

    Now, if I was doing something where boot time was essential - like fly-by-wire avionics or automotive stuff where you MUST get the servo loop running again as soon as possible after a system upset - then I would have my own startup code that only does the minimum init work before jumping into the main loop.

    so I will stick to a mega as the main control board, that will be easy enough to upgrade in the future when ARM compatible grbl is more developed.
    Well... I am. FWIW, I've got a couple of breakout board designs for Grbl on Mega that might be useful here; the prototype PCBs have been here for a while and I've got one of them soldered together, but I haven't gotten the chance to do the actual testing on them. The pinouts are (purposely) almost identical to a RAMPS 1.4 + RepRapDiscount Smart Controller LCD card (due to trace routing issues I had to change the pinouts on the Arduino side of LCD connector so the configuration in cpu_map.h is a little bit different; but you can still plug in a standard RepRapDiscount Smart Controller LCD card). As soon as I get a chance to test them, I intend to upload a package to github so that other people can have them manufactured, also (that'll be gerber & excellon files ready to send to someplace like JLCPCB or Seeed Studio, as well as a bill-of-materials & assembly instructions).

    Seems like oscillators are kind of like a "reference frequency", but actually generating the cpu clock(s).
    Strictly speaking, an oscillator is anything that, well, oscillates - the pendulum and escapement mechanisim on a grandfather clock would be an example of a mechanical one; the pendulum being analogous to the crystal. The oscillator is the whole circuit - in this case it's both the circuitry inside the SAMD21, the crystal's load capacitors; and the crystal itself.

    There's a whole bunch of circuit designs for oscillators; and not all of them use crystals to set their frequency; and some of them are suitable for construction directly onto the silicon of an IC. Both AVRs and SAMD21s (among other chips) have several oscillators that are completely internal to the chips; as well as one multi-mode one that expects either a crystal or ceramic resonator (that's like a crystal; but cheaper and not as precise) to be connected to a couple of pins on the package.

    I don't want any problems there, so not a problem to include the oscillator, just need to decide on which one, some are adjustable...dont think I need that,
    You don't need it; nor do you want it. Adjustability in this application just means you've got one more thing to setup before you get it working.

    but there are 2500+ oscillator crystals in the 32.768 frequency on digikey and its like reading a foreign langue to me.
    Well, the first thing I do after I have selected the general category of what I'm looking for is turn on "In Stock" only - that usually drops the search results down from thousands to hundreds. Then I go and turn off full reels (Tape & Reel) and Digi-Reels (by selecting anything but that in the list) - tray, cut tape, and bulk are usually what remain. Then I go and start reducing the results by selecting the properties I want; and if there's a bunch available after that; I do a sort by price, and pick the cheapest that looks like it's got good availability (there might be some parts for which they only have a hundred or so on hand - I usually avoid those, because I might want to order more in the future and that one might be unavailable; especially so if it's got a unique pinout or PCB footprint).

    SMD chips are strictly re flow right? SOJ seem like ones I can solder by hand? The there are 2, 3 & 4 lead packages. uggg makes my brain hurt.
    Depends on the exact package; but if you have enough copper surrounding them you may be able to get them to melt the solder under the device's pad by heating up the copper on the PCB with your iron. However, I'd probably go for a thru-hole package.

    With that in mind; a quick search of in-stock; thru-hole, 32.768khz crystals with 12.5 load capacitance requirement (so that it works with two 22pf load capacitors) turns up these for some results on Digikey:

    AB38T-32.768KHZ
    AB26T-32.768KHZ
    ECS-.327-12.5-13X
    LFXTAL002997BULK

    The datasheet said 100khz max frequency, is that comparable to the 40khz trigger rate you refereed to?
    At the moment I don't recall which datasheet it was that said that... but just speaking in general, yeah - that sounds about right for a maximum trigger rate specification. In practice I don't expect it to actually get that high; I doubt that they'd have the rapids set that high, and in any case for your use Grbl - at least on an AVR - tops out at around 30Khz, so you wouldn't be trying to move the motors faster than that.

    They get an extra couple inches where the bearing block would be
    I gotta say - would an extra inch of machine size to put in a bearing have killed them?

    slow, slight back and forth motion most of the time. but then when you turn, I'll bet that motor has got to drive it pretty fast.
    Especially if you are making an emergency maneuver (#^$%*@^# DEER!)

    I am really interested to see what I can get out of them, speed, duty cycle, torque, ect. Also like to see if I can run them higher than the 12v they were designed for
    Probably quite a bit. Do you know what they were out of?

    Just like a stepper motor, they are going to be current driven devices; so the maximum voltage going into the controller will be determined by the chips (MOSFETs or IGBTs, mostly) that you use. More available voltage will translate to higher peak RPM and torque at speed.



  4. #24
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    Downloads
    0
    Uploads
    0

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

    encoders & ballscrews: encoders 500 lines x 2 encoders = 2000 events per motor shaft rotation
    belt drives 3:1 = 6000 events per ball screw rotation (which is 0.100" in linear travel)
    ballscrews: 10 tpi (0.100" / rotation) *interestingly my dial face is 0.100" / rotation...this creates a kind of spooky 1:1 link between the sprocket & dial that will ONLY occurs with a 10tpi screw and 100k dial. Also I was amazed at the steadiness of the dial as I advanced the ball screw, I am very used to acme threads and it makes a world of difference.
    total: ( 6000 events / ballscrewRotaion) x (10 ballscrewRotations/ 1 inch) = 60,000 events /inch or each event(step) being 1/60,000 [23,622 events / mm]
    i doubt this "fine" system is going to move at 100mm/s, but if it did, that would be 2,362,200 events/second (2.3 mHz)

    at this point, I feel like my math is off, but i have been over it several times and im burnt out, im sure I'll see my error tomorrow.

    I head your point about grbl not "stepping" faster than 30k...but there is no reason the sub axis boards can't be reading encoders & adjusting the +-10v signal as fast as they can right? I feel like that's the whole reason to use the samd21.

    So when you say
    your quadrature decoder ISR would need to be capable of handling a 40Khz trigger rate
    this is the interrupt pin on the samd21 (through a 5-3.3v converter), correct? But thats actually 2 inputs, right? and wouldn't that mean a trigger rate of half the events? still have to process all of them, but it is two different pins being triggered half the time....unless there are shared resources between pins. I cannot find anything like max ISR handling frequency in the samd21 datasheet. But does the actually triggering take more than a clock cycle at 32bits? beyond that, there the time to execute the ISR handler...but if we just talk about the triggering, shouldn't it be able to do this at the better part of its speed (48mhz)?

    I gotta say - would an extra inch of machine size to put in a bearing have killed them?
    -so in the X axis, they needed the travel to move from the mill to the laser. Keeping that travel would add the thickness of the bearing block + 3/4 length of the carriage (~3in). So probably 4" total. See they stuck the nut all the way to the near side of the carriage and they run all the way to the end. I know this because of where the endstops are placed. The thing is, they had the space to do this.
    -then there is the y axis, which is unusabley long with all sorts of space for a bearing block, still nothing
    -the z axis, i admit is a little trickier, but not too bad.
    -kind of seems like poor planning, but maybe they just didn't care.

    Probably quite a bit. Do you know what they were out of?
    either a land rover or a tesla...been used in both, but I think its discontinued now

    Just like a stepper motor, they are going to be current driven devices; so the maximum voltage going into the controller will be determined by the chips (MOSFETs or IGBTs, mostly) that you use. More available voltage will translate to higher peak RPM and torque at speed.
    they really are low resolution steppers aren't they? i figured about the circuitry, my concern was more about hitting the actually coils with higher voltage...though they are some heavy windings, at least 12, maybe 10 gauge enamel wire.

    Last edited by mtraven; 11-01-2019 at 08:32 PM.


  5. #25
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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?



  6. #26
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    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.



  7. #27
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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 12:03 AM. Reason: revised section about usb


  8. #28
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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 04:29 AM.


  9. #29
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    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  


  10. #30
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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.



  11. #31
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    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 12:46 AM. Reason: Typo


  12. #32
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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 07:09 PM. Reason: addon *1*


  13. #33
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    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...



  14. #34
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    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.



  15. #35
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    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).



  16. #36
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

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

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



  17. #37
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    Downloads
    0
    Uploads
    0

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

    hey sorry for the delay, winter hit fast and hard here this weekend, and I was not ready. Also I bit into that soldering iron station project and ended up on some tangents, useful, but tangential nonetheless.

    Um... which SAMD21 dev board did you get?
    this one didn't put much though into it, just wanted something to try.

    Um... typo?
    yup


    great info on the opto / grounding stuff. a while back I was running stepper signals through opto's and came into some bizarre behavior, mostly when stepping fast (<500uS between steps). I began to suspect the optos were slow as they were part of my "old electronics inventory". I had 4 different kinds, most of which did not have a modern standardized format (i am sure you've seen old datasheets)....not really knowing what I was doing, and lacking a scope, it was days of reading sheets and trying to work out the math, I did eventually settle on some 4n24's i had around, I knew they were the fastest I had, but never truly knew they were fast enough. So that backstory leads me to my soldering station project. So as I was building a couple of simple power supplies and a pwm mosfet circuit, I spent some time re-familiarizing myself with using a scope (its been at least 10 years since I used one). OMG what a useful diagnostic tool! The way you felt about the microscope is how I feel about the oscilliscope. I had spent years trying to troubleshoot signals with just a multimeter and now I am staring at a WHOLE new world. And more importantly, I can SEE the results of different components. For example, I sat there and played with all sorts of combinations of resistors & caps on my voltage regulators and got to see the subtle differences they made. I learn quite well from that sort of direct feedback. They when I got to the opto that drives the mosfet, I swapped some of those other chips in & out and got to see exactly how signals were getting cut off....really cool. Tonight I would like to compare the analog out of an arduino nano (328) and the samd21. You had mentioned the method of generating analog signals is much better on the samd21, so I would like to see that.

    I am still working on this damn soldering station...only part I didn't breadboard was the thermistor circuit, as I have wire many of those....but it is an PTC(although I am starting to think its actually an RTD) and I am used to NTC. thought that would only matter in software, I can measure the resistance as I heat it and it climbs, but then I stick in a voltage divider and end up with the full voltage. I think its got to do with the size of the divider resistor, but I haven't quite zeroed in on it.


    When that is finally done, I do plan to start building a proto type axis control circuit. More generally, my 1st goal is to get 1 axis moving around with an arduino.

    Last edited by mtraven; 11-11-2019 at 10:49 PM.


  18. #38
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

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

    hey sorry for the delay, winter hit fast and hard here this weekend, and I was not ready.
    Eh, no problem. I've actually been a bit busy myself - but with the opposite problem: I spent the weekend driving a tractor around collecting brush & dead tree limbs & piling them in a dumpster so our place here doesn't burn down (I'm in the middle of California). I've actually got my air conditioning going as I type this. (!)

    this one didn't put much though into it, just wanted something to try.
    Hmm... funny that, I was having some weirdness with the Arduino M0 clone that I have here on Friday (although at the time I was starting to suspect it should have been called 'Fryday' - my signal generator glitched out and dumped 5v into the 3.3v-only inputs on the board; and I thought I cooked it)... so... I went on Amazon and ordered another board to test with. Thru sheer luck, I ended up with that exact model of SAMD21 board.

    Only after the new board arrived did I discover that it was just the bootloader that had gotten corrupted; and after going around a few times flashing a new bootloader and the sketch I was playing with using the Atmel-ICE it's now working without a hitch.

    Re: Scopes.
    Scopes are cool. All kinds, too... micro-, tele-, oscillo-, and even kaliedo-.

    Re: Analog out.
    The DAC on the SAMD21 is connected to Arduino pin A0. Doing an analogWrite() to any of the other pins will result in a PWM signal being generated.



  19. #39
    Member
    Join Date
    May 2009
    Location
    usa
    Posts
    26
    Downloads
    0
    Uploads
    0

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

    Thru sheer luck, I ended up with that exact model of SAMD21 board.
    i suspect it has more to do with amazon's search algorithms.....the real question is did you buy the soldered or un-soldered version?

    I gotta say, it calms be a bit that even someone who know what they are doing messes up a board every now and then. So when you thought you fried it, what were the symptoms? Would it just not register on USB or take a sketch upload? I ask because I have several boards that I think would work if I got a new booloader on them, but I had tried that a while back with no success. Some of those boards still run the sketch that is on it, but wont connect to take a new upload. I should probably work out the process of uploading a bootloader with a working chip so I know my setup is right..then if it doesn't work, I know the board is donzo.

    What board do you select when uploading a sketch on your clone? I have all sorts of options: arduino M0, arduino M0 pro (programming port), arduino M0 pro (native usb port), arduino Zero (programming port), arduino Zero (native usb port). I just guessed at "arduino M0 pro, native usb" and it seems to have worked.

    The DAC on the SAMD21 is connected to Arduino pin A0. Doing an analogWrite() to any of the other pins will result in a PWM signal being generated.
    so just to restate it so I make sure I understand: I can expect a different waveform using the DAC with something like analogWrite(A0, n) where as an analogWrite to any other pin will look the same as a standard arduino.

    edit: well I just checked that out on my scope side by side with a regular pin, pumping up duty every second or do...---that is REALLY cool to watch a solid line rise side by side with the pwm chopped output. its a shame there is only one though.

    still working on that soldering station, not having fun. It is an RTD, I finally got a circuit that varies voltage with temperature, but its only like 15mV variation, so I am working on amplifying that up to either 3.3 or 5v so my nano can read it...that what I am trying to work through tonight.



  20. #40
    Member
    Join Date
    Aug 2009
    Location
    USA
    Posts
    230
    Downloads
    0
    Uploads
    0

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

    I gotta say, it calms be a bit that even someone who know what they are doing messes up a board every now and then.
    You don't want to know how many PCB "coasters" I've got around here...

    So when you thought you fried it, what were the symptoms? Would it just not register on USB or take a sketch upload?
    Intermittently wouldn't be recognized properly by the OS; wouldn't be recognized properly by the Arduino IDE (didn't show up in the "Ports" menu); when it did show up the upload process would fail; killing the Arduino IDE and relaunching it along with a reset of the board would end up with two entries in the system USB tree for the board... it was a mess. I had also thought it might be a Catalina issue; owing to the fact that I had just upgraded the OS on that machine (and there was an open issue for the Leonardo bootloader being nonfunctional on Catalina); but given that it seems to be working now I don't think that was the issue.

    I ask because I have several boards that I think would work if I got a new bootloader on them, but I had tried that a while back with no success.
    Depends on the exact board and symptoms. ARM based Arduinos and the Leonardo use a direct USB connection; all the others use some sort of USB-serial chip (FTDI, CH340, ATMega32u2, etc).

    If it's a USB-serial chip based Arduino, the board won't show up at all when plugged in to a known-working USB port & cable, and you know that the PC side has working drivers on it; then the serial chip is dead. If it's a ATMega32u2, then that might have gotten corrupted (and is re-flashable, there's an ICSP header on the board specificaly for this); but if it's one of the others then it's more-or-less non-repairable.

    If it's a direct-USB Arduino, or the symptom is anything other than not showing up at all; then software corruption on the board is a possibility; re-flashing the bootloader & a sketch with a programming tool might help.

    Or... they might be toast.

    Some of those boards still run the sketch that is on it, but wont connect to take a new upload.
    Highly probable that it's either the USB-serial chip (if it has one) or the bootloader.

    What board do you select when uploading a sketch on your clone?
    I've been selecting the "Arduino/Genuino Zero (Native USB Port)". As far as I know, the practical difference between most of them is just the Arduino-pin to CPU-register (and thus physical pin) mapping. However, the listings for "Programming Port" are actually setup to connect to a programmer/debugger module (the Atmel-ICE is one, and the Atmel Embedded Debugger that's on the official Arduino Zero and M0-Pro boards is another).

    Re: soldering station.
    Well, I was in a bit of a chicken-and-egg situation, so I ended up just buying a T-12 compatible one from Circuit Specialists yea many years ago... it still works, so I haven't replaced it. Only thing I don't like about it is that it always comes up at 350c when it's turned on...



Page 2 of 3 FirstFirst 123 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