Re-learn electronics. You build your Arduino, now what?

So after reading some books, learning how to use Eagle, make some pcb’s and solder it, of course. So after some trial and error, you got your own Arduino based board. You upload “your” blink project: Its alive!
So time to do more serious things, you think. And… here is where the real problem starts.
You try to switch a relay via transistor, and your system resets, hey: More decoupling caps you read elsewhere, after that modification, it resets less…
Isolation! You isolate your transistor, your power supply, your board, your cat…
Hey know you got it! So you connect more things to the board: Leds, LCD, stepper drivers, AC motors… Ouch! AC motors was two much: even with the isolation your Arduino based pcb starts to do weird things, like entering into program places which you didn’t programmed this way. You look to your software for the tenth time: No, software is ok. Then you read this coud happen by some interferences.
Or if you are lucky you just get your micro like a zombie doing a strange thing or just the same things in a loop. No button anwers again until you reset the micro.
Re-ruting cables.
You put more caps, a low pass filter, cap filters to earth… and a Jesus star, just in case…

Now it works!!!But, wait. You don’t know exactly why it works, you’ve done that many things… So you are afraid this situation could be not permanent, waiting for the next reset/zombie state.
Maybe you’ve done the right work, but as you don’t know exactly why, you are afraid why it works.

Maybe some of you could identify in the situation I’m now.
So my question to the more expert people is: Ok, there a ton’s of book of how to build your electronics. But is there any book on how to make/modify your work in order to survive to real world???
I will appreciate it so much.

Thank you very much for your time and reading.

Post your code.
And pictures of the project.
Tell us what the problems are, before you go mad.
Experienced people here will tell you what will work and what not.
You learn from that much quicker, so you can avoid those problems in future builds.
Leo..

It's not that terribly complicated. Read the datasheets. Use a meter to meter. Make sure what you meter is within the specs listed in the datasheets.

sergiv:
So my question to the more expert people is: Ok, there a ton's of book of how to build your electronics. But is there any book on how to make/modify your work in order to survive to real world???

Read your ton of books .
Then spend 40 years building stuff.

As wawa suggests , post specific problems.

And look at the circuit with a 'scope if you can - lots of strange effects become obvious when an
oscilloscope shows you what's happening on the timescales beyond human senses, milliseconds
down to nanoseconds... Things like lack of decoupling, parasitic oscillation, bad termination,
double-clocking, interference etc etc.

Hi people,

Thanks for your support. I was just kidding regarding the electronics. My circuits are quite well fortunately, however one always has the feeling that you don't know which thing solved what. And I'm 5 years now with my circuits: Just a power supply with 24Vdc and 5Vdc and an ATMEGA1284P.

However as this boards are used for industrial environment, there is always a new problem to solve: From defective PE connections, to two much RFI, big >20HP motors decelerating, VFD's (Regarding VFD's I've tried Omron, Delta and Schneider, and I recommend Delta for noise trouble free). Etc.

However the equipment to analyze all this bad EMI things is very very expensive (around 40.000 USD more or less)

So I was asking to myself yesterday night: Could it be more easier? Maybe is there a book or two specific on this problems?

No books have all the solutions for the problems that you will encounter in YOUR environment.

