0
down vote
favorite
I have been using arduino uno development board for a few months now and wanted to shift to a smaller version of the same. For this, I used Atmega328p AU standalone chip using an I.C. socket (schematic). The schematic doesn't show 22pf capacitors with the crystal I have used.
Everything worked fine till the time I was using my mac to power the circuit. But when I use the wall socket to power my circuit, the setup starts misbehaving whenever I operate (turning switches on or off, rotating the fan regulator knobs to change fan speed etc.) any switch on the switch board to which the wall socket is plugged in. Whole setup isn't related to any other switch or regulator. It is just connected to the 5v wall socket adaptor which I have plugged in the board as shown in the picture below. Whenever I turn the switch on or off or turn the regulator knobs, I think some spikes/surges are ingested through the adaptor. The whole setup just starts resetting regularly or most of the time freezes altogether. However, the problem doesn't show up in the Uno development board plugged into the same adaptor using 5v and GND pin. I do not understand what is making the difference between the two. Is there a need for some decoupling or isolation?
Things I have tried:
- Changing the cyrstal
- Changing the 22pF capacitor with 18pF ones.
- Uploaded the blink code in both Arduino Board and the chip, still the same problem persists. The blink code and my code both work fine with the Arduino board but on the standalone chip it gives the same erratic behaviour (LED stays on i.e., the code freezes).
- Rewired the whole setup multiple times.
Following is the pic of the setup
At the left bottom of this image, the two wires I am holding show the 5V power input to the breadboard circuit. Note that I have given the input to the 5v pin of the chip and not vcc (because it works fine bypassing the voltage regulator).
The fan speed regulator knobs are not connected to the arduino. The only link is the adaptor, I suppose.