Um... which SAMD21 dev board did you get?
Printable View
Um... which SAMD21 dev board did you get?
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.
this one didn't put much though into it, just wanted something to try.Quote:
Um... which SAMD21 dev board did you get?
yup :)Quote:
Um... typo?
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.
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. (!)Quote:
hey sorry for the delay, winter hit fast and hard here this weekend, and I was not ready.
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.Quote:
this one didn't put much though into it, just wanted something to try.
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.
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?Quote:
Thru sheer luck, I ended up with that exact model of SAMD21 board.
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.
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.Quote:
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.
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.
You don't want to know how many PCB "coasters" I've got around here...Quote:
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.
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.Quote:
So when you thought you fried it, what were the symptoms? Would it just not register on USB or take a sketch upload?
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).Quote:
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.
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.
Highly probable that it's either the USB-serial chip (if it has one) or the bootloader.Quote:
Some of those boards still run the sketch that is on it, but wont connect to take a new upload.
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).Quote:
What board do you select when uploading a sketch on your clone?
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...
https://lh3.googleusercontent.com/7A...AbAD8irA=w2400
well my soldering station is finally done...man that was a hassle. photos here.
so that took way too long, but I did learn quite a bit that will be directly relevant to these motor controllers.
Firstly, opamps are frustrating, they seem so simple yet cause me sooo many headaches.
Just for fun, I tried to make my own reference voltage for reading temp. I used a tl421 to create a 2.5v reference. At the time, I was unclear about the precision relative to what the aruduio could do. I now know that TL421b would have been significantly more precise. After the little work on the breadboard, I had nice looking 2.5v reference on my scope and proceeded to start tuning. But my read values were not very consistent and that made tuning the PID very challenging. So I went back to the scope to look at the amplified signal from the RTD in the iron and it looked real smooth. Went back to reference voltage and zoomed waaaayyy in on time to reveal what I think is called a sawtooth waveform. Very consistent, but definitely not constant. Is this normal? Is that where the 10% tol on the TL421 comes from? I ask all this because I feel a very good reference voltage will be critical to the motor drivers functioning at their best.
The other major learning curve was PID tuning. I do hope its a touch easier to do with the motor.
I can't seem to find the datasheet for the TL421... Digikey, Mouser, and Octopart don't turn up anything; and google seems to be under the impression that it's a front-loader for a Kubota tractor.
As for the saw-tooth, I'd need to see the datasheet, as well as the schematic of the circuit before I could hazard much of a guess as to what is going on. Op-amp circuits can oscillate; but my understanding of it is that usually it takes some external components to make a saw-tooth - by itself, you usually get a sine wave if it breaks into oscillation.
It's less critical than one would think; because of the feedback from the encoders (if it drifts out of position by as little as one encoder count, the feedback loop will command a rotation in the opposite direction until it's back where it's supposed to be). Also, you can include a 10-turn trimmer pot to adjust the "zero point" of the reference voltage to match the zero-RPM output voltage of the SAMD21. However, better is, well, better... so...Quote:
I ask all this because I feel a very good reference voltage will be critical to the motor drivers functioning at their best.
TL431 ...my bad. I was using it in the most basic configuration, cathode & ref shorted together and to 5v via a ~1000ohm* resistor and then a decoupling cap to ground (*i played with the size of that R and it stretched that pattern out or in, but still had the pattern., over sizing the decoupling cap stabilized the trace, but raised the output voltage to 2.6v)
here is what I saw initially and thought was decent(initially):
https://lh3.googleusercontent.com/u8...-fHPH9bg=w2400
but then I zoomed in to see this:
https://lh3.googleusercontent.com/-f...0DCQazbw=w2400
note the bottom trace is the signal line...I initially confused them, you can probably see why. So the problem was, every time I read the sensor, my reference was falling somewhere different on that slopped line, thus leading to less stable reading. The 3.3v ref on the arduino proved very stable on the scope and switching to it resulted in much nicer readings and way less of a headache processing the data.
after the first read I was going to say something like: "but surely it is better to not introduce additional error".....is that what you were saying at the end of that statement? If so, we are on the same page.Quote:
It's less critical than one would think; because of the feedback from the encoders (if it drifts out of position by as little as one encoder count, the feedback loop will command a rotation in the opposite direction until it's back where it's supposed to be). Also, you can include a 10-turn trimmer pot to adjust the "zero point" of the reference voltage to match the zero-RPM output voltage of the SAMD21. However, better is, well, better... so...
i should probably get the regulator you suggested in look at it on the scope, may not even be a problem
Is this on a breadboard? I'm just guessing, but I suspect that the total capacitance (components + stray capacitance from the breadboard itself) might be pushing it into oscillation? According to the datasheet, there is a region of instability...
If you are using it where I think you are - generating the 1.65v offset voltage - then having it be 2.6v won't be a problem, just adjust the 10-turn trimmer to bring the voltage on the wiper down to 1.65.
Well, it's a cleaner design when there's no extraneous errors... even if they don't end up affecting the final end product in a detectable way (i.e, the machined parts come out on-size with good surface finish). What I'm saying, I guess, is that if you can't squeeze out the last little bit of error... don't freak out about it. :)Quote:
"but surely it is better to not introduce additional error".....is that what you were saying at the end of that statement? If so, we are on the same page.
yes & no --actually I not sure for those particular images. I did testing with my soldered board & a breadboard & saw no change.Quote:
Is this on a breadboard?
my understanding is the internal reference is 2.5v (2.49...) and the way I stumbled into making 2.6v just kind of seems wrong to me. I am not gonna worry about it to much, unless the neg regulator I choose to use shows the same irregularity.Quote:
If you are using it where I think you are - generating the 1.65v offset voltage
I have been sorted my electronic comps and found a few adjustable negative voltage regulators---that's just going to create problems right? better to stick with something fixed?
noted...but I might need a reminder on that one, my OCD keeps me trying for perfection, even when its not at all worth it.Quote:
Well, it's a cleaner design when there's no extraneous errors... even if they don't end up affecting the final end product in a detectable way (i.e, the machined parts come out on-size with good surface finish). What I'm saying, I guess, is that if you can't squeeze out the last little bit of error... don't freak out about it.
Hello. I'm new to CNC as well. Here is a really good resource I found: https://handtoolsforfun.com/what-can...-a-cnc-router/ Here is another for converting one machine into another: https://handtoolsforfun.com/how-to-t...a-belt-sander/ Good luck! :)
coincidentally I'm working on the same project. I have made some progress. For ease of programming, I have an arduino controlling each axis to do PID control as an output to the motor drivers (in current mode) and they receive an input of step / dir like a normal stepper driver would. I'm then using estlcam to control each axis, but you could easily sub for GRBL. I'm not done yet, but I do have the control prototyped and working on one axis, and I'm able to successfully control from estlcam. I'm in the process of building mounting everything to a new frame now. If you're interested in details / code I'd be happy to share.