Main Site Documentation

G30 Design Project


#1

I have been assigned a project (my first real design project as an engineer in industry ;D) by my company which requires me to program a G30 and assimilate it into a system which I am redesigning. I am completely new to embedded design but am a decent programmer with C# being my strong point (hence why I chose the GHI chips instead of a micro-controller which uses C).

Here is a basic overview of the project. What I need to do is program a G30 to take input from a hall effect sensor and control a DC stepper motor (capable of 0.1 degree steps) based on the hall effect sensors input. The G30 must also interface with a display (it only needs to send basic text over the SPI interface). The motor also needs to be controlled by a rocker switch. A calibration mode and switch will also be present.

I am starting with a G30 development board in order to familiarize myself with programming micro-controllers. Currently my program can turn the display back-light on and I can control both the display and the LED located at pin PC7 with one of the buttons. Next I would like to send basic text to the display. I have the brainpad display classes in my code but am not sure how to implement them. This is the first part I need help with.

The next part I will need help with is DC stepper motor control. I currently have an IMSPlus motor controller and a Scheiner M-1713-1.5S motor to control (I will be replacing these with cheaper alternatives in the final design but this is what I have to begin learning the motor control aspects of my program)

Thank you in advance for the help, I greatly appreciate it.


#2

@ hwalker_MIWV - Good luck with your first real world project - exciting times and scary in equal measure :slight_smile:

I have done a similar project to what you have spec’d with excellent results.

Display is basically an N18 https://www.ghielectronics.com/catalog/product/425
Stepper controller is the same IC as https://www.ghielectronics.com/catalog/product/418

So you can happily use a G30 with the above are similar with excellent results.

Here is some sample code that writes a random number in blue via SPI - your code will have slightly different Pin assignments rather than Socket.Pin

using System;
using System.Threading;
using Biospherical.Hardware.ProPower;
using ILI9163;
using Microsoft.SPOT;

namespace ProPowerN18Test
{
    public class Program
    {
        private static Display _display;
        private static readonly Bitmap Bitmap = new Bitmap(118, 20);
        private static readonly Font Font = Resources.GetFont(Resources.FontResources.Arial16);
        private static Random _rnd;
        public static void Main()
        {
            _rnd = new Random();
            _display = new Display(Socket1.Three, Socket1.Five, Socket1.Four, Socket1.Six, Socket1.SpiModule);
            new Thread(Spam).Start();
            Thread.Sleep(Timeout.Infinite);
        }

        static void DrawString(string text, uint x, uint y, Color colour = Color.White)
        {
            Bitmap.Clear();
            Bitmap.DrawText(text, Font, (Microsoft.SPOT.Presentation.Media.Color)colour, 0, 0);
            _display.Draw(Bitmap, x, y);
        }

       
        static void Spam()
        {
            for (;;)
            {
                DrawString(_rnd.Next(99999999).ToString(), 0, 100, ColorUtility.ColorFromRGB(0, 0, 255));
            }
        }
    }
}

#3

@ hwalker_MIWV - 0.1 degree steps? That’s 3,600 discrete steps per rotation. What hall effect sensor are you using?


#4

@ Justin - I think your code is using the GHI display class which is not supported by the G30 a custom display class must be used which comes from the brainpad.cs driver.


#5

@ Mr. John Smith - The hall effect sensor being used is an Allegro A1101LUA-T. This sensor has been used in production of this device for 20 years. I am tasked with hardware and software redesign (The original software is so old that the C syntax is even outdated so that is why I am not even bothering with C and going with my most comfortable language). You are correct by saying that I need 3600 steps per rotation. Currently a 1.8 degree stepper motor is used with an IMSPLUS controller and a worm/spur gear combination to achieve such high resolution. I am open to new motor and motor controller suggestions as the IMSPLUS is almost $100 per unit and we sell hundreds of these devices. I need to cut down costs as much as possible. The Scheider M-1713-1.5S motor being currently used is also very heavy/bulky, and from what I have heard, it is quite hard to control. Maybe that is why the original design included such an expensive motor controller?


#6

YES I figured out the display :slight_smile: ! The dev board display config says RS: PB0 but does not detail what RS is. I figured out that needs to be set as the control pin in the peripherals class from the brainpad code. What exactly does RS stand for? This is very unclear and there is no documentation describing it.

Now on to the motor control. How can I hook up a stepper motor controller and a motor to the dev board? I have bread board material to connect motor and controller together but am not sure how to attach this to the dev board. I currently have an IMSPLUS but they are very overpriced. Thinking I will replace with one of these TI controllers:

http://www.ti.com/lsds/ti/motor-drivers/stepper-driver-with-fets-products.page

I am not sure which controller is best or which motor I should be matching it with. Need recommendations please!


#7

@ hwalker_MIWV -

Maybe RS = Register Select ??

Not sure what you are reading.

EDIT:

Reference N18 LCD Code - DisplayN18_43.cs

rsPin.Write(true) - Sending Data
rsPin.Wriye(false) - Sending Command


#8

I am reading the writing on the development board next to the display. It says:

Display: SPI2
CS: PB1
RS: PB0
RESET: PB12
BL: PA7

Is registry select equivalent to the control pin? Nothing worked until I set the control pin to PB0 now I have full display control. Wondering how I change the color of the display background from black to white now.


#9

Here is a potential motor controller, will this suffice for my high resolution / microstep stepper motor needs? I do not know a whole lot about motor controllers.

http://www.ti.com/product/drv8886at/datasheet


#10

@ hwalker_MIWV - Yes i am using a custom Display class - but not as custom as you probably think.

The stepper IC i mentioned has 128 micro steps so with a 1.8 deg stepper can step about 2 thicknesses of a spiders doodle.

Just ask @ John Smith - he likes steppers…


#11

@ Justin - Both the products you linked me to are discontinued. Are you saying I should use the dSPIN L6470 controller from that module? Keep price in mind as I am manufacturing thousands of these devices over the coming years. Those TI chips are only a couple bucks and the price of a module like you suggested is ~$30

EDIT: Approximately how many flim flams are in a spiders doodle?


#12

@ hwalker_MIWV - I think Justin is just giving you options to use as a reference, for code and for ideas.

We are extremely busy with some big changes but I will try to put together a display demo for G30 for you.


#13

@ Gus - Ok thank you. While you piece together a demo, also write down display options for what we can order with our G30 orders when we start production and shoot me an email please.


#14

@ hwalker_MIWV - there was no mention of price so i went for the gold plated version :slight_smile:

A spiders doodle is only a few microns thick and as we all know there are 2.5 flim flams per micron so ~ 0x07 FF’s or so…

L6470 will give you 128 micro steps so 0.0140625 deg resolution - dam the mechanical backlash :smiley:

L6470 are $7.72 in singles and in 1000’s are $4.38 from Mouser

Here is said L6470 using G80 type uC and N18 type display


#15

@ hwalker_MIWV - To keep cost down stick with your TI controller.


#16

@ Justin - The cheaper the better, even $3 difference saves my company a few thousand off a year’s worth of production. What is the easiest interface method? Will the ST controller be just as easy to control as a TI one? Which is more reliable?

I wish I was working in New Zealand I applied for a work VISA but couldn’t line a job up even though the government is looking for mechanical engineers. Although, microwave engineering in Florida turned out to be pretty damn badass.


#17

@ Mr. John Smith - Thank you John, how do you feel about these Swiss motors? http://www.portescap.com/

I heard they are world renowned. I need a motor that is very reliable so customers do not come back complaining that their missile hit the wrong target or their satellite fell out of orbit after 5 years because I selected a motor with internal plastic parts.


#18

@ hwalker_MIWV - Don’t you need a RAD hardened motor for Space and Military use? Also, you just need to open up the motor yourself to see what’s inside. For step motors you just need to know what the angular accuracy is(5% etc) and the number of steps per revolution. I like oriental motor personally; but my experience is limited. Lastly, your TI is easier to control, but you will have to write your program control motor acceleration, wheas the ST L6470 has a co-processor that does this for you.

http://www.orientalmotor.com/


#19

Good point I am not sure if the old motor was RAD hardened or not.

EDIT: No it doesn’t need to be for this purpose


#20

@ Mr. John Smith - Can you elaborate more on the acceleration control design aspect or link me to a good article?