Author Topic: Programmable Controllers for Reloading  (Read 1964 times)

alfsauve

  • Semper Vigilantes
  • Top Forum Member
  • *****
  • Posts: 7620
  • DRTV Ranger
  • Liked:
  • Likes Given: 587
Programmable Controllers for Reloading
« on: December 10, 2020, 12:01:19 PM »
As some may know I spent about 1/3 of my career in the computer industry.  I programed from the machine code (IBM 360 and Univac VS-9) to Object Level and many languages in between.  Not just Assembler, COBOL & BASIC, but ForTran, Pascal, RPG and numerous others.  But that was decades ago.   I thought in my old age, I might just play around with some of the programmable controllers, like Rasberry Pi and Arduino. So this week I bought one of the little Arduino UNO units for $20.  Cute little thing, less than 2"x3".  They provide a pseudo-C++ language compiler free of charge.

This ties in with shooting as my intention was to replace the hard-wired counter that I use on my reloading press with a microprocessor.  This will allow some flexibility and new features.  For example, it will count the primers and start flashing once I reach 98, so that I know I'm going to need to refill them soon.

I had forgotten what a time suck programming is.  When I finally got my undergrad the computer department (Data Processing) awarded my wife a "Computer Widow" certificate. ;)

I'm think around the new year I should have this project completed and installed on my press.

The big step will then be to integrate an optical position encoder so the processor can monitor each step of the reloading process.  In essence it would replace the 3 switches on the press.


Will work for ammo
USAF MAC 437th MAW 1968-1972

les snyder

  • Top Forum Member
  • *****
  • Posts: 1010
  • Liked:
  • Likes Given: 0

alfsauve

  • Semper Vigilantes
  • Top Forum Member
  • *****
  • Posts: 7620
  • DRTV Ranger
  • Liked:
  • Likes Given: 587
Re: Programmable Controllers for Reloading
« Reply #2 on: December 10, 2020, 09:13:08 PM »
I'd get a pair, but gosh darn, they're out of stock - back ordered.
Will work for ammo
USAF MAC 437th MAW 1968-1972

alfsauve

  • Semper Vigilantes
  • Top Forum Member
  • *****
  • Posts: 7620
  • DRTV Ranger
  • Liked:
  • Likes Given: 587
Re: Programmable Controllers for Reloading
« Reply #3 on: December 11, 2020, 09:38:14 AM »
To bore you to death, and because I like to hear myself type.  It'll take me a little time to rewire my press.  The switches are currently switching 12VDC and for the app they just need to be providing ground. 

Here's the code.  Not the most elegant.


//    Reloading Counter - Basic Version
// Has 4 input switches.  System/counter reset button.
//                        Primed switch when a case gets primed
//                        Primed reset switch to reset above so no double counting
//                        Primer out switch when the tray is locked back by follower
//
// Has 3 Outputs
//                        Primed and increment Counter GREEN LED
//                        Primers Out  RED LED
//                        Reset the counter (Amber LED)

//          I/O Pin Assignments
const int IPrimed = 1;      //Goes LOW when primed
const int IPrimedReset = 2; //Goes LOW to reset 1
const int IPrimersOut = 3;  //Goes LOW when primers run out
const int ISysReset = 4;    //Goes LOW when counter reset switch is pressed

const int OPrimed = 13;     // Green LED to indicate case is primed
const int OPrimersOut = 12; // Red LED to indicate primers are out
const int OSysReset = 11;   // Resets external counter

//     Variables used
int SysReset = HIGH;
int PrimersOut = LOW;
int Primed = LOW;
int PrimedReset = LOW;
int PrimerCounter = 0;
int PrimedFlag = LOW;
unsigned long BlinkTime = 0;
int BlinkFlag = LOW;
int LowPrimerWarning = 98;


void setup() {
 
  pinMode(OPrimed, OUTPUT); // Primed
  pinMode(OPrimersOut, OUTPUT); // Primers Out
  pinMode(OSysReset, OUTPUT); // reset counter

  pinMode(IPrimed, INPUT_PULLUP); // Primed switch
  pinMode(IPrimedReset, INPUT_PULLUP); // Primed Reset switch
  pinMode(IPrimersOut, INPUT_PULLUP); // Primers Out switch
  pinMode(ISysReset, INPUT_PULLUP); // System Reset switch
}

