G30 Design Project

New Zealand is a mint place to live in…

Next time you apply for a Visa mention you are more than happy to turn feral like the locals and run around the countryside wearing a grass skirt in bear feet drink a few tins of Lion Red… ;D

@ Justin - Sounds like I would fit right in.

Do you have any example code for PWM control of a DC stepper motor? I am assuming I need PWM for microstepping, or does that depend on the controller? How do I know which pins on the G30 to connect to the IMSPLUS motor controller? I am conducting tests with this setup until the ST controller gets here - we are getting the ST one because the co-processor will save me time and stress + we are already cutting costs $91 per controller so they are fine with $5 vs the $2 TI one. I have the controller pin out diagram attached here. I understand the basics but need to make sure I don’t mess anything up.

Any help would be appreciated - I could use a whole C# class for micro stepping, some PWM algorithms (or whatever control algorithms are recommended I am unsure of this part - is PID controll overkill?), pin configurations, and any other tips (how to handle inaccuracies caused by mechanical backlash?)

The IMSPLUS controller says it requires a 5V logic supply on pin 14 but the G30 pins say that they are not 5V tolerant - they are 3.3V. Does that mean I cannot connect this motor controller to the G30?

This image is more useful for my understanding. If anyone has tips / instructions for me please base them off this. My motor has 4 wires - blue, green, red, and black - I am assuming 2 are phase A and 2 are phase B connections. I do not know what the bar over pin 21 Phase B and Pin 2 Phase A means.

Biggest thing I am unsure of with the code is the logic for command the CW/CCW direction as well as what the MSEL 0 -3 pins do. I have no idea which pins are the control pins and the proper way of inputting a signal. I have controlled a motor 1 time years ago using PWM for my controls laboratory class but its been ages and was extremely difficult under that instructor (he was a pretty mean alcoholic but knew his stuff).

@ hwalker_MIWV - The G30 Datasheet says that the GPIOs are 5V tolerant.

@ Mr. John Smith - oh ok thank you for clarify I misread it - they are tolerant as long as they are not in analog or crystal mode.

Still could use a bit of help with the motor control code if anyone has a few spare minutes today. Please and thank you (: you guys have already been such a huge help.

@ hwalker_MIWV - there are a few difficulties with running stepper from netmf.

Assuming you use a standard driver chip with pulse and direction inputs, these are the main methods amd they all have disadvantages.

  1. You can use PWM to drive it and get nice smooth motion. But acceleration is jard to control and it is hard to count the steps and know the exact position. It might be possible to hook an internal counter to the pulse pin to do this.

  2. You can bit bang the pulses, but its hard to move fast or smoothly due to the timing uncertainty.

  3. You can use signal generator to run pre-calculated sequences with smooth motion and accel control, but the pre calculation can take a long while for long moves and there is a discontinuity between sequences. I have some example code that does this.

@ hagster - The chip I will be ordering has a co-processor for acceleration control. I will be ordering the ST L6470 for use in the final design but while I wait on the shipping delay I would like to try running the IMS IM481HPlus that we currently have in stock. I think option one will be the best since this chip has built in acceleration control and I need reasonable smooth motion - the most important factor is the position accuracy but I also do not want a slow response. I have done a small amount of PWM before and know how to tune PID control but I need help with the coding aspects.

1 Like

@ Mr. John Smith - So for the 5V logic pin on the IMS controller, do I just connect that to one of the 3.3V pins on the G30? Pins 13, 18, 32, 48, and 64 are all labeled 3.3V in the G30 data sheet.

@ Justin - Can you please send me some of your control code from that project you showed me? If you could also send me the schematic for reference that would be amazing…I am going to use the same ST controller you recommended. I would really appreciate the help - it would save me SO much time and give me much needed praise from my supervisor (was off to a bit of a rocky start with this position and am crawling back from the bring of disaster lol).

@ hwalker_MIWV - Yes, you can connect one of the 5V pins to those 3v3 pins. Further, the L6470 chip is easy to get working, as the defaults at startup will run a small motor, however the c# driver for that gets very involved. I’m still working on my driver actually (as there is always room for improvement).

Bit banging the Steps is also an option, for low speed applications.

@ Mr. John Smith - I am not sure what bit banging is. Would you mind sharing your driver with me? I would love to help you improve it. We can collaborate on it.

@ Mr. John Smith - What are your thoughts on a NETMF library for stepper motor control such as this one?

http://tigra-astronomy.com/stepper-motor-control-for-net-microframework

Yea, I really do love stepper motors don’t I.

[url]https://www.ghielectronics.com/community/codeshare/entry/909[/url]

It needs updating, though. Perhaps I’ll get around to it this weekend.

@ Mr. John Smith - Thank you so much Sir you are a God send! This is so incredibly helpful you just made my weekend! Please let me know if I can help improve the code in anyway once I have it all set up. Do you have a schematic I can reference for connecting the pins? We are going to create a prototype PCB for me to test everything but my electrical engineer needs me to tell him what all the pin connections are going to be so he can create the board (he has zero control experience which is why I am working on this project, he is all microwave tech). Also what is the global object in your driver?

On a side note, have you done any work with number key pads for input? Eventually we will move to touchscreen display but for now I have been asked to incorporate a keypad into the design for inputting simple numbers into the microcontroller to control the position. It will be indirect motor control inputs so don’t worry about how that translates because it is based off another signal but if you have any experience with the hardware interfacing for a key pad please point me in the right direction.

@ hwalker_MIWV - I’m not sure what you mean by pins, however you can use SparkFun’s L6470 as a reference design if you’re making a custom PCB. The eagle files are in the zip.

[url]http://cdn.sparkfun.com/datasheets/Robotics/L6470_AutoDriver_v13.zip[/url]

The concept of bit banging [url]Bit-Banging: Part 1- Tech Talk - #027 - YouTube

Membrane keypads [url]Keypad Matrix - Tech Talk - #013 - YouTube

Around here we use touch displays from New Haven [url]http://www.newhavendisplay.com/[/url]

You’re gonna need more than a G30 to drive those displays though. The I2C Oled 128x64 displays however are much easier.

@ Mr. John Smith - By pins I simply mean what means from the G30 need to be connected to what pins on the L6470. This is probably a silly question to you but what are eagle files? Lol

@ hwalker_MIWV - Cadsoft Eagle (now by Autodesk). They are project files for the electronics design software Eagle. Your PCB eng. should know what to do with those.

@ Mr. John Smith - What controller would I need to drive a touch screen display? G80? Do you think that would increases costs significantly? I was actually looking at new haven displays. Touch screen may be overkill for us though. I need to get the first prototype finished in about 2 weeks so I was thinking a simple LCD display combined with a membrane keypad will suffice. All I need for now are simple number inputs and a button to initiate calibration sequence.