tag:blogger.com,1999:blog-25750398.post126400017511252767..comments2023-08-19T00:38:45.661-07:00Comments on A Big Magnet: Arduino and motor control part 2Josh Kopelhttp://www.blogger.com/profile/16203055108558568522noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-25750398.post-40430865105568767092012-03-10T22:02:04.184-08:002012-03-10T22:02:04.184-08:00Just want to say thanks for setting me to the righ...Just want to say thanks for setting me to the right direction of working on my project.Jason Whttps://www.blogger.com/profile/02799352563872001934noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-7388412958506735332011-11-18T23:01:41.299-08:002011-11-18T23:01:41.299-08:00@Digital_Sin in general you should have a resister...@Digital_Sin in general you should have a resister in series with your LED. While the value is dependent upon the specs of the individual LED, you can usually just use a 1k to test with. Without it you definitely run the risk of burning out the LED.Josh Kopelhttps://www.blogger.com/profile/16203055108558568522noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-79761795195975407512011-10-27T11:33:58.767-07:002011-10-27T11:33:58.767-07:00I've been working on my old inject HP printer,...I've been working on my old inject HP printer, it also comes with the agilent optical encoders identical to yours. When I first connected them to a 5v source the LED was visibly red, but after a few seconds it started to fade away, now it doesn't light up at all.<br /><br />I've tried the other agilent encoder but this time on 3.3 volts, did the same thing! Are the LEDs inside them fried? would suck because now the printer carcass is worthless...Digital_Sinhttps://www.blogger.com/profile/09244830555947376351noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-54922172282860118712009-08-05T00:27:51.727-07:002009-08-05T00:27:51.727-07:00Hi Josh, thanks for your reply on the other post, ...Hi Josh, thanks for your reply on the other post, and fir directing me here. Just to get an idea, how many interrupts per second are you currently getting?Unknownhttps://www.blogger.com/profile/11718956002817067248noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-10598800387484525812009-07-07T02:20:54.765-07:002009-07-07T02:20:54.765-07:00I don't know if you're still working on th...I don't know if you're still working on this or not... but I'll post anyway. :)<br /><br />This is the same style of control that we use on the CandyFab: quadrature encoders read out by AVRs, with digital PID on the PWM output(s). It *can* work very well, doing exactly what you're trying to do. <br /><br />The tricky part is that this application has time-critical interrupts, and only one interrupt can happen at a time. If you really want to be able to detect every fringe, you need to remove *every* other possible interrupt source in your program. That means (1) turning off the Arduino ms timer and (2) not using the Arduino serial library. (If you have other sneaky routines that are based on interrupts, you can avoid those as well.) You can replicate the function of either (or both) of these using interrupt-free functions, and then things will work happily. <br /><br />(The ms timer can be replaced by a free-running timer that you poll occasionally, and the serial interface can also be replaced by just polling the serial hardware at a regular pace.)Unknownhttps://www.blogger.com/profile/11688325554862262523noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-26744190506453944712009-01-11T20:11:00.000-08:002009-01-11T20:11:00.000-08:00Drew,Glad it helped!The noise is mechanical resona...Drew,<BR/>Glad it helped!<BR/><BR/>The noise is mechanical resonance from the PWM signal to the motor.<BR/>I used a fairly low frequency (MOTOR12_8KHZ) to get better torque, but if you change to a higher (MOTOR12_64KHZ) or lower (MOTOR12_1KHZ) one you may be able to get outside the resonant range.<BR/><BR/>I have not gotten back to playing with this in a while, but hopefully I will soon.<BR/><BR/>JoshJosh Kopelhttps://www.blogger.com/profile/16203055108558568522noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-52711327792522429532009-01-11T15:28:00.000-08:002009-01-11T15:28:00.000-08:00Josh, thank you very much for this write up, I fou...Josh, thank you very much for this write up, I found you're blog after gutting a Canon Pixma 4000 and buying a Adafruit motor shield and have just got it working using your code - unreliable, but working. Yay.<BR/> <BR/>I notice that in the video, yours is quite noisy - mine also, any idea's on optimizing it to reduce noise? (my fiance hasn't complained yet, but I don't want to push things) looking forward to reading your next installment.<BR/>Cheers DrewDrew Batchelorhttps://www.blogger.com/profile/00882450867816621941noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-33277536411175715452008-12-02T18:59:00.000-08:002008-12-02T18:59:00.000-08:00Shoot. I couldn't find your Email address. But her...Shoot. I couldn't find your Email address. But here is a Washington state surplus sale of a pallet of old printers, should your Arduino class need more guts. <A HREF="http://cgi.ebay.com/Safety-Lights-2-pallets-410-08-3596-J-884_W0QQitemZ260322764247QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item260322764247&_trksid=p3911.c0.m14&_trkparms=72%3A1205%7C66%3A2%7C65%3A12%7C39%3A1%7C240%3A1318" REL="nofollow">PRINTERS</A>Unknownhttps://www.blogger.com/profile/02659369810765556575noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-80429885258883344662008-12-02T18:58:00.000-08:002008-12-02T18:58:00.000-08:00This comment has been removed by the author.Unknownhttps://www.blogger.com/profile/02659369810765556575noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-87866219964427800672008-11-07T20:36:00.000-08:002008-11-07T20:36:00.000-08:00Bill,That kind of tethered control is certainly on...Bill,<BR/><BR/>That kind of tethered control is certainly one of the ways I have been thinking of using this code. The other is that it needs to be able to provide motor control even when the Arduino is busy doing other things. I am thinking about robots and other semi-autonomous applications.<BR/><BR/>I would love to hear more about the motors. I will say that the whole point behind my experiments is to use ink jet parts since they are an almost unlimited source of motors. And they are free!Josh Kopelhttps://www.blogger.com/profile/16203055108558568522noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-71341542069941930972008-11-06T16:13:00.000-08:002008-11-06T16:13:00.000-08:00Josh,How about just taking in position commands ov...Josh,<BR/>How about just taking in position commands over the Arduino USB? Go positive 100 steps. Go negative 25 steps. Then you are on the verge of CNC, especially if you can control multiple motors. <BR/>You can ignore the serial talk-talk while in the motor control section...<BR/><BR/>I am really very interested in this and can provide you a source for some very nice encoder enabled gear motors if you would like.<BR/>THANKS,<BR/>BillDreschelhttps://www.blogger.com/profile/11520484814080231468noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-5169000888509906582008-11-06T14:17:00.000-08:002008-11-06T14:17:00.000-08:00Thanks Dave!I actually had looked at that link bef...Thanks Dave!<BR/>I actually had looked at that link before in my google searches for info on PID control. It is a really cool setup. <BR/><BR/>It does end up being a dedicated controller though and I am hoping to use the Arduino not only for the position control, but for the "business logic" as well.<BR/><BR/>It is not at all clear from these posts, but I am preparing materials for a beginner/intermediate Arduino class. That means I am trying to get simple solutions that are "good enough", and can be understood by the students.<BR/><BR/>The other constraint is trying to use as little external circuitry as possible (for cost control).Josh Kopelhttps://www.blogger.com/profile/16203055108558568522noreply@blogger.comtag:blogger.com,1999:blog-25750398.post-3168892187500594742008-11-06T13:19:00.000-08:002008-11-06T13:19:00.000-08:00So one way to get around dealing with all those in...So one way to get around dealing with all those interrupts is to use a little bit of extra circuitry and two counters (I'm pretty sure you can use pins on the Arduino as counters). Then, all the encoder signals are being counted in the background and you can just ask the processor for that info whenever you need it.<BR/><BR/>More info <A HREF="http://www.seattlerobotics.org/encoder/200205/PIDmc.html" REL="nofollow">here</A> (even though they used a PIC, it's the same idea).Davehttps://www.blogger.com/profile/00428556785118441383noreply@blogger.com