First PCB design not working

Components and modules used:

  1. Arduino Pro Mini - 5V, 328, 16Mhz
  2. IBT_2 Motor Controller - 5V, 43A
  3. SPST momentary pushbutton switches
  4. 10K ohm through-hole 1/4 watt resistors
  5. LM7805 voltage regulator
  6. 50V, 10uf capacitors
  7. 2 layer PCB
  8. Hobby motor for testing purposes

Intent of the project: Create a PCB that utilizes logic level momentary switches to replace 30A SPDT rocker switches to save space and eliminate bulky 12 gauge wiring.

The 30A switches control scissor jacks mounted to a platform. The power source for the jacks is a 12V marine battery.

The IBT_2 motor driver is controlled by the Arduino Pro Mini and the momentary switches.

There are 8 SPST pushbutton momentary switches used in pairs. Each pair uses one switch for forward and one for reverse.

Issues: I designed a PCB and had 5 boards printed. They do not work as expected. I realize that I did this early but with the intention of working out the bugs in practice rather than in theory. The schematic attached here shows what I sent out for production.

The circuit and the code together both work when I wire everything on a breadboard but not on the PCB. I have tested the PCB with the Arduino 'Button' example available in the examples on the IDE and it works for each pin attached to each button. I have also enabled and disable pull-up resistors in the code and have had the same results.

I have my suspicions that there is something very basic here that I don't understand.
Maybe the LM7805 circuit doesn't need to be incorporated here since there is on-board regulation with the Pro Mini but I put it in because I will need to have it eventually. I don't know so I am asking if anybody can lend some help. Thank you for reading.

/*
IBT-2 Motor Control Board driven by Arduino.
 
Speed and direction controlled by a potentiometer attached to analog input 0.
One side pin of the potentiometer (either one) to ground; the other side pin to +5V
 
Connection to the IBT-2 board:
IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM)
IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM)
IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin
IBT-2 pin 8 (GND) to Arduino GND
IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected
*/
 
int rbutton = 11; // right turn button
int lbutton = 12; // left turn button
 
int goRight = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
int goLeft = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)
 
void setup()
{
  pinMode(goRight, OUTPUT);
  pinMode(goLeft, OUTPUT);
  pinMode (rbutton, INPUT);//removed INPUT_PULLUP
  pinMode (lbutton, INPUT);//removed INPUT_PULLUP
}
 
void loop()
{
  int rbuttonValue = digitalRead(rbutton);
  int lbuttonValue = digitalRead(lbutton);
 
  if (rbuttonValue == HIGH);
  {
    // reverse rotation
    int forward = (rbuttonValue == HIGH);
    digitalWrite(goRight, forward);
    digitalWrite(goLeft, LOW);
    
  }
  
 if (lbuttonValue == HIGH);
  {
    // forward rotation
    int reverse = (lbuttonValue == HIGH);
    digitalWrite(goLeft, reverse);
    digitalWrite(goRight, LOW);
  }
  //delay (100);
}

switchBoard.pdf (101 KB)

I’m afraid your attachment shows very little , certainly not the whole system you describe, if it works on a breadboard , then you need to get a multimeter and check all the tracks on the PCB correspond.

I had the same though, maybe there is a fault on the PCB ?

Sorry, this is my first post. I forgot to post the code. Here it is:

/*
IBT-2 Motor Control Board driven by Arduino.

Speed and direction controlled by a potentiometer attached to analog input 0.
One side pin of the potentiometer (either one) to ground; the other side pin to +5V

Connection to the IBT-2 board:
IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM)
IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM)
IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin
IBT-2 pin 8 (GND) to Arduino GND
IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected
*/

int rbutton = 11; // right turn button
int lbutton = 12; // left turn button

int goRight = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
int goLeft = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)

void setup()
{
pinMode(goRight, OUTPUT);
pinMode(goLeft, OUTPUT);
pinMode (rbutton, INPUT);//removed INPUT_PULLUP
pinMode (lbutton, INPUT);//removed INPUT_PULLUP
}

void loop()
{
int rbuttonValue = digitalRead(rbutton);
int lbuttonValue = digitalRead(lbutton);

if (rbuttonValue == HIGH);
{
// reverse rotation
int forward = (rbuttonValue == HIGH);
digitalWrite(goRight, forward);
digitalWrite(goLeft, LOW);

}

if (lbuttonValue == HIGH);
{
// forward rotation
int reverse = (lbuttonValue == HIGH);
digitalWrite(goLeft, reverse);
digitalWrite(goRight, LOW);
}
//delay (100);
}

Also, the IBT_2 is not a part of the schematic and PCB yet as this is a first step.

As for checking the board, I have and everything is connected and tones-out like it should. This is why I am confused.

 if (rbuttonValue == HIGH);

That semicolon should not be there. It terminates the if statement.
You have another one to fix too.

