The Down Range Forum

Member Section => Reloading => Topic started by: alfsauve on December 17, 2020, 11:01:15 AM

Title: Primer Counter - PLC Arduino
Post by: alfsauve on December 17, 2020, 11:01:15 AM
I decided to take the plunge.  Had been wanting to learn about PLCs (programmable logic controllers) for a while.  They're basically very simple uProcessors with built-in memory and I/O.  Raspberry PI is probably one of the well known versions.   I selected Arduino.  It's very simple, well established, open source, and lots of parts and kits are available.  Got my first one (yes first one) on 12/7 and have completed (except for enclosure) my "intelligent" reloading counter.

A 1/3 of my career was spent as a systems analyst and I programmed from machine level on IBM mainframes down to microprocessors in languages from Assembler to COBOL, with things in between like RPG, Pascal, ForTran and SQL in between, so this wasn't hard to figure out.

Four inputs.  A "primed" switch when the primer is fully seated, a "primer reset" switch to undo the 1st switch so you don't have multiple counts.  A "primers out" switch for when the tray is locked back.  And finally a system/counter reset switch.   Initially I was going to utilize my external counter, but decided I didn't really need it.  What I need was for the module to flash the "primer out" light when the counter got to 98.  That warns me I'm almost out.  I also added a buzzer along with the green LED for each time a primer is seated.  This is on a separate output and is pulsed so it's just a short beep.

Below are the Arduino board, a close up of the header interface with the buzzer on board and the two boards hooked up.   Not shown yet, are the two LEDs which are going to be mounted in an model railroad block signal.  Thought that would be cuter than having the LEDs on the enclosure.  I've also include a video link showing me testing it with a breadboard.  No audio as James Earl was busy this week.

https://vimeo.com/489870522/



 

Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on December 18, 2020, 02:06:23 PM
Just did my first 300 rounds using the new PLC.  everything went smoothly.   The low primer warning worked great.  And I love the audio  affirmation.

BUT,  and this is why software is so much better than hardware solution, I nee-e-e-e-d two "enhancements".   (Dang I'm the end user and the software provider.  Best of times, worst of times.)

When I began this with a hardware solution 10 years ago, the objective was to warn me whenever I forgot to prime a case.   The "primed" light does help a bunch, now with s/w all I have to do at every upstroke reset is ask whether the "primed" light is on.  If not then a little warning, maybe flutter the green LED.

Second, having a  counter helps you mark progress.  I have painted rings on my primer follower at 25, 50 and 75 primers so I can just glance at it to know about how many I've done.   But my attention is on the cases to check for powder and seat bullets.  Without interfacing a readout, I could do a double beep every 10 primers to act as a motivator though. 

First however, ExKev just told me I have to get the TPS reports completed or I'll have to work on Saturday.

Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on December 27, 2020, 11:12:51 AM
Not finished yet, but here's an update.

After building an interface board, I found the cutest little pre-made board.   It piggybacks on the Arduino using the header pins.  Makes it easy to remove the Arduino and take it to my office for s/w upgrades.

Everything else is working... EXCEPT.  You know that magnetic security switch I was using for the reset switch (picture below).  Turns out it has too much "bounce" in the contacts.  This is a problem because the first contact resets the primed indicator and then the bounce tells the uP that I've on an upstroke without a primer.  Now I can de-bounce it in software, but then I'd always know that switch was a kluge.  So I've ordered a some microswitches and will see about mounting one for the reset function.

Title: Re: Primer Counter - PLC Arduino
Post by: Rastus on December 27, 2020, 02:33:37 PM
You kinda lost me on the "contact" portion is the bounce in the actual contact portion of the switch or internal to it's relay contacts (if it has an internal relay)? 
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on December 29, 2020, 05:20:04 PM
When switches make contact it's not always as we picture.  Some switches are less perfect than other sand they create a lot of "noise" as the transition from open to close (and visa-versa).    Below you can see a picture from my o-scope of a snap-action switch.  Pretty perfect wave form, at least for low frequency applications.

But then there's the picture from the magnetic reed switch (security type switch) that I was using for my "reset" function.   This doesn't happen every time, but enough to be annoying.  The magnetic field doesn't reliably interact with the switch and the switch (the reed inside) doesn't know whether to close or not.  This "noise" or "bounce" causes my little uProcessor to do funny things.   In my application it performs a "reset" then it thinks I've lower the ram and raised it again without priming. 

I've done two things.  a)  Ditched the magnetic switch as not really suitable for this app.   I could have done a work around, but why fight it.
b) I've inserted a 100ms delay in reading this switch.  This will insure positive contact for this function regardless of the switch in use. 

CLEAR AS MUD?

More pictures and final description of the project soon.  Just painted the switch mounting plate Hornady red.

Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on December 30, 2020, 10:03:08 AM
And it's DONE.   Works quite well.  Can't wait to reload a batch.  Maybe this weekend.

I replaced the magnetic reset switch with a snap action micro switch.  That means I had to make a new bracket for the two switches.  The Arduio board is attached to the bottom of the closure, but everything else is on the top half.  By unplugging the piggy back connector board, the Arduino unit is free to take to the lab for updates.

And I always wanted a model railroad signal lights so I've glued them where they point directly at me when I'm reloading.    There's pictures of the iterations of this project from the hardwired version (red board) to the Arduino interface to the piggy back connections board.  Video to follow once I edit it.

Here's the functions it performs:

