I've wanted for some time to explore the world of Programmable Logic Controllers, microprocessors on a board. I've have a background in everything from mainframes (Univac VS & IBM 360) to PC/MACs and everything in-between. With languages from Assembler at the OS level to SQL, Algol, Pacal. Even throw in a lot of Cobol, ForTran, and RPG in there. My reloading counter project just seemed like an ideal one to jump in with PLCs.
/* This post is in two parts. The first a summary of the project, the counter and how it works, and the second part is the gory details of the h/w and s/w. Read what you want. I know there are those readers who have never missed priming a case, whose press never jams, who never have to stop and deal with dented case mouths or split cases, and who never been interrupted by phone calls, children or a puppy peeing on their shoe. BUT, for the rest of us please don't waste our time telling us so. Just move on to the next post. Quite frankly I'm only interested in confirmation bias and hearing/seeing what others have done along this line. */
THE COUNTER:
If you've seen my hardware (h/w) version you know that by putting a couple of switches on my press, I can signal when I've done a priming motion, count the number of times and warn when the primer tray is locked back (primers out).
https://www.thehighroad.org/index.php?threads/primer-counter-rev-3.874949/
But there was more I wanted to accomplish and doing it in h/w would have been a pain. Maybe in 1970 using TTL chips sure I'd have tackled it. But we're in 2021 and small processor boards complete with memory and i/o are the rage.
There are two boards commonly used by hobbyist these days, Raspberry Pi and Arduino. The Arduino caught my attention and that's what I based my project on. The basic Uno board is available for under $20 and the even smaller Nano for around $5. Still using the same three switches on my press from the h/w version I came up with a plan. Here's what I wanted the s/w to do. ( * new features)
1) Detect when a full press prime action is accomplished
a) Turn on a visual indicator
b)* Sound an audible alarm (single beep)
c)* Provide a double beep every 10 primers
d) Increment an internal counter
e) Prevent further counting until reset
2) Detect when the press is near the top of it's stroke
a) Reset the "primed" light
b) Allow counting to be incremented on the next cycle
c)* Sound an alarm if the "primed" light was not first lit.
3)* Detect when the primer counter is >97 and begin flashing a visual indicator
4) Detect when the primer tray is locked back indicating out of primers
a) Change the flashing visual indicator from flashing to solid
b) Prevent further incrementation of the counter
5) System reset switch to reset counter and start program over again
For the time being I'm doing away with an actual counter display. I may add that later.
Here's what the Uno board and my breadboard for testing looked like.
I made a custom interface board and put it all in an enclosure.
And here are up close pictures of the warning LEDs and the 3 switches used on the press. I had wanted to use model railroad block signals, but not sure I can adapt the tall ones, so I used the smaller "dwarf" signals. They're glued on the press at an odd angle so they shine directly at me when I'm reloading.
THUS ENDS THE BASIC SUMMARY
No sooner than I got this assembled and working and the end user, me, requested revisions and updates from the systems programmer, still me. Plus, I discovered all sorts of things about Arduinos including the smaller Nano, the shield, or piggyback-like a daughter board with the connectors. This project will never end.
First I built a custom interface board. Here it is hooked up but without the final LEDs or the enclosure. Problem is when I need to update the S/W I have to unplug those 8 header cables and that was a pain.
Then I discovered the shield board w/ connectors, so If the Arudino board can be unplugged easily. And that's how it is installed at the moment. Of course the resistors had to be soldered in-line and the beeper is just rattling around in the enclosure.
Wait, there's the Nano. Oh so cute. Here's the Nano on the breadboard.
I've currently built a small circuit board with headers for the Nano. Now it does mean that all the connections are soldered in, but it's a much smaller package and the Nano unplugs so easily for updates. At $5ea I've got 3 of them to play with. I'll add a final picture when I get it mounted in the enclosure. That frees up my UNO board and the shield connectors for the lab bench and other projects.
Software-wise, the C++ style language was easy to learn. The compiler assumes you'll have at a minimum 2 functions, "startup" which will run once and "loop" which will loop ad-nauseum. I had intended to do this as an interrupt driven project anyway so this was ideal. Read the switches, check all the conditions, repeat forever.
This is all open source stuff and is headed up out of Italy. Some manual and references suffer a little in translation but it's been fun. I'm working on using actual Interrupt Service Routines and utilizing an optical position encoder for a future version of this.
/* This post is in two parts. The first a summary of the project, the counter and how it works, and the second part is the gory details of the h/w and s/w. Read what you want. I know there are those readers who have never missed priming a case, whose press never jams, who never have to stop and deal with dented case mouths or split cases, and who never been interrupted by phone calls, children or a puppy peeing on their shoe. BUT, for the rest of us please don't waste our time telling us so. Just move on to the next post. Quite frankly I'm only interested in confirmation bias and hearing/seeing what others have done along this line. */
THE COUNTER:
If you've seen my hardware (h/w) version you know that by putting a couple of switches on my press, I can signal when I've done a priming motion, count the number of times and warn when the primer tray is locked back (primers out).
https://www.thehighroad.org/index.php?threads/primer-counter-rev-3.874949/
But there was more I wanted to accomplish and doing it in h/w would have been a pain. Maybe in 1970 using TTL chips sure I'd have tackled it. But we're in 2021 and small processor boards complete with memory and i/o are the rage.
There are two boards commonly used by hobbyist these days, Raspberry Pi and Arduino. The Arduino caught my attention and that's what I based my project on. The basic Uno board is available for under $20 and the even smaller Nano for around $5. Still using the same three switches on my press from the h/w version I came up with a plan. Here's what I wanted the s/w to do. ( * new features)
1) Detect when a full press prime action is accomplished
a) Turn on a visual indicator
b)* Sound an audible alarm (single beep)
c)* Provide a double beep every 10 primers
d) Increment an internal counter
e) Prevent further counting until reset
2) Detect when the press is near the top of it's stroke
a) Reset the "primed" light
b) Allow counting to be incremented on the next cycle
c)* Sound an alarm if the "primed" light was not first lit.
3)* Detect when the primer counter is >97 and begin flashing a visual indicator
4) Detect when the primer tray is locked back indicating out of primers
a) Change the flashing visual indicator from flashing to solid
b) Prevent further incrementation of the counter
5) System reset switch to reset counter and start program over again
For the time being I'm doing away with an actual counter display. I may add that later.
Here's what the Uno board and my breadboard for testing looked like.
I made a custom interface board and put it all in an enclosure.
And here are up close pictures of the warning LEDs and the 3 switches used on the press. I had wanted to use model railroad block signals, but not sure I can adapt the tall ones, so I used the smaller "dwarf" signals. They're glued on the press at an odd angle so they shine directly at me when I'm reloading.
THUS ENDS THE BASIC SUMMARY
No sooner than I got this assembled and working and the end user, me, requested revisions and updates from the systems programmer, still me. Plus, I discovered all sorts of things about Arduinos including the smaller Nano, the shield, or piggyback-like a daughter board with the connectors. This project will never end.
First I built a custom interface board. Here it is hooked up but without the final LEDs or the enclosure. Problem is when I need to update the S/W I have to unplug those 8 header cables and that was a pain.
Then I discovered the shield board w/ connectors, so If the Arudino board can be unplugged easily. And that's how it is installed at the moment. Of course the resistors had to be soldered in-line and the beeper is just rattling around in the enclosure.
Wait, there's the Nano. Oh so cute. Here's the Nano on the breadboard.
I've currently built a small circuit board with headers for the Nano. Now it does mean that all the connections are soldered in, but it's a much smaller package and the Nano unplugs so easily for updates. At $5ea I've got 3 of them to play with. I'll add a final picture when I get it mounted in the enclosure. That frees up my UNO board and the shield connectors for the lab bench and other projects.
Software-wise, the C++ style language was easy to learn. The compiler assumes you'll have at a minimum 2 functions, "startup" which will run once and "loop" which will loop ad-nauseum. I had intended to do this as an interrupt driven project anyway so this was ideal. Read the switches, check all the conditions, repeat forever.
This is all open source stuff and is headed up out of Italy. Some manual and references suffer a little in translation but it's been fun. I'm working on using actual Interrupt Service Routines and utilizing an optical position encoder for a future version of this.
Last edited: