The design of my board is really quite simple (even though I couldn't get it right). I shared part of the schematic in Part 1, that is, the screw up trying to create an inverter with an NPN transistor. Here is the whole schematic:
This is actually the second iteration of the schematic. The first one didn't have a Vcc net and when I let Eagle autoroute the board, I at least noticed that the 7804 chip didn't have it's power pin connected to anything. To solve that problem, I created a Vcc net and connected it to the 5v net and everything seemed to route like I wanted. Although I wasn't very confident in the design, I shipped it off to BatchPCB anyway so that it might be ready when I got back from vacation.
I got the board on Thursday and started soldering things up. Here's the way it looked when I thought I was done:
Of course, my test program didn't work and I quickly found that I had made the same mistake twice...this time in the form of a printed circuit board! ARGH! Well, At least that mistake wasn't too hard to fix. I needed a resistor between Pin 12 and the base of the transistor, so I soldered one end of a resistor in the hole meant for the base of the transistor and then connected the base lead of the transistor to the other end of the resistor. My pretty board isn't so pretty, but at least that problem was fixed.
Unfortunately, my test program still didn't work. The test program adds a couple of LEDs that I just jumper from the female headers on the shield. The test program doesn't get through the initial indication that all of the parts are there...that is, the program resets. If I disconnect one of the LEDs, the program runs farther before resetting, so I believe that my problem is that I'm shorting power somewhere and the processor resets due to the lack of power.
My initial thought was to verify how the buttons and switches were wired. Using a tutorial by Lady Ada, I found a completely different schematic than what I was using. First there was a 100 Ohm resistor between the +5 rail and the Arduino pin. Second, there was a 10K pulldown resistor between the switch and ground. The tutorial talks about different resistor values and specifically talks about wasting power if you choose too low of a value. I'm not sure how I would rig up both resistors, but I could at least try replacing my 1Ks with 10Ks. I tested the ability of the Arduino to read the state of the switch using my schematic with 10K resistors instead of 1K resistors and it didn't seem to have any problem. So I desoldered the 1Ks for each switch and soldered in 10Ks instead. So now the board looks like this:
It might not be easy to see, but the mess to the left of "Relays" is the resistor soldered into the hole for the base lead of the transistor. That's why the transistor is sitting so high on the board. The 1K resistors have been replaced by 10K resistors except for the one at the top right of the board.
With high hopes, I went back to my test program. It didn't take long for my hopes to be dashed. Right now I'm stuck with two problems that I haven't been able to track down. First, the 10K resistors didn't change the fact that the program resets with what appears to be a power failure. Second, the "down" relay is activated when the program fires up. If I have the relay connector plugged in, the program resets almost immediately. The relay activates and drains the power, then deactivates as the board resets. If I don't plug in the connector for the relays, but do have the connector for the external LEDs that come on when the relays are active, the program runs longer. The "down" LED lights almost immediately upon program startup and stays lit until the program resets...which takes a bit longer without the relay connector plugged in. Long enough, in fact, for me to measure values coming out of the AND gate.
And this is where I have a real problem that I can't figure out. Pins 12 and 13 are both read zero on my volt meter. Pins 1, 2, 4, and 6 all read zero as expected. Pin 5 reads 5 volts as expected. Pin 3 reads 4.7 volts. That's supposed to be the output of the AND gate supplied by Pins 1 and 2. Even stranger is that this pin is supposed to control the 'up' relay. Yet it is the down relay LED that is lit. So part 3 of this mess won't be coming until I figure some things out.

0 comments:
Post a Comment