As JR says - no books have all the answers. A good part of the solution is to practice good design practices which involves doing it right to start with, not "applying band-aids until it works". Things like good grounds, bypass caps (both electrolytic filter and ceramic 0.1ufd) to control switching transients. Use a robust power supply, not a cheap one running right at the limit (this means you need to calculate and measure actual power consumption, not just guess at it). Understand how square waves work (and why they can cause so much noise in a system if they have fast rise and fall times - those can induce/radiate all sorts of garbage into your signals. My PID controller for my hummingbird feeder uses a FET to switch the heat on and off - I have a gate resistor on the FET as well as a small (0.1 ufd) cap from the gate to ground - the slows the rise and fall time to virtually eliminate the switching transients - yes, it increases the dissipation in the FET, but since it is on the same heatsink as the heater resistor, it doesn't matter and makes for a LOT less emi). There is no simple answer. For laying out PCB, if you really want to get into it, one book that is pretty good is "Printed Circuit Board Design Techniques for EMC compliance". Another one I would suggest is "Practical Electronics for Inventors". Another excellent (but not cheap) book is "The Art of Electronics" - an excellent reference book. There is NO simple answer, but starting with good design practices is your best bet. Anything else leaves you putting duct tape on the problem and wondering if that fixed it or not.

mikey

One of the biggest things to learn is not "all the answers", but which rocks to look under and how to recognize and search for the solutions - especially the art of effective troubleshooting. Amazing the number of people without a clue how to solve issues - the put a bunch of hardware together, write a big block of code and when it does not work, they don't have a clue where to start (other than posting "HELP" to every forum they can find). Take the time to learn how to troubleshoot - test points in hardware, print statements in code etc. so you can look at parts of the whole picture. That is a very important thing to learn - and many never do. Spend the time to learn how to add features (and debug) to your project. Spend the time to define the requirements for your next "feature" (hardware or software). Consider how to add debugging features to what you are doing. That takes time to learn, but is a skill vital to working with this stuff.

mikey

You try to switch a relay via transistor, and your system resets, hey: More decoupling caps you read elsewhere, after that modification, it resets less...

Does the term flyback diode ring a bell?

Isolation! You isolate your transistor, your power supply, your board, your cat...

Isolate how?

Since you're just assembling this piecemeal from assorted internet posts, you run into two fundamental problems based on the fact that anyone can post whatever shit they want to their blog:

  1. You're misunderstanding the problem, so you find the wrong solution for it.
  2. You've found a correct solution, but execute it wrong.
  3. The article or post you've found contains incorrect information.

As a concrete example of that last one, this very forum is full of people claiming it's OK to draw up to 40 mA from a single Arduino pin. It's not.

So I was asking to myself yesterday night: Could it be more easier? Maybe is there a book or two specific on this problems?

No, it probably can't. The problems that a circuit can face are legion, and often specific to the application at hand. There was a thread on this forum where the OP was making a motorcycle quickshifter, and it took many pages to diagnose and solve the problem he had with radiated EMI from the bike (probably the spark coils) causing phantom button presses. He also had trouble with a few chips getting fried while hooked up to the bike, hopefully solved by the addition of a suppression diode.

Other circuits may have problem with high and low temperature, vibration, conducted EMI, radiated EMI, brownouts, power surges, cosmic rays, RF interference, magnetic and capacitive pickups, crosstalk, static electricity, high voltage transients.

The other half of the problem is that the acceptable failure modes for all these different problems are different. If some freak cosmic ray or RF pulse causes your TV remote to flip out and lock up, no big deal just take the batteries out to do a hard power cycle. If the same thing happens to a satellite that cost millions to launch into space, it's done for because you can't just send out a technician to LEO (also known as an astronaut) to try rebooting it. Other things might have safety implications when they fail, like automotive or aviation controllers. No matter what happens to them, the circuits have to be hardened enough to do their damnedest to maintain as much functionality as they can.

Often times a single problem can have multiple layers of solutions depending on how much you are willing to invest and what you need to guard against. A simple switch input to a microcontroller is most cheaply handled by using the inter pullup resistors, but you can go further if you need to. You might need to add a stronger external pullup or an external capacitor. Particularly elaborate schemes may require optocouplers, Schmitt Triggers, voltage suppression diodes, and probably more.

This is not something you can cover in a few blog posts or a small book for a general audience.

Dear Mikey,

Bought "Practical Electronics for Inventors", really a good book! I find it is like an almanac of knowledge.
Really love it. Thanks for sharing!

sergiv:
Dear Mikey,

Bought "Practical Electronics for Inventors", really a good book! I find it is like an almanac of knowledge.
Really love it. Thanks for sharing!

Glad you found the book useful. It is not as good (or expensive) as "The Art of Electronics", but it is a very good book for someone that wants some sort of reference on what bits and pieces are with some background.

Learn and understand Ohm’s Law, Kirchoff’s Laws, the formulas for power, voltage, resistance, current, learn and understand capacitors and inductors, AC circuits and how trigonometry is necessary to understand them.

polymorph:
Learn and understand Ohm's Law, Kirchoff's Laws, the formulas for power, voltage, resistance, current, learn and understand capacitors and inductors, AC circuits and how trigonometry is necessary to understand them.

Trig? You need calculus, fool!