Stepper motor driver with pulse and direction interface #637
Replies: 5 comments
-
Posted at 2014-09-11 by @gfwilliams Well, the average resolution of setInterval is actually very high (1 uS) but the speed of execution of JavaScript is really going to cause you problems - so while you could maybe get nearer 8kHz with a few lines of the inline assembler, other bits of JavaScript that run will get in the way of it. It's a bit difficult really... You can get an accurate, very high pulse rate using the built-in timers and analogWrite, but crucially you won't be able to accurately count how many pulses have been sent out. So if you really want the higher speeds with Espruino I guess you have three options - none of which is great:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-09-13 by tage Thanks. I will have to look into those options as time allows. This is not a high priority project right now. Perhaps I could generate the pulses with acceleration ramps in hardware and count the number of pulses to know the position. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-14 by jack.kryden Gordon, Have you seen the new NXP dual-core mcu[1] which starts at $2(for 256K/108K flash/ram) ? it might be a good fit to enable Espruino with real-time : 1 core could run Espruino with all it's benefits especially with high ram. Another core run Arduino/Mbed,exactly for those real-time tasks. People who don't care to learn Arduino/Mbed, but want to add some real-time stuff can easily copy code from the net. I believe there are even ports of the mbed to the lpc4500(a board called bambino-200) , which is another dual core chip from nxp, so it might make the job easier. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-17 by @gfwilliams Hi Jack, Looks interesting - however from my point of view, making people use two separate IDEs and languages goes against the idea of Espruino a bit - it should be nice and easy to use. The micro itself is capable of realtime without needing a separate processor - it's just how you expose it to the programmer. I will probably add the ability to run (native) code in interrupts (and timers) soon, which should make life a lot easier. Things like counting pulses could be done in a few lines of assembler and then rolled up into a module so that the programmer using it didn't have to care about it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-17 by mhoneywill
That would be great this would allow me to add half duplex RS485 comms easily. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-09-11 by tage
I am tinkering with a NEMA 23 stepper motor and a motor drive that has a pulse input, a direction input and an enable input. The motor is driving an indexing table with a 3M timing belt, with gears that give 8:1 reduction.
The drive can accept pulse frequency up to 200kHz. The motor is a common two winding bipolar with 1.8 degree step angle, and if not micro stepping I think that 1kHz frequency is fine. But I would like to take advantage of the micro stepping capability which means the pulse frequency must be much higher.
I expect that the mass that is mounted to the indexing table can be large, so to avoid problems with stalling, position errors etc I am trying to optimize the acceleration (ramp up and ramp down of the stepping frequency).
My question is what limitations I should expect from the changeInterval() function. I assume there is a 1ms resolution limit. is there a better way to control the pulse frequency accurately and with higher frequency than 1kHz?
Beta Was this translation helpful? Give feedback.
All reactions