Pete

@el_supremo - I removed the semi-colons and the motor runs constantly without being triggered by the switch. I put them back in and the motor runs only when the switch is pressed.
This is on my breadboard assembly.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
A full connection schematic will help, even if it is hand drawn.

A copy of your PCB pattern will also help?
The CAD package you do your PCB layout, should be able to export the pattern as a jpg or other image format.'
An image for each layer will help.

Thanks.. Tom... :slight_smile:

Whenever I do a prototype board I tried to add three extra holes off of any unused pins that allows me to cut a trace put a jumper in and a place to actually bring a wire in if I need to I also add holes for the VCC and ground in case I need to add a pull up or a pull down after I start to get things to work

You have a net marked Vcc connected to RAW. What is that connected to? From your schematic, it looks like it's only connected to the buttons, ie, power is not supplied to the pro mini.

Is it also connected to the +5v rail from the regulator? If so, that should be connected to Vcc, not RAW - raw goes through the on-board regulator on the pro mini, which has minimum dropout of almost 2v, so you'd have 3.something v on the Vcc rail of the pro mini instead of 5v.

@TomGeorge - I attached a jpg of the board from Upverter which is what I used for design. I will work on connecting the dots.

In the jpg above, blue traces are the top layer and are all GND. Grey traces are bottom layer. All are VCC except those that connect to D10, D11, D12, D13, A0, A1, A2, A3.

First PCB design not working]

:smiley: I've worked in electronics for many years and I don't think I've ever seen a board that was right the 1st time... The boards I'm testing right now are Revision 3, and we use a different revision scheme for boards that are in development, so this is at-least the 4th version.

This version works, and to be fair the previous version worked too but there was an added feature.

@ dave_in_nj - Smart to add holes. I considered but didn't do it and now regret it. I also considered breaking out the headers for the Pro Mini for work-arounds. V2 I suppose. That's why I just went ahead and had it printed. I've learned a lot already that I could have guessed at for weeks and not gotten any further.

@DrAzzy - I think you nailed it. If you look at the jpg that I posted you can see that I have no connection to VCC on the ProMini and the output of the regulator is going to RAW.

This is making sense now. I tested voltage and was getting 3.2V on D11 and 12 when the program was uploaded and running on the board.

When I power the screw terminals the board LED lights up and I get 5V around the board until I press the buttons on D11 and 12 which are reading 3.2V. Is the connection to RAW back-feeding the circuit?

So in theory I think if I cut the traces to the regulator I should be able to run this through the FTDI header.

penosc:
@DrAzzy - I think you nailed it. If you look at the jpg that I posted you can see that I have no connection to VCC on the ProMini and the output of the regulator is going to RAW.

This means that --- in future, before printing and making the circuit board --- ensure that that the traces do indeed go to the correct places. And, when after populating the circuit board ---- if something isn't working, then probing (using a multimeter etc) to test for correct/expected DC voltages (when circuit is powered) can help. And (when circuit is unpowered), probing for short circuits or open circuits between nodes can help too. But, having tracks/traces going to the right spot is very important, obviously.

So you breadboarded a design, but the schematic in your PCB design package was not the same as the wiring for the working breadboard design ?

You would not expect the PCB not to work in these circumstances.

I did make some mistakes. But with the generous help offered here I think I am on the right track. Thank you all for your help!

The Raw-Vcc error is easy to fix. Just a jumper wire bridging those pins will do it.

The JPG of the layout isn't very clear. The switch bodies obscure the traces going underneath them. Check that each button works on its own and communicates a clear signal to the Arduino. Write a simple test sketch that only tests one button.

It looks like the GND and +V labels on the power input connector are backwards.

There are connections on the PCB that aren't on the schematic. It looks like maybe the footprint for your Pro Mini includes the FTDI header and you've wired that up, even though those wires are already on the Pro Mini.

Where is the connection to the output device? The motor controller?

Hi,
OPs. PCB;


Sorry I missed that image, its just readable as its a screen capture, the app should be able to produce a jpg image directly.

Also, you have effectively bought a double sided copper clad board, do not be scared to make your traces much wider especially if its a gnd track.
You are paying someone to remove that copper that you bought, so try and leave as much of your copper on your board.
You have kept the layout clean and uncluttered which is good.

Putting some pads on the PCB, on Gnd, your 5-15V input, your 5V reg output would be advisable so you can easily check those values, as well as exposed pads for each of your buttons.

This makes a quick probe with a DMM is easy rather than a chore to get to component pads.

Even adding provision for power indicator LEDs and resistors would be good, you don't have to fit them, but it is not costing you any extra to include them.

Tom.. :slight_smile:

Thanks Tom.

Now that I look at it again, I don't see any connection from the output of the voltage regulator other than its smoothing cap. There's no power connected to anything.