Looking for input on my first try at a PCB...

So I’m making my first attempt at a PCB using EasyEDA. Most of it is straightforward but I’m wondering if anyone here can help me with two parts of the design.
The first part (left side of attached image), is the barrel connector for the power source. This will be powered by a 5v switching power supply. What size capacitor is generally used for stability? The power supply will also be powering an 8-relay board and two DFPlayer MP3 boards.
The right side of the diagram shows my button config. Instead of a button, there is a screw terminal and a long wire with a button will be connected through that. The button could be up to 15 meters away, so I’ve tried to use a capacitor and a resistor to clean up the signal. Unfortunately, I’m not able to use a twisted pair because the wire has already been run. The code will also implement software debouncing.
I’m open to any suggestions, as I’m very new to this. Thanks.

Some switching power supplies require a minimum load, what power supply are you using ?

A 100uF is okay but probably not needed.

15 meters, hummm, have you considered using an opto-isolator circuit ?

I'm repurposing this power supply which is already onsite: https://www.amazon.com/dp/B074YHN8D1/ref=cm_sw_r_em_apa_fabc_Isc6FbDKPCKQ6?_encoding=UTF8&psc=1 It's much more than what is needed but it's conveniently already there. I have no experience with opto isolators, but could consider using them if they are easy to implement.

Suggest you draw between 500 mA and 1 amp minimum.

Opto-isolators are very easy to work with, lots of information on the internet and YouTube.

I would ignore hardware de-bouncing as such - software is overwhelmingly superior but your circuit is definitely relevant to protection from impulse picked up on your long wires. As such, your 1k could be 10k and you might consider Schottky diodes from the input to supply rails - there are double diodes made for this application.

Or an opto-isolator. Note that the value of an opto-isolator is that the input connections which connect only to the button(, resistor) and supply do not approach the microcontroller itself while the output connections connect closely to the microcontroller input and its local ground.

Pos and GND seem to be swapped at DC1. Normally the pin of the connector is +, the outside barrel -.

For power supply decoupling I've used anything from 10µF (or none) up to 2x2,200 µF (when I also had motors and LEDs that could draw several amps of current spikes pushing the power supply to its limits - it did the job). It all depends on the rest of your overall circuit - what is connected to it, how is it powered, what is the physical layout, etc.

Other than optocoupling, it may be a good idea to have clamping diodes on that input. I've destroyed an ATtiny not so long ago by having 5V on the input when I powered down the receiving end - even though there was 2x1k in the wire (there's an RC filter just like you have on both ends). 2.5 mA is apparently too much for the built-in clamping diodes. I've redesigned it with external clamping diodes (used a BAT54S dual Schottky for that), should do the job.

wvmarle: Pos and GND seem to be swapped at DC1. Normally the pin of the connector is +, the outside barrel -.

What most of us think - but not Canon. :astonished:

Very well spotted.

wvmarle: Other than optocoupling, it may be a good idea to have clamping diodes on that input. ... 2.5 mA is apparently too much for the built-in clamping diodes. I've redesigned it with external clamping diodes (used a BAT54S dual Schottky for that), should do the job.

As I said. :grinning:

wvmarle:
Pos and GND seem to be swapped at DC1. Normally the pin of the connector is +, the outside barrel -.

Yep. Got too focused on the button inputs. Thanks for catching that! Here’s a new diagram with fewer smoking components and a Schottky (BAT54S) diode. Hopefully I didn’t break anything while re-drawing it. I didn’t mention before but the pcb has headers with an Arduino Nano in it. That makes for easier programming and hopefully makes replacement faster if a pin goes bad.

Thanks for everyone’s suggestions about octo-isolators. For this revision I’ll stick with what I have since it will take a bit of time for me to learn about implementing that and the breadboard version of this seemed to work ok.

larryd:
Suggest you draw between 500 mA and 1 amp minimum.

This power supply seems to be ok with the combination of the arduino nano, relays, and mp3 boards. It would be helpful to have some lighting near the these components. Any problem with putting a small 5v led strip on this same power supply? That would bring the draw up just in case it’s a problem.

Also, on a completely different topic - what problems could I expect if I ran two of these arduino powered PCB’s off the same power supply?

Thank power supply should be able to power a Tank :wink:

larryd: Thank power supply should be able to power a Tank ;)

Yeah it was originally installed to power some LED strips so it's got plenty of juice! I'm pretty new to this and wasn't sure if there would be any interference or something like that if they shared a power supply.

Arduinos can normally share a power supply just fine, provided the power supply can handle the total power draw of Arduinos, sensors, LEDs, and whatever you want to connect to it. Just add it all up, add some margin, and see if that works out.

No, you've mucked the circuit up again! |500x172 Now you have no pull-up.

The BAT54 goes directly onto the Arduino input. The resistors are as on your original.

So I got a little confused when using a BAT54S vs a single BAT54 and referenced this article: Protecting Inputs in Digital Electronics | DigiKey where it had the attached schematic.

It looks like I accidentally omitted the 100k resistor and therefore the pullup. Adding that back should fix it…

Or should I go back to the original design and throw a single Shottky next to the pin?

Thanks for your help.

digikeyarticle.jpg

Since you have plenty of power, I would put a 500 ohm to 1k from the switch to +v (or ground) depending on the polarity you wish to use. At a current of about 10 ma most if not all low frequency noise will be overwhelmed by the dc current.

Regarding the input, there is no need to but any capacitors for stability. However I would put a 0.1 µf across the inputs for extraneous noise. I'd probably put a 10 to 100 µf cap as well for no other reason than it makes me feel better to have a little local storage for the relays.

I’m saying “original design” - that’s the right hand side of this one:

Then add your BAT54s at the input pin of the Arduino.

You have a pullup resistor to provide a “stiffer” pullup than just the internal pullup of the Arduino in case that is needed (or a lower value perhaps as JR points out and you don’t mind the current draw - this may also provide more “wetting” to the switch contacts), and just one series resistor to limit the current the diodes see (one milliamp per Volt).

The Schottkys are simply used so they conduct instead of the internal protection diodes as they (presumably) have a lower threshold voltage. There is no need to complicate matters with further resistors between the Schottkys and the Arduino.

Ok, here’s the original design with the BAT54S next to the input pin… is this what you meant? Thanks for your time and patience.

Now we're talking! :sunglasses:

Great! Thanks again for everyone's help. Without access to classes (and left to my own bumbling attempts) the time and effort that you give is greatly appreciated.

Your circuit diagrams are incomplete and will generate errors when you check the nets. Each component needs to be connected by drawing from the component, out two steps. That will then give you a red dot showing that it is connected. I see that you have one or two, but most are missing.

Yep, those were quick sketches for this discussion. The nets are corrected and tested in the final schematic. Thanks for the help!