You must be logged in to reply.

Page 1 of 12 out of 113 messages.

G30 Design Project

1 like
Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
I have been assigned a project (my first real design project as an engineer in industry Grin) 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.
Reply #1 — Posted 1yr ago
by Justin | Superhuman | 90,900 exp
Reply #1 — Posted 1yr ago
by Justin | Superhuman | 90,900 exp
@hwalker_MIWV - Good luck with your first real world project - exciting times and scary in equal measure Smiley

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));
            }
        }
    }
}
Reply #2 — Posted 1yr ago
by Mr. John Smith | Legend | 42,263 exp
Reply #2 — Posted 1yr ago
by Mr. John Smith | Legend | 42,263 exp
@hwalker_MIWV - 0.1 degree steps? That's 3,600 discrete steps per rotation. What hall effect sensor are you using?
Reply #3 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
Reply #3 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
@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.
Reply #4 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
Reply #4 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
@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?
Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
Post has been deleted.
Reply #6 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
Reply #6 — Posted 1yr ago (modified)
by hwalker_MIWV | Junior | 800 exp
YES I figured out the display Smiley ! 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!
Reply #7 — Posted 1yr ago (modified)
by willgeorge | King | 33,998 exp
Reply #7 — Posted 1yr ago (modified)
by willgeorge | King | 33,998 exp
@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
Reply #8 — Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
Reply #8 — Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
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.
Reply #9 — Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
Reply #9 — Posted 1yr ago
by hwalker_MIWV | Junior | 800 exp
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

Page 1 of 12 out of 113 messages.

You must be logged in to reply.