Why is using a battery causing my ATtiny85 to malfunction?

Discussion in 'The Projects Forum' started by nimaid, Sep 7, 2013.

  1. nimaid

    Thread Starter New Member

    Mar 17, 2012
    5
    0
    Background: I'm making a POV wand. (a row of leds that, when moved through the air quickly, seem to display a message) I have finished the code and have a 100% working prototype on breadboard. I soldered it up, and I've made sure all connections are in the correct place, and we'll connected. The project uses 7 leds, 1 2hc59581 shift register, and ATtiny85, a 7805 5 volt regulator, and a 9 volt battery.

    Problem:
    Everything works perfectly on the breadboard. However, on the perfboard version, the wand works incorrectly and inconsistently before not lighting at all. This is with power from the (new) 9 volt through a 7805 5v regulator. However, when I bypass the regulator and hook up my arduinos 5v and gnd to the correct points on the board, the wand works correctly. I hooked the ATtiny85 up to the working breadboard while still on the perfboard, and it malfunctioned the same way. All this means that, somehow, the power system of the battery though the regulator is causing the ATtiny85 to malfunction. Again, the same circuit with the same power supply (battery and regulator) works flawlessly on breadboard, but not the perfboard. I've octuple checked my connections (visually and electrically) and they seem perfect. So, why on earth would specifically a battery and regulator cause the microcontroller to malfunction in one case and not another? I'm so completely stumped.
     
  2. poopscoop

    Member

    Dec 12, 2012
    139
    16
    What is the voltage coming out of the 7805 when everything is on and powered by the 9v?
     
  3. nimaid

    Thread Starter New Member

    Mar 17, 2012
    5
    0
    Multimeter reads 4.98, so 5. Same as arduino.

    I have also determined bypassing the regulator with 3 volts (2 AAA) also runs the board without malfunction. (Of course, the leds are much dimmer.) I have tested other 7805s, and they all caused the same malfunction, even when bypassing the original power supply on the board. So, a regular voltage straight from a battery or the arduino power header does not cause malfunction, but power through a 7805 does. And using a 7805 on breadboard doesn't cause malfunction, but the same connections on a perfect board does.
     
  4. nimaid

    Thread Starter New Member

    Mar 17, 2012
    5
    0
    The arduino 5v reads 4.79, so I had an idea. Okay, so on a suspission, I used a 120 ohm and a 1000 ohm resistor to make a voltage divider after the 7805, giving me 4.43 volts. Sure enough, that works! Look, I have no idea why the design worked on breadboard and not when soldered up, but at least I can fix it now.
    Any ideas on why though?
     
  5. DickCappels

    Moderator

    Aug 21, 2008
    2,659
    632
    Have you considered the possibility of a problem with ground or clock on the shift register in your new layout?

    A few months ago I made a very simple circuit made of a quad gate and a shift register running with a clock of only a few kHz, hand-made on perforated board. I don't remember how long it took me but it seems like it took hours to get the grounding and bypassing right so that it produced the correct output.

    Your 'hc59581 can typically be clocked at 91 MHz with a 4.5 volt supply. Even very short glitches can really make it seem to act weird.

    Another area is to consider whether you are allowing some data setup and hold time. Its best to set the D value, clock the data in, then return the clock to its former state in separate instructions, in case you are not doing that now. Also, I hope you are not simultaneously shifting and moving data into the buffer, (I did not look for this in the datasheet but its often not a good practice.)

    So...it may be timing. A glitch or ground bounce, or something that was being critically clocked and now, because of the new layout, it doesn't work any more.
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    Without carefully reading all of your posts I gather that you are suggesting that the 7805 voltage regulator is causing a problem.

    All 3-terminal regulators require proper decoupling capacitors at both input and output terminals. Do you have these?

    Try 47μF at the input and 10μF at the output.
    Also put a 0.1μF cap as close as possible to the output pin and GND.
     
  7. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    I go with chips.
    Proper input output decoupling is needed for the 7805
     
  8. nimaid

    Thread Starter New Member

    Mar 17, 2012
    5
    0
    Huh, I've never heard of needing two decoupling capacitors for a regulator in addition to a 0.1 uf regulator. I'll give it a shot.
     
  9. DickCappels

    Moderator

    Aug 21, 2008
    2,659
    632
    You often need capacitors on both the input and output of a 7805. Take a look at a datasheet.

    You definitely need capacitors across your AVR and logic chips.
     
Loading...