Go Down

Topic: First Uno shield problem (Read 5548 times) previous topic - next topic

Pedro147

I have trying to make my first simple shield and decided on eight LED's driven by a 595 shift register. No matter what code I upload to the board, only the same four LED's light. I know that all the codes that I am using are good so it is a circuit design  or actual wiring fault as far as I can see. Now that I look at the circuit again is it a problem how I have the two 0.1 mf caps situated. I realise that they are supposed to be as close to the 595 power pins as possible but the routing of the pcb tracks was aimed at avoiding any jumpers or doudle sided board. Please go easy on me I am only learning and this simple shield really had me thinking., thanks for any advice Pedro.

Code: [Select]
//Define which pins will be used for the Shift Register control
#include <SPI.h>
byte dataPin = 11;   // connect to pin 14 on the shift register   
byte latchPin = 10;  // connect to pin 12 on the shift register
byte clockPin = 13;  // connect to pin 11 on the shift register
byte seq1[14] = {1,2,4,8,16,32,64,128,64,32,16,8,4,2};
byte i = 0;
byte timer = 50;
void setup()
{
     
    pinMode(latchPin, OUTPUT);  //Configure each IO Pin
    pinMode(clockPin, OUTPUT);
    SPI.begin();
}

void loop()

    {
      for(i = 0; i < 14; i++)
      {
        digitalWrite(latchPin, LOW);                           
        SPI.transfer (seq1[i]);         
        digitalWrite(latchPin, HIGH);                           
        delay(timer);
      }
    }

Nick_Pyner


only the same four LED's light.

so it is a circuit design  or actual wiring fault as far as I can see. Now that I look at the circuit again is it a problem how I have the two 0.1 mf caps situated.



It's unreasonable to suggest that the position of the capacitors allows four LEDs to light but keeps the others off. It's much more likely to be slack soldering or the like.


CrossRoads

Get rid of these, SPI takes care of the pins
byte dataPin = 11;   // connect to pin 14 on the shift register
byte clockPin = 13;  // connect to pin 11 on the shift register
pinMode(clockPin, OUTPUT);

You have MR tied high, and OE/ tied low?

100nF, or 0.1uF, yes?  Not millifarad?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Pedro147

Thanks for the suggestions.

Yes Crossroads, as per the circuit, I do have MR pin 10 tied low and OE pin 13 tied low. The caps are 0.1 micro farad, sorry typo, and yes I forgot to get rid of the clock and data declarations from the code after you reminded that SPI takes care of them  in a previous question. I just knew someone would pick me up on that  :D

After looking at my soldering, I tend to think that Nick might be right and I will re-solder any connections that seem to be a bit dodgy. In regard to the positioning of the caps, I was just asking if their placement seemed ok.

Thanks for your help Pedro.

CrossRoads

"I do have MR pin 10 tied low " Needs to be  High.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Pedro147

Sorry Crossroads, I misunderstood. I will rectify that and see how i go. Thanks a lot.

Nick_Pyner

I would have place the caps closer to the IC but only because it's the bleeding obvious. I can't help but feel that, if this is critical, the IC would have power on pins 1 and 16. You could always remove the left one and put it under the board, soldering it directly to the IC's pins.

On reflection, I'm suss about the caps anyway. Having two of the same value related to the IC doesn't make much sense. I think they are there for the benefit of the board at large, and having one by the IC makes sense because it is at the end of the line. The other might be better placed over near the input.

Pedro147

Nick - I used the two caps because that is the advice I have always been given on the forum by people whose judgement I trust. It is a little difficult to put one under the board as this board is a shield and therefore there is limited space between the bottom of the board and the top of the Arduino board. I think that you initial suggestion re the bad solder joint/s makes sense and I will re-solder any that look a bit dodgy and see how I go. Thanks for your help Pedro.

Nick_Pyner

If they had judgement you could trust, they would have told you to put a single 0.2 there.  Having two the same, side-by-side like that, just makes no sense. All it does is double the cost, double the space, double the labour, double the fartarsing, and double the chance of something going wrong. A second cap is better employed being some distance from the first, and whoever told you what on the forum should have had that in mind - and probably did. So I suspect this is just a matter of misunderstanding.

A shield with short pins offers 12mm clear space under and there isn't much stuff on the relevant part of the Arduino. I am looking at a 200n right now and it is 7 high and 2 thick. If you can't fit that under your shield, you just aren't trying hard enough, you can always bend it over on its side.

Having said that, I don't think the caps are likely to be the cause of your problem!

Pedro147

Quote
I used the two caps because that is the advice I have always been given on the forum by people whose judgement I trust


Not meaning to be rude but I did not say that anyone on the forum told me to use the two caps in this way, in this circuit, only that it is good practice to place a 0.1 uf cap on each of the power pins as close to the IC as possible. I decided where to put them and apparently I made a poor choice.

As you rightly pointed out

Quote
So I suspect this is just a matter of misunderstanding


Quote
A shield with short pins offers 12mm clear space under and there isn't much stuff on the relevant part of the Arduino


There is lucky to be 2mm clearance the way I have made my "shield" so I suspect that I should be using a different type of header strip in this application, but having never seen a professionally made shield in person I am only doing the best with what I have available.
Thanks again for your help Nick



Nick_Pyner


but having never seen a professionally made shield in person I am only doing the best with what I have available.


Hummm..... I'm not even sure that's the problem, but next time you are in Belconnen, you might wander into Jaycar and check out the Freetronics shields and proto boards.

I think the real problem is that you are looking in the wrong place. Most of the clearance under a shield is not down to the shield per se, it is down to the header it plugs into, which is on the Arduino and is typically 9mm high. Even if you are just using pinrows on your shield, which is reasonable for its type, the black keeper is 2mm, so that adds up to 11mm of clearance which is difficult to avoid.

Pedro147

Thanks for your help and suggestions Nick. I re-soldered a few of the connections and got my shield working. I will take your advice and have a look at a proper shield and see how the professionals do it,
Pedro.

Pedro147

I had a look at a "proper" shield as Nick suggested, and the situation is that these use plated through holes so that you can pass the header pin strip through from the bottom of your shield and solder it onto the top. This allows you to have the plastic strip of the header acting as a spacer between the Arduino board and your shield. In my rudimentary shield, being only single sided with no provision for PTH header pin holes, I had to have the PCB traces on the underside of the shield therefore necessitating that the plastic header strip is on top of the shield to allow you to solder the pin into the PCB trace, obviously greatly reducing the clearance between the two boards. I have looked at various types of header pin configurations and if additional clearance is required a combination of a couple of different types will allow for plenty of clearance.

Nick_Pyner

#13
Jun 29, 2013, 05:15 am Last Edit: Jun 29, 2013, 05:20 am by Nick_Pyner Reason: 1
I understand the problem but it is immaterial. As I said, most of the clearance is determined by the Arduino, not by the shield. As it happens, what you have done is fine, inasmuch that the clearance you have is about the same as you would get with a store-bought shield with standard headers! Hence the clearance over the USB socket, and I guess this is determined by the distance your pins go into the Arduino header.

Pic shows 2x100n caps on board, one next to the reset button, the other on the far side, both upside down.


It is a little difficult to put one under the board as this board is a shield and therefore there is limited space between the bottom of the board and the top of the Arduino board.

Go Up