Shop Learn P1 Docs P2 Docs
My *NEW* Glorified PCB Turner/Flipper :) — Parallax Forums

My *NEW* Glorified PCB Turner/Flipper :)

idbruceidbruce Posts: 6,183
edited 2020-07-28 14:37 in Customer Projects
Hello Everyone

It has been a while since I have posted any content, so I thought I would share my lastest machine (project) with you, especially since it uses a stepper motor :)

I must admit that I purposely posted a misleading title :) However this new machine will certainly turn and flip a PCB :)

This new machine is actually intended to rotate some frames, constructed from square aluminum tubing, for painting purposes. I must say that it rotates the frames perfectly, without any struggle.

Here are some of the details.... There is an Applied motion 30VDC power supply which supplies power to a Gecko G251 Stepper Drive, and the power supply also has a 5VDC logic circuit, which supplies power to the brains, a Propeller Project Board. Rotation is provided by an Applied Motion NEMA 23 high torque stepper motor, being the obsolete HT23-400. The machine also has gearing which provides 3.84:1 reduction.

It also sports a handy receptacle at the rear for accepting detachable PC power cords, an on/off switch, a heavy duty aluminum handle, with a foam rubber grip, some rubber feet, a pipe flange on the bottom, for elevated mounting, and two pushbuttons on the front, to control the direction of rotation.

Everything is built into or around a NEMA 1, hinged cover enclosure.

Without further delay, I will now provide the code and some photos :)
#define STEP_PIN 1

// The FrameTurner utilizes a GeckoDrive G251 microstepping drive
// to run the stepper motor.  It is a 1/10 microstepping drive.
// Additionally, the FrameTurner utilizes an Applied Motion HT23-400
// stepper motor, which has a step angle of 1.8 degrees, and requires
// 200 incremental steps to make a full revolution.  Considering that
// the G251 is a 1/10 microstepping drive, the G251 will require 2000
// step pules to make the HT23-400 turn one full revolution.

// The FrameTurner is an incremental parts turner which will rotate a
// part either clockwise or counterclockwise, a predetermined number
// of degrees, based upon specific button presses. However, the FrameTurner
// utilizes a gear reduction ratio 1:3.84, which must be compensated for in
// the steps required.
// 22-1/2 degree turn equals 2000 / 16 = 125 step pulses
//    125 step pulses * 3.84 = 480 step pulses (1/16 revolution)
// 45 degree turn equals 2000 / 8 = 250 step pulses
//    250 step pulses * 3.84 = 960 step pulses (1/8 revolution)
// 90 degree turn equals 2000 / 4 = 500 step pulses
//    250 step pulses * 3.84 = 1920 step pulses (1/4 revolution)
// 180 degree turn equals 2000 / 2 = 1000 step pulses (1/2 revolution)
//    250 step pulses * 3.84 = 3840 step pulses (1/2 revolution)
#define STEP_PULSES 960 // (1/8 revolution)

// The G251 requires a minimal pulse width of 1 microsecond
#define PULSE_WIDTH (CLKFREQ / 1000000)

// At this point in time, the FrameTurner will be used for rotating parts
// during a painting process, so speed is definitely not the main objective.
// A slow steady pace of movement is preferred, so ramping is not needed.
// This setting will directly affect the speed of rotation.
#define STEP_PAUSE (CLKFREQ / 50)

#include "simpletools.h"
#include <stdint.h>

uint8_t direction;

int rotate();

int main()
  // Set DIRA as an output.

  // Set DIRA as an output.
  DIRA |= 1 << STEP_PIN;

  // Set up the CTRMODE of Counter A for NCO/PWM single-ended.
  CTRA = (4 << 26) | STEP_PIN;

  // Set the value to be added to PHSA with every clock cycle.
  FRQA = 1;
    if(input(CLOCKWISE_BUTTON) == 1)
      direction = 1;
    else if(input(COUNTERCLOCKWISE_BUTTON) == 1)
      direction = 0;

int rotate()
  int32_t counter;
  uint32_t steps;
  if(direction == 0)
    // Set the direction of rotation
    // Set the direction of movement
    OUTA &= (~1 << DIRECTION_PIN);
  // Copy the required amount of steps needed
  steps = STEP_PULSES;
  // Get the current System Counter value.
  counter = CNT;
  while(steps != 0)
    // Send out a high pulse on the step pin for the desired duration.
    // Wait for a specified period of time before sending another
    // high pulse to the step pin.
    waitcnt(counter += STEP_PAUSE);
    // Decrement the step count
1836 x 3264 - 682K
1836 x 3264 - 547K
1836 x 3264 - 860K
3264 x 1836 - 2M


  • mparkmpark Posts: 1,266
    Looks good, @idbruce! Do you have a video of it in action?
  • Thanks :) I already have some paint on it :) I thought about trying to cover it up, but I figured that would be a PITA. I don't have a video at the moment, but when I paint my next frame later today, I will make one.
  • Good to hear from you. The mechanical engineering and application side tends to be lacking on the Parallax forum but your input always boosts it. We love your projects and love hearing about them and seeing the photos, but look forward to seeing a video of it in action. Don't worry about the paint yet, you know we like to get into the guts of things and see it warts and all. Then when it's all prettied up you can show us another video.
  • Thanks Peter

    The paint I referred to was overspray from painting my frames :) I already have yellow paint on my once new buttons :)

    I will make a video, but I do not believe that it will be all that exciting. It only rotates forty-five degrees with each button press and it rotates very slowly :)
  • Interest is in the mind as excitement is in the heart of the beholder.

    Seemingly small details are what may be of interest, and if there is a Prop in it, then we are always excited. Just make sure you have even lighting and avoid using any flash to show up those small details.
  • Peter
    Just make sure you have even lighting and avoid using any flash to show up those small details.


    Considering that the application is painting, I actually have the machine set up in a very poor location, because the lighting is horrible. However, I have a 4 foot flourecent directly overhead, which is good enough for what I am doing. I will have to provide extra ligt just for filming purposes :)
  • idbruceidbruce Posts: 6,183
    edited 2020-08-01 21:17
    Seemingly small details are what may be of interest

    Yea, yea, I know :)

    Here is a small detail for you. My new machine is assisting in helping me paint these frames. This is 2 out of 4 models (10 inch and 26 inch) of a new product line, of hot wire foam cutting bows. The 50 inch and 26 inch deep throat would be hard to photograph at the moment. Of course my crappy photos don't do these beauties any justice :)

    Oh.... You cannot tell by the photos, but these babies are bright yellow :)

    They still need to be wired up :(

    BTW: I made a video, but I just have to take the time to figure it all out, to get it uploaded :)
    3264 x 1836 - 2M
    3264 x 1836 - 2M
  • idbruceidbruce Posts: 6,183
    edited 2020-08-03 13:32
    Okay, here is another photo showing all four frames and the nice yellow paint can be seen much better :)

    EDIT: They all still need to wired up and end caps installed.
    3092 x 1224 - 457K
  • Peter

    You have to wait a bit longer for the video, because Youtube won't let me in at the moment :(

    However, I do have several other photos with my frames attached to the machine :)

    Hmmmmmm.... I think I will try to attach video.... I don't know if Parallax allows this.

    That didn't work....
    3264 x 1836 - 2M
Sign In or Register to comment.