Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Project to run my machine


  • Please log in to reply
1 reply to this topic

#1 alanb

alanb

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationNottingham UK

Posted 01 February 2011 - 06:30 PM

Hi, I have built a small Rose engine which is a type of lathe used in ornamental turning (see http://blog dot alanbattersby dot co dot uk/). Currently I run EMC to control the steppers but my aim is to write the necessary code so that my shiny new Netduino plus controls the rose engine. Basically whilst rotating the spindle at the cutting speed (often 1-2 rpm) I need to move the headstock laterally from side to side and also forwards and backwards. So there are three steppers to control but each only moving by small ammounts. The stepper driving the spindle is 200 steps per rev with 2* microstep and is connected to a 16:1 gearbox so claculations give 17.778 steps per degree. I calculate that issuing a step every 1ms will give a top rotation speed of roughly just over 9rpm, this is fine as the normal speed when cutting a pattern is around 1-2 rpm. The steppers driving the headstock movement are again as before but connected to a ball screw of 5mm pitch so one rotation of 400 seteps moves the headstock by 5mm giving 80 steps per mm. Typically cutting a wave pattern of 20mm amplitude and a frequency of 6 giving a maximum lateral offset movement of approx 2.1mm per degree of rotation so max 168 steps per degree or max 9.5 steps laterally for each rotational step. So again at 1ms per step laterally the rotational speed will be just under 1 rpm. So maybe I should generate steps every 500us to cover this and again give a rotational speed of around 2rpm. But not bothered if rotational speed is less than 1 rpm. I can generate the tables giving the number of steps to move so from software I have already written, I want to be able to download these to the N+ store them on the micro sd card then press a button to start the machine. So much for the background, now for the code running on the Netduino I anticipate spawning at least one thread fom main and then using the main thread for communication to-from a simple keyboard and display. I want to use the internal PIT to set an interrupt every 500us say and the ISR should load the necessary values onto output pins to determine the direction and step if any of each motor. The thread is to host a simple trajectory controller that should accelerate the stepping at the start and decellerate whenever the next move has a change in direction. I am not trying to implement the full functionality of a sophisticated piece of software such as EMC. So that is what I want to acheive my questions are 1) Is it possible on the N+ 2) Where can I find references to examples of using ISR and the internal timer etc? I am a retired ex programmer with 20+ years experience at least 8 in c# and then java before that. I appreciate that the N+ is a young product with little documentation but I have to start somewhere. So thanks in advance for any suggestions and pointers to docs code etc. Hopefully I will put links to anything I discover / write on my blog. Alan (PS I noticed whilst writing this my web site had gone down. We are having a little trouble with this over the last few days and I am aware of it so thanks again)

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 01 February 2011 - 06:43 PM

Hi Alan, First of all, Welcome to the Netduino community! If you want to run the function every _exactly_ 500us, you'll want to look at adding your own native code interop and tying it to an IRQ/FIQ. But that code would need to be C/C++, running behind the scenes of your C# "command and control code". Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.