void loop() {

  SysReset = digitalRead(ISysReset);
 
  // Perform System Reset if Reset button is pushed
  while (SysReset == LOW) {
    digitalWrite(OSysReset, LOW);       //Reset Counter
    PrimerCounter = 0;
    BlinkFlag = LOW;
   
    //Blink Lights to signal reset
    digitalWrite(OPrimed, HIGH);
    digitalWrite(OPrimersOut, HIGH);
    delay(200);
    digitalWrite(OPrimed, LOW);
    digitalWrite(OPrimersOut, LOW);
    delay(200);
    digitalWrite(OPrimed, HIGH);
    digitalWrite(OPrimersOut, HIGH);
    delay(200);
    digitalWrite(OPrimed, LOW);
    digitalWrite(OPrimersOut, LOW);
    delay(200);
    digitalWrite(OPrimed, HIGH);
    digitalWrite(OPrimersOut, HIGH);
    delay(200);
    digitalWrite(OPrimed, LOW);
    digitalWrite(OPrimersOut, LOW);
 
    digitalWrite(OSysReset, HIGH);      //Set Counter Reset back to HIGH
    delay(350);                         // Give user one more chance to take finger off button
    SysReset = digitalRead(ISysReset);  // Read Button Again
    PrimedFlag == LOW;
 }

  //Normal Operating Functions

  // Read the switches
  Primed = digitalRead(IPrimed);
  PrimersOut = digitalRead(IPrimersOut);
  PrimedReset = digitalRead(IPrimedReset);

  //  See if we just primed a case
  if (Primed == LOW && PrimersOut == HIGH && PrimedFlag == LOW) {
    digitalWrite(OPrimed, HIGH);
    PrimedFlag = HIGH;
    PrimerCounter ++;
  }

  //  Check to see if we're on the upstroke and can reset the Primed LED
  if (PrimedReset == LOW) {
    digitalWrite(OPrimed, LOW);
    PrimedFlag = LOW;
  }

  //  Check to see if primers are all out
  if (PrimersOut == LOW) {
    digitalWrite(OPrimed, LOW);
    digitalWrite(OPrimersOut, HIGH);
  } else {
    if (PrimerCounter < LowPrimerWarning) {
      digitalWrite(OPrimersOut, LOW);
    }
  }

  //Let's warn about impending primer outage if counter is at 98 or higher
  if (PrimerCounter >= LowPrimerWarning && PrimersOut == HIGH) {
    if (millis() - BlinkTime >= 450) {
      if (BlinkFlag == LOW) {
        BlinkFlag = HIGH;
      } else {
        BlinkFlag = LOW;
      }
    BlinkTime = millis();
    digitalWrite(OPrimersOut, BlinkFlag);
    }
  }
}
Will work for ammo
USAF MAC 437th MAW 1968-1972

alfsauve

  • Semper Vigilantes
  • Top Forum Member
  • *****
  • Posts: 7620
  • DRTV Ranger
  • Liked:
  • Likes Given: 587
Re: Programmable Controllers for Reloading
« Reply #4 on: December 11, 2020, 09:43:41 AM »
And finally a short video (no audio) with my prototype board

Green LED  - brass primed
Red LED -  Primer tray is locked back - out of primers
Amber LED -  Reset line to external counter

Switches from bottom to top

1 - Primed switch, bottom of stroke
2 - Reset for primed switch, top of stroke  keeps you from double counting
3 - Primer tray locked back - out of primers
4 - Counter/System reset

Notice the rapid flashing during system reset.  And the amber LED respresents the reset signal to the external counter.
You can keep priming until you get low (in this case after 4 primers, but in the final s/w it'll be after 97) then the red LED flashes.
You can keep on priming until the Primer Out (tray locked back) comes on.  Then you can't increment the counter anymore.


https://vimeo.com/489870522
Will work for ammo
USAF MAC 437th MAW 1968-1972

Sponsor

  • Guest
Re: Programmable Controllers for Reloading
« Reply #5 on: Today at 10:10:37 AM »

Rastus

  • Mindlessness Fuels Tyranny
  • Top Forum Member
  • *****
  • Posts: 7224
  • DRTV Ranger
  • Liked:
  • Likes Given: 832
Re: Programmable Controllers for Reloading
« Reply #5 on: December 12, 2020, 08:48:20 AM »
And finally a short video (no audio) with my prototype board
<snip>

https://vimeo.com/489870522

That's really slick Alf.  I like it.  You know you need to followup with another video when it's all hooked up in the system with special details on the sensors, right?

Les...$10k?  Dang just looking at that page for the Mark 7 took my breath away.  I couldn't look very long because the price scared the heck out of me.  Is that thing for commercial use?
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British Prime-Minister (1759-1806)
                                                                                                                               Avoid subjugation, join the NRA!

MikeBjerum

  • Top Forum Member
  • *****
  • Posts: 10996
  • DRTV Ranger
  • Liked:
  • Likes Given: 1146
Re: Programmable Controllers for Reloading
« Reply #6 on: December 12, 2020, 01:12:03 PM »
Rastus, I was hyperventilating as well until I spotted two items in the description:

Commercial reloading
3,500 rounds per hour
If I appear taller than other men it is because I am standing on the shoulders of others.

alfsauve

  • Semper Vigilantes
  • Top Forum Member
  • *****
  • Posts: 7620
  • DRTV Ranger
  • Liked:
  • Likes Given: 587
Re: Programmable Controllers for Reloading
« Reply #7 on: December 12, 2020, 03:56:14 PM »
The interface board has been completed.   Now, to work on the documentation and labeling, THEN, I'll rewire the switches on the press and hook it up.  The boards will just be sitting on the bench until I can get an enclosure.

Will work for ammo
USAF MAC 437th MAW 1968-1972

MikeBjerum

  • Top Forum Member
  • *****
  • Posts: 10996
  • DRTV Ranger
  • Liked:
  • Likes Given: 1146
Re: Programmable Controllers for Reloading
« Reply #8 on: December 12, 2020, 06:29:30 PM »
Back when I was in High School, I used to get those Radio Shack projects:  Radio, voice activated switches, electric eye counters, etc.  They were cheap, and filled rainy days with something to do.  However, they were not at this level, and they were all thought out for me, unlike what you know how to do.

Enjoying watching what you are up to!
If I appear taller than other men it is because I am standing on the shoulders of others.

Rastus

  • Mindlessness Fuels Tyranny
  • Top Forum Member
  • *****
  • Posts: 7224
  • DRTV Ranger
  • Liked:
  • Likes Given: 832
Re: Programmable Controllers for Reloading
« Reply #9 on: December 13, 2020, 09:20:25 AM »
Rastus, I was hyperventilating as well until I spotted two items in the description:

Commercial reloading
3,500 rounds per hour

Thanks Mike.  I think I passed out from the price before I read that far along.
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British Prime-Minister (1759-1806)
                                                                                                                               Avoid subjugation, join the NRA!

 

SMF spam blocked by CleanTalk