Press the Sys Reset Button:  The internal counter is set to zero and the lights & buzzer flash/beep 4 times rapidly
Prime a case: The green light comes on and a single short beep is heard and the counter is incremented.
Go to the top of the stroke:  The green light is reset.
Go to the top of the stroke without priming:  4 long beeps.
Internal counter goes above 97:  Red light start flashing.
Internal counter goes above 100:  No warning about missing primer.
Primer tray locked back (no primers):  Red light is on at bottom of stroke and the counter cannot be advanced.




Title: Re: Primer Counter - PLC Arduino
Post by: Jim Kennedy-ar154me on December 30, 2020, 10:14:49 AM
Do you think you will need either a cover to protect it or a fan to keep it cool?
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 01, 2021, 11:03:10 AM
No cover, other than the enclosure needed.   Might need a fan to cool me down because I'll be reloading at breakneck speeds.


Got the Arduino Nano (yes, the also make a micro) and am going to update the whole project, ALREADY.   Smaller board, but the wire will be soldered to it not using the screw terminals.  The Nano board though will be plugged into the board and I can remove it for s/w updates easily.

Here's the Nano board on the bench breadboard.  The final board will be just a little bit smaller.  It will take a while because there about 28 solder connection to make.

Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 02, 2021, 04:25:31 PM
And done with the conversion to Nano.

Put the whole thing on a smaller breadboard.  Of course I had to solder my leads to the board, but the Nano just unplugs so that I can do upgrades.   If you look at the picture you'll notice the power cable doesn't fit through the grommet.

But I'm already onto the next version.  It'll also use the Nano, but on a bigger breadboard so I have room for the screw terminals.  At that point I'll probably add a 4-digit display to show the counter value.    And I'll probably get another enclosure at that point as well.

Title: Re: Primer Counter - PLC Arduino
Post by: Rastus on January 02, 2021, 06:15:02 PM
Alf maybe you should market this as a kit to one of the manufacturers...
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 03, 2021, 10:49:45 AM
OH HEAVENS NO! 

I'm not starting any business.  I'm retired and the only schedule I keep is the puppies and the doctors.



Both Hornady and Dillon have there systems.  I could probably interface with their switches, but I like mine.   
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 15, 2021, 10:08:21 AM
DONE:   At least for now.  I need to evaluate the buzzer.  It's a little weak.   And I may add a digital counter display.  Modules are on order to play with.

First I made a new interface board for the Nano.  It is larger and can accommodate wire terminals.   I've allowed for connections to a possible counter display and for an extra/option/external buzzer.   With this setup.  All I have to do is unplug the USB cable from the Nano, which is like a daughter board to the main PCB.  Then I unplug the Nano and can take it to my office for any software upgrades.  Simple

I got a new enclosure.  You can see me marking it off by using another printed circuit board.  Then the box drilled out.   I decided that for strain relief I'd just go with a pop-in plastic ring.  This isn't going to get moved around a lot so strain relief isn't a big issue.  I also cut away all the tie wraps and used a nylon cloth sheath to make the wire look professional.

I carefully painted the box (Hornday red, of course) and heat cured it (140f for an hour).  A picture of everything installed in the box. Finally a picture of the whole setup with the LEDs in the reset mode.

I've loaded 500 rounds with this setup and latest s/w.  It worked really great and has provided me with the warning of missing primer that I've been wanting for some time.   I'm at the bottom of my bucket of brass and some of this brass is in bad shape or has severely crimped primer pockets.  My counter/warning system has worked like a champ. 




Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 15, 2021, 10:09:09 AM
Rest of the pictures
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 15, 2021, 10:18:29 AM
Finally.  Just to bore you to tears.  Here's the concept drawing and the PCB layout.
Title: Re: Primer Counter - PLC Arduino
Post by: MikeBjerum on January 15, 2021, 06:49:29 PM
Good job Alf!
Title: Re: Primer Counter - PLC Arduino
Post by: Rastus on January 15, 2021, 08:50:31 PM
Good job Alf!

Yeah, he seems to be pretty smart fellow.
Title: Re: Primer Counter - PLC Arduino
Post by: MikeBjerum on January 16, 2021, 10:30:24 AM
Alf, I am reading your last schematic.  The "Primed Buzzer":  Does this buzz with each primed case (noise means OK), or does it buzz for a malfunction (noise means stop and fix)?
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on January 16, 2021, 11:37:42 AM
One short beep when the Primed switched is trip and the green light comes on.  Aural and visual confirmation.

Two short beeps  every 10th primer, to mark progress.

Four medium long beeps, no lights if the ram goes up and the Primed LED is not lit.

The only thing I might change is add the red lights blinking along with the 4 beeps for the alarm.
Title: Re: Primer Counter - PLC Arduino
Post by: MikeBjerum on January 16, 2021, 02:47:49 PM
Working with you in your reloading room must be like working with Kurt Russell in The Computer Wore Tennis Shoes ... Beep Beep Chirp Click Beep  ;D
Title: Re: Primer Counter - PLC Arduino
Post by: alfsauve on April 27, 2021, 10:41:16 AM
Had to put aside electronics work, and reloading for 2 months while the wife renovated the basement.   Things finally getting back to normal.

My idea for a fixture to hold the counter was to use an O gauge model railroad billboard.  I'd have the counter in the middle with the Hornady logo above it.  But I want to touchy-feely this before I buy and Wuhan has played havoc with going to train stores.

Then I saw the light.   Why not make a model target and put the counter in the middle of the target.

Voila!

I haven't dressed the wires yet. 

Title: Re: Primer Counter - PLC Arduino
Post by: Rastus on April 28, 2021, 09:33:43 PM
Nice job.