Arduino control for a 3” rotary table

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
I finished a prototype that is almost working well. When I was testing it in production, it started working well, but after 2 or 3 minutes, when no key is pressed it still shows a random keypress on the LCD or the keypad freezes and I have to unplug and plug the electrical box again.
I suspect it may be the keypad wires or any interference caused by the environment? The milling machine? I used 3 foot long wires for the keypad, I don't know if that can be an issue. Has anybody faced a similar issue with these components?

Schematic-Miter-Fixture.JPG IMG_4684.jpg IMG_4685.jpeg IMG_4686.jpeg IMG_4689.jpeg IMG_4691.jpg Schematic-Miter-Fixture.JPG Schematic-Miter-Fixture.JPG IMG_4684.jpg IMG_4685.jpeg IMG_4686.jpeg IMG_4689.jpeg IMG_4691.jpg Schematic-Miter-Fixture.JPG IMG_4684.jpg IMG_4685.jpeg IMG_4686.jpeg IMG_4689.jpeg IMG_4691.jpg

Schematic-Miter-Fixture.JPG
IMG_4684.jpg
IMG_4685.jpeg
IMG_4686.jpeg
IMG_4689.jpeg
IMG_4691.jpg




Schematic-Miter-Fixture.JPG IMG_4684.jpg IMG_4685.jpeg IMG_4686.jpeg IMG_4689.jpeg IMG_4691.jpg
 
3 feet of wire can make a pretty good antenna for picking up random signals. You might have better results if you use shielded wire for all connections to the Arduino. Quick way to find out is to use aluminum foil to wrap around the wires for shielding.
 
Non-shielded wire was my first thought as well, although I have a similar set-up and I am not seeing the same problem. Also - take a look at the wire routing inside your enclosure - probably better to route some of those wires further away from the PSU.

As "awake" noted - check how you have your grounding set up.

Regarding the "freezing" issue: In a separate email to me you noted that you had made some coding changes and that out-of-memory errors might be a concern. One way you can test this is to just comment out one or more of the larger subroutines and see if the problem goes away (of course, you won't be able to use those subroutine functions while testing).

Finally - double check all your connections. A loose wire or bad solder joint can cause all kinds of problems and can be very difficult to find. One thing you can do is just wiggle various connections and see if your random keypress shows up.

God luck.
 
I notice that you are using the push on type jumper wires for the connections to your Arduino. These are really only designed for prototype work with Breadboards, etc. I find them very unreliable especially in a manufacturing environment. A better route would be to use an Arduino Shield that breaks out each terminal to a screw connection that you can clamp each wire under. Or just solder your wires directly to the Arduino pins and use shrink tube over the connections. Either of these methods are better at handling everyday usage in a shop environment.
Another thing to watch is the location of your Arduino in relation to anything with A/C power. Switching power Supplies can cause interference and it is always a good idea to keep your DC away from your A/C which includes your Arduino. Always try to keep your Arduino as far away as possible from these A/C devices.
And by all means follow the other suggestion like short leads, wire shielding and proper grounds.

Good luck with your project.

Cheers
Willy
 
Last edited:
If you are using shielded cable you should only ground one end of the shield. If you ground both ends its possible to created "circulating ground current" in the shield which can cause issues in some cases.
 
First don't forget the golden rule "only make 1 change at a time until you have that 1 fixed then go onto the next". You seem to have 2 problems, 1 software and 1 hardware. Random signals can be very hard to track down and you will need patience to solve it/them. Shielding typically is never grounded, grounding one end can cause a capacitance to build up and cause even more problems. Don't forget that shielding is to either keep signals from getting out or in. Capacitors are used for filtering (non-electrolytic) to either drain off unwanted signals or to pass them on. Since your getting random key-presses start by using either CAT5 or preferably CAT6 multi-strand ethernet cable (not solid core) it has twisted pair wires to eliminate noise. If this doesn't work use OPTO-Isolators placing them as close to the UNO as possible. OPTOs are my favorites because they are current driven and pretty much voltage immune. kquiggle's suggestion for the software is very good, try later.

Just my 2 cents worth.
Ray
 
A cheap and quick fix maybe to put a Ferrite bead at the ends of the cables. My Haas mill was triggering random Z axis encoder faults which forces a full reboot. I snapped a bead on the cable and haven't seen the problem since.
 
Thank you guys for your input.
I have decided to replace the arduino with a Controllino PLC and use a C-More instead the keypad and the LCD.
I have never worked with PLCs , C-more, or modbus protocol. But I will do some research and learn.

The other option I was thinking is to use a Click PLC, but I have never programmed on ladder logic.
I´ll be posting new updates on the project.
 
Great idea. Instead of trying to fix a minor problem, go to a completely different system and learn all the problems that that system can also create.
 
First don't forget the golden rule "only make 1 change at a time until you have that 1 fixed then go onto the next". You seem to have 2 problems, 1 software and 1 hardware. Random signals can be very hard to track down and you will need patience to solve it/them. Shielding typically is never grounded, grounding one end can cause a capacitance to build up and cause even more problems. Don't forget that shielding is to either keep signals from getting out or in. Capacitors are used for filtering (non-electrolytic) to either drain off unwanted signals or to pass them on. Since your getting random key-presses start by using either CAT5 or preferably CAT6 multi-strand ethernet cable (not solid core) it has twisted pair wires to eliminate noise. If this doesn't work use OPTO-Isolators placing them as close to the UNO as possible. OPTOs are my favorites because they are current driven and pretty much voltage immune. kquiggle's suggestion for the software is very good, try later.

Just my 2 cents worth.
Ray

Thank you Ray. Is there any tutorial I can follow on what OPTO isolators ti use and how to connect them?
I have most of DIGITAL (PWM) pins connected. 2 and 3 connected to one stepper driver, 4 to 11 connected to the KEYPAD, and 12, 13 connected to the other stepper driver.
And the ANALOG IN 5V connected to a breadboard where the VCC from the LCD is connected, as well as PUL(+) and DIR (-) from both steppers drivers.
The GND connected to the LCD. A4 and A5 to the LCD.
 
Great idea. Instead of trying to fix a minor problem, go to a completely different system and learn all the problems that that system can also create.
You are right. I'll continue trying to fix the minor problem while I move to the PLC. Should I wrap with aluminum foil everyone of the 16 wires that I have connected to the arduino? O just the 8 from the keypad. Just wrapping the 8 seems difficult to achieve.
 
I notice that you are using the push on type jumper wires for the connections to your Arduino. These are really only designed for prototype work with Breadboards, etc. I find them very unreliable especially in a manufacturing environment. A better route would be to use an Arduino Shield that breaks out each terminal to a screw connection that you can clamp each wire under. Or just solder your wires directly to the Arduino pins and use shrink tube over the connections. Either of these methods are better at handling everyday usage in a shop environment.
Another thing to watch is the location of your Arduino in relation to anything with A/C power. Switching power Supplies can cause interference and it is always a good idea to keep your DC away from your A/C which includes your Arduino. Always try to keep your Arduino as far away as possible from these A/C devices.
And by all means follow the other suggestion like short leads, wire shielding and proper grounds.

Good luck with your project.

Cheers
Willy

Thank you Willy. The Arduino Shield is a good idea. I'll get one.
 
A cheap and quick fix maybe to put a Ferrite bead at the ends of the cables. My Haas mill was triggering random Z axis encoder faults which forces a full reboot. I snapped a bead on the cable and haven't seen the problem since.

Thank you for the advice. I am new on doing this kind of projects, this is the first time I hear abour Ferrite beads. I am using 28 AWG jumper wires. 8 for the keypad. Do I have to put a Ferrite bead on each one of the 8 wires? Just on the end that connect to the arduino? Where can I get those components and info on how to apply them to the cables?
 
You probably only need ferrite beads on one or two wires but there is no way of knowing which wires need them so best to do all 8. If you are wrapping wires with aluminum foil you don't want to wrap all of them together. The signals the wires carry are digital, either on or off and the spikes this can create may be picked up by other nearby wires and get interpreted as a signal. Then the controller gets confused because it may be able to detect these spikes part of the time and not others leading to some interesting results.
 
You are right. I'll continue trying to fix the minor problem while I move to the PLC. Should I wrap with aluminum foil everyone of the 16 wires that I have connected to the arduino? O just the 8 from the keypad. Just wrapping the 8 seems difficult to achieve.

Oh for crying out loud, someone take pity on the poor guy...

Look. Based on the information you've shared with the forum, it's clear that your system has some problem(s), but not exactly what they are. It's not even clear whether your problems are hardware or software. Chasing silliness like wrapping aluminum foil around things before you've figured out where the problem lies, is, well silliness, and recommending it to you before helping you diagnose the problem lies is cruel.

Step 1: Describe the problem(s) in more detail:

a) "The system freezes"

What does the system do that makes you think it freezes? Do you know whether the Arduino program counter is still running? Is the main loop still looping? We need to know whether the hardware has literally taken a crap on you, or if it's off stuck in some infinite loop, confused and waiting for input, or ???

If you don't know how to diagnose these things, post what you do know, and people can help walk you through further diagnostics.

b) "displays random key presses"

What does "displays random key presses" mean? Do you have it displaying something each time a key is pressed? Does it get stuck displaying some key press? Does it display key presses when no keys are being pressed? Does it continue to display random key presses if you yank the connector for the key-pad while it's displaying a "random key press"? Does it display random key presses even if the key pad is not connected at all after turning it on?

How are you reading the key pad? It looks like it's just a switch matrix, so you're probably either measuring continuity between (row and column) pairs and some common line? Or maybe injecting voltage and measuring voltage out on the row/column lines? Are you reading the inputs as digital I/O or analog I/O? If you're reading digital, have you tried switching to analog and looking at the actual values? Does the key pad include pull-up/pull-down resistors? Is it de-bounced in hardware on the board, or do you de-bounce in your software? (if it's a bog-standard-simple keypad, and you're doing the bog-standard-simple thing for reading it, appropriate pull-ups/pull-downs and debounce will fix a /lot/ of random).

Help us out by providing a bit more information, and hopefully people will stop making random guesses about things that might be helpful.
 
QUOTE="lmeb83, post: 334299, member: 40662"]Thank you Willy. The Arduino Shield is a good idea. I'll get one.[/QUOTE]

I’ve used one of these in a permanent project
https://www.seeedstudio.com/Base-Shield-V2.html
You also need their cables. I use the longer ones and cut them so I have a connector on one end. A simple inline splice and you have a good reliable connection.

My preference though, is to use the Nano as it has a better form factor than the Uno. It fits nicely on a perfect board and then you can mount whatever type of connector you prefer.
 
QUOTE="lmeb83, post: 334299, member: 40662"]Thank you Willy. The Arduino Shield is a good idea. I'll get one.

I’ve used one of these in a permanent project
https://www.seeedstudio.com/Base-Shield-V2.html
You also need their cables. I use the longer ones and cut them so I have a connector on one end. A simple inline splice and you have a good reliable connection.

My preference though, is to use the Nano as it has a better form factor than the Uno. It fits nicely on a perfect board and then you can mount whatever type of connector you prefer.[/QUOTE]

I thought this is the shield I needed.
 
Either one will give you more reliable connections.
 
I like the ones with the screw terminals but either will work.

Willy
 
Back
Top