1
\$\begingroup\$

Short Version: I've wired up an ATMEGA328 chip standalone, after programming with arduino. By itself, the chip is not functioning properly, but when the arduino (with exact same chip) is wired in, it functions fine. So, there must be something incorrect in my wiring. Schematic is below.

Long Version: I am working on a rather ambitious project, and animatronic tail for a costume. The physical construction of it is 3d printed parts, hardware, paperclips, and brake cables. The tail's controls are from a 5-button board, and the brains are an ATMEGA328P from an Arduino UNO.

Here's a video of it's basic motion when using arduino and breadboard. https://www.youtube.com/watch?v=39v8euC7XNs

Now, since that video, I have made a separate board for my buttons which can be held in the hand. When connecting my servos to their own power and wiring in the button board to the arduino, the tail still functions perfectly.

The next step was to use the ATMEGA on its own. The schematic below is for a circuit board containing the ATMEGA. The servos, buttons, and battery will plug into it. The servos tie directly to the 6v battery, and I'm using a pair of resistors as a voltage regulator[EDIT: voltage DIVIDER. mis-type] to provide 5v to the ATMEGA. (Thats a 0.1uF capacitor between AREF and GND to help it run better) Since the chip is out of the arduino, I've wired in a 16MHz crystal with 22pF capacitors, and a 10k pull-up resistor from pin1 to +5v (this is the only thing not in the schematic).

enter image description here . .

After this standalone failed to work, I went back and connected to arduino, worked fine. moved back to standalone, and it did not function. I've quadruple checked over the button board, it is connecting as it should, and no shorts anywhere. Power is flowing where it should be... so everything SHOULD function. However, only one button will sporadically do what it should, the rest make their servo motor twitch, but that's it.

Im going crazy trying to discern whats happening, and want to make sure I'm not missing a stupid mistake here.

\$\endgroup\$
2
  • \$\begingroup\$ Can you make that into an actual schematic, instead of a wiring diagram? That would include indicating which pins are what. I don't think many are going to both to reverse-engineer your wiring diagram. \$\endgroup\$ Feb 15, 2015 at 5:20
  • \$\begingroup\$ There is some pin that decides whether the chip start in bootload or application mode. Did you wire that pin correctly? \$\endgroup\$ Feb 15, 2015 at 9:42

1 Answer 1

3
\$\begingroup\$

I'm using a pair of resistors as a voltage regulator to provide 5v to the ATMEGA.

  1. I'll bet anything this is at least part of your issue. Use a proper regulator for your micro. Make sure you get your decoupling right too.
  2. The thing that jumps out at me the most is the lack of capacitance across the servo power pins. You need to put some big ass caps™ in parallel with some smaller ceramics across those things, or the stall current will cause the power rail to sag and the micro's brown out reset will trigger. The reason it works with the Arduino is it's powered from the USB port.
\$\endgroup\$
5
  • \$\begingroup\$ Ah, I mis-typed there. Im using them as a voltage divider, but had not considered using a proper regulator for this situation. I have a couple of 1f supercapacitors on hand, I'm going to add some capacitance for those servos and see what happens. I hadn't thought of that as an issue or solution. \$\endgroup\$ Feb 15, 2015 at 3:29
  • \$\begingroup\$ Not very familiar with supercaps, but I would not use them across a servo. \$\endgroup\$
    – Matt Young
    Feb 15, 2015 at 3:52
  • \$\begingroup\$ 'supercaps' is just a name since they're rather large in capacitance and voltage. Why wouldn't you use them though. \$\endgroup\$ Feb 15, 2015 at 3:55
  • 1
    \$\begingroup\$ I know what they are, and it's not just a name. They are constructed differently than regularl aluminum electrolytics. I don't know what their AC characteristics looks like, and the enormous inrush current to charge up a 1F cap is going to cause more problems than the cap solves in the first place. \$\endgroup\$
    – Matt Young
    Feb 15, 2015 at 4:01
  • \$\begingroup\$ A 1F supercap normally has max voltage rating of about 2.7V so you might want to watch out a bit, especially if it gets hot. \$\endgroup\$
    – HKOB
    Feb 15, 2015 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.