Circuit Analysis

Before you layout a circuit, it's generally a good idea to understand what is happening in your schematic.  And before you lay out a schematic, it's generally a good idea to understand what is happening in your block diagram.

Hard Way Hughes"This book is a bit technical.  If you are a beginner, it's okay that you don't understand everything that follows -- your first project will still be successful.  Try to pick up as much as you can, and ask questions in the forums!"

2. Power System Overview

Power will be delivered to our circuit via three sources:

  • Batteries
    • (6V) 4 AAA batteries, or
    • (7.2V) a LiPo Battery
  • (5V) a USB connection to a computer during programming
  • (3V) a small coin-cell battery (2032) used to keep the Real-Time Clock working when the device is turned off.

You are responsible for supplying the batteries used in your design.

Unless you are a fan of fire, it is not a good idea to use multiple power sources at once.  Engineers cannot depend on users to remember to disconnect one source before they connect another.  Passive or active measures must be used to prevent multiple sources from powering the circuit at the same time.  The simplest option is to use a break-before-make selector switch.  Adding a switch increases the BOM cost, and mechanical devices are prone to failure.  Our BOM cost is already higher than we'd like.  So Bob decided to get creative. 

Bob's Secret Source Selector

We'll cover this in greater detail in the sub-chapter "MOSFET Magic."  But Bob used a series of MOSFETs to electronically decided which power source to select.  A battery connected to J201 feeds a 5V LDO.  As long as only the battery is plugged in and the switch is on, the battery feeds the 5V0 net and the 3.3V LDO.

Bob's Power Selection Circuit

Bob's Power Selection Circuit prioritizes a battery connected at J201

Mark's Battery Selector Footprint

Hard Way Hughes"Dr. Bob might be playing chess with circuit elements, but I'm still out here hitting rocks with hammers.  I came up with a hopefully simple solution"

I created a footprint that superimposes JST-PH connector and two 0.1"-pitch Plated-Through-Hole (PTH) pads.  The footprint was intentionally designed with the 0.1"-pitch holes placed directly beneath the front opening of the JST-PH connector to prevent multiple sources from being connected at once.  

The battery selector footprint ensures that either a JST-PH connector or a 0.1" header is used, but not both.

Adafruit's JST-PH connector

Adafruit's JST-PH battery selector footprint.

The footprint makes it difficult if not impossible to connect multiple batteries, which reduces the chance for a short circuit.

USB Power Delivery

Another possible way power can enter the board is through the USB connector.  The USB2.0 specification only guarantees 500 mA of current at 5V, which should run our board -- but that 500 mA only comes after negotiation with a host device.  The default is 5V @ 100 mA.  We will depend on the batteries whenever they are available to prevent tripping a computer's built-in current-limiting safety circuits.