The Down Range Forum
Member Section => Down Range Cafe => Topic started by: alfsauve 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.
-
just ask Santa...
https://www.markvii-loading.com/loading-presses/revolution/101-1176.html
-
I'd get a pair, but gosh darn, they're out of stock - back ordered.
-
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);
}
}
}
-
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 (https://vimeo.com/489870522)
-
And finally a short video (no audio) with my prototype board
<snip>
https://vimeo.com/489870522 (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?
-
Rastus, I was hyperventilating as well until I spotted two items in the description:
Commercial reloading
3,500 rounds per hour
-
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.
-
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!
-
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.