Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky

Summary

My father always says he would rather be lucky than good.  I always assume that had something to do with his age.  I never liked that sentiment.  Actually “not like” doesn’t even begin to cover my dislike of that idea.  I guess that I am always distrustful of luck.  But todays post is a story of good luck.  In my post about testing the PCB I showed a picture of my Fluke Meter showing 4.153V DC.  That is cool, expect the power supply in my system is supposed to be regulating the power to 3.3v.  I didn’t sweat the number at the time, but that is a long way from 3.3v.  In fact it is enough to put 3.3V chips-like my accelertomer-at risk of blowing up.  So now what?

LM317 Power LDO Power Supply

Well, on my board I used an LM317 Low Drop Out adjustable regulator.    When I went to setup things up I googled and found this schematic and table of values.  So that is what I put in my design.

LM317 Circuit

I knew that the regulator is adjustable and the feedback resistor network sets the voltage of the output.  When I had the wrong voltage I assumed that I had the wrong size resistors.  So I unsoldered the damn resistors and measured them.  They were dead on, so I put them back on the board.  This left me really wondering, so I went and looked at the datasheet for the LM317.  This is what it says:

There are a bunch of LM317 calculators on the web.  When I looked at them I realized that something might be really bad.  Specifically the resistors from the table (R1=1.2k, R2=1.8k) were probably too large.  That means that there was probably no enough current going back into regulator.  So, this could be the source of my problem.  As I was soldering and unsoldering I realized something really BAD.  I did not put a LM317 on the board.  I put a LM117 on the board.  Holy shit batman!  Why does that work at ALL?

The basic answer is that the LM117 that I used was a 3.3V regulator and had the feedback resistors built in.  Meaning, it wasn’t adjustable at all.  I got totally totally luck as the pinout was exactly the same as the LM317 and ALL I had to do was connect the ADJ resistor to ground instead of the stack.  Moreover, the “tab” was not connected to anything so the output voltage wasn’t shorted to ground either.

As I read the datasheet I learned something else.  My layout is a long long way from optimal.  Here is a picture from the datasheet.

LM117 Datasheet Layout

And here is my layout.

LM317 Layout

Oh well.  I got lucky.  Totally.  I don’t like it.  But there it is.  When I tapeout the board again Ill fix the regulator layout.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: Hot Air Solder Reworking the Accelerometer

Summary

If you have to use a hot air solder tool, you are probably having a bad day.  But when you need a hot air solder rework tool, you are very, very glad to have one.  I am sure that there are people who can get a QFN off a printed circuit board without one, but I am not one of them.  It is even more fun to put a QFN back on a board without one.  But, once again, I am not one of those people.

Hot Air Solder

I have a Metcal HCT-900-11 Hand Held Convection Rework tool aka Hot Air Solder tool.  This machine can blow out hot air … really, really hot air, up to about 950 degrees Fahrenheit.  I’m pretty sure you could cut your arm off with it.  The tool has a bunch of nozzles of different shapes and sizes.  Using one of these things is an art form because you need to get the temperature right, the airflow right, the distance from the board right or you will find yourself blowing components off the board and making things worse.

Metcal HCT-900 Hot Air Solder Tool

Pinball machine PCB Solder Problem

In the post where I discussed the first test of the Pinball board I told you that the power supply was not working.  It turns out that the cause of the problem was a big blob of solder under the accelerometer.  To fix that problem I had to remove the tiny little 3x3mm QFN accelerometer using the hot air solder tool.  Once I did, there was a big mess of solder under the package which I cleaned up with a braided copper wick and a soldering iron.  I suspect that I put too much solder onto the pads with the metal stencil when I built the board.

Here is what the board looked like after I cleaned it up:

Pinball PCB Solder Problem

And here is a picture of the damn tiny chip.  The problem with all of these chips is they are meant to be used in cell phones, so they are as small and thin as possible.  And to make matters worse, the pads are on 0.5mm pitch or smaller.

0.5mm QFN with solder problems

Hot Air Solder Rework

When I first started fighting with these QFN problems, I talked to the guys in the Cypress Development Kit team in India.  The manager of the group recorded this video of Jesudasan Moses, who is a wizard with hot air solder tools and a soldering irons.  This video was a huge help and I am grateful to them for recording it.

To fix my problem I followed the same process.  Here is the video:

After three attempts, I got the chip  mostly on.  As you can see in the picture below, I was missing a connection to one of the pins.  The other problem was that I melted the screen with the hot air.  Suck.

Hot Air Solder rework of 5mm QFN

After I touched up that pin with a soldering iron I still couldn’t talk to it with the PSoC, and I didn’t have easy access to the I2C bus to figure out what was going on.  In the future I need to make sure that there is a place to plug into the I2C bus to debug network traffic.  I will add this to my PCB design guidelines.

Back to the soldering iron to fix it.  I started by putting some flux on the pins of the QFN package.  Then, I draged a very fine tipped iron with a little bit of solder on it across the pins.  After a couple of rounds of this, I got the chip working.  I still need to cleanup the flux, but here is a picture of one side:

Shorts between pins in 0.5mm QFN

And here is a picture of the other side.  You can see that I mangled the capacitor to the right during the rework process.

Hot Air Solder Repaired QFN

I think that a significant source of problems was not having the entire underside of the QFN with Solder Mask.  That would have helped repel the solder and kept the blob from forming.  I think that I will add that to the checklist as well.

Unfortunately when I was looking at the layout trying to figure out what was going on, I realized that the accelerometer interrupt pin was not connected to the PSoC.  This happened because I had the pins connected by “name” in the schematic.  This is something else that I will add to the checklist.

Using a hot air solder tool is definitely an art form.  One that I will need to practice quite a bit before I get to anywhere near Jesusdan level of skill.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: Debugging the PSoC Motor Driver

Summary

I spent a lot of time the last few days building and testing the Pinball board.  This morning when I plugged in my oscilloscope to test the PSoC motor driver, I saw this:

Pinball Machine PSoC Motor Driver Bug

Here is a screenshot directly from the oscilloscope.  When I saw this, I wondered what was going on.  Why does the driver pull-up very quickly, but have some kind of RC delay on the pull-down?  This was particularly troubling as the PWM was set to 50 Hz (see on the picture where the (1) Freq is showing the measurement)

Broken Motor Driver Output

Things got much worse when I increased the frequency to 500 Hz.  In fact, the motor driver doesn’t pull-down at all.

Crazy PWM Output

PSoC Motor Driver

So where do I start debugging?  First I looked at the PSoC Creator schematic.  When you look at the schematic you can see that I took the PWM output and steered it to either M0L or M0R (or M1L or M1R).  Then I used a control register to flip it.

PSoC Motor Driver Schematic (broken)

The M0R/M0L signals are used to control the switches on the H-Bridge.  Here is the actual schematic from the PCB:

PSoC Motor Driver Schematic

I chose the Toshiba TB6612FNG motor driver chip for this design.  It has two H-Bridges built in and is the same one that we used on the PSoC 211 Robot.  You can see from the schematics above that I save 1 pin by attaching the PWM input to “H(igh)” and that I pulse either In1 or In2.

Hbridge Schematic

When you look at this table, or the schematic, you’ll see my problem.  I connected one of the inputs to “L”  That means that the NMOS switch that controls the pull-down is always off.  When the PWM is low, there is no pull-down.  That explains the funny RC pull-down, which is just some leakage on that node.

HBridge Truth Table

 

To fix this, I make this change to my PSoC Creator schematic.  In this configuration I get the following:

CR=00 the output = 00 (stop)

CR=02 the output = 1PWM = CCW

CR=03 the output = PWM1 = CW

PSoC Motor Driver Schematic

Now when I run this thing, here is what I get (at my desired 20KHz):

Oscilloscope of functioning PSoC Motor Driver

And finally a video showing the PSoC Motor Driver working:

Pinball: Driving the OLED using the U8G2 Library

In the previous Pinball post, I wrote about getting the OLED going and getting the footprint onto my printed circuit board.  Now I need to make PSoC firmware to drive the display.  I turns out that there are a number of different driver chips out there including at least SSD1306, SH1106, LD7032, SSD1325, and ST7920 that handle multiplexing the columns/rows, managing frame buffers, power management, etc.  To make matters more fun, these chips support I2C, 3&4 wire SPI and a couple of different parallel interfaces (6800, 8080).  I certainly didn’t want to go down the rathole of building up a complete driver library.  But I didn’t have to, as it turns out that that Oliver Kraus built and open-sourced a very nice library that you can get at www.github.com/olikraus/u8g2.  This library (and its predecessor u8glib) seem to be in pretty wide use in Arduino and Raspberry Pi.

In order to make the library work with the PSoC I had to do several things

  1. Download it from GitHub (git clone git@github.com:olikraus/u8g2.git)
  2. Created a new PSoC4200M project for the CY8CKIT-044 (which was the devkit that I happened to have sitting next to my computer)
  3. Change the build settings (right click on the project and select building settings) then add the directory in “Additional Include Directories” and include the “u8g2/csrc” directory.
  4. Add the header files to the project by right clicking and selecting “Add->Existing item” so that the project can f
  5. Add the U8G2 C-Files to the project (same as step 4 but add the C files)
  6. Build a schematic which has an I2C (for the display) and a debugging UART.  The I2C is configured as a master with 400kbs data rate.  The UART uses the default configuration.
  7. Assign the pins

Now I am ready to build some firmware that will drive the display.  In order to use the library with a PSoC I need to create two functions for the U8G2 HAL to use as an interface to the PSoC hardware.  You initialize the U8G2 system with a call to the u8x8_Setup function.  In that call you need to provide function pointers too the two HAL functions

  1. The GPIO and Delay Interface
  2. The byte oriented communication interface

This is an example of the setup required:

The GPIO and Delay interface is used by the byte oriented communication functions to read/write the GPIOs and provide delays.  This function provides the underpinnings of a bit-banged I2C, UART, SPI etc.  Because I am only going to use PSoC Hardware to provide the I2C interface I will only respond to the delay messages.  All of the delay functions are implemented as busy wait loops, which I am not a big fan of.  The input to the function is a “message” that is one of a sprawling list of #defines in the file u8x8.h.  I believe that I found all of the possible cases, but I am not sure.

The first message, UX8X8_MSG_GPIO_AND_DELAY_INIT doesnt need to do anything because the GPIOs are configured correctly by the default.

I did not respond to the messages of the form U8X8_MSG_GPIO_X which are the read and write of the GPIOs as I am not going to use the bit-banged interface.

The other function that needs to be provided is the byte-oriented communication function.  This function needs to respond to the messages to start, send, and end communication.  I just mapped those messages onto the PSoC hardware APIs.  While I was trying to understand what was happening with the system I implemented a debugging UART which you can see in the #ifdef DEBUG_UART sections.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: Testing the Eagle PCB

Summary

In the previous post I talked about my process for assembling the Pinball PCB.  In this post I will take you through all of the steps that I took while testing the Eagle PCB functionality.  I have not yet written the full Pinball game firmware, so I used a small test program, an Oscilloscope and a multimeter to test each of the subsystems.  In order these are the systems that i tested:

  1. Power Supply
  2. I2C OLED LCD Screen
  3. CapSense (creator bug)
  4. Buzzers
  5. Motor Driver
  6. LEDs
  7. Switches
  8. Accelerometer
  9. Bluetooth

Test the Power Supply

My first step was to plug in the Eagle PCB and see what happens.  There was no smoke, but when I measured the power supply I got this:

fluke power supply measurement

Not perfect and I wondered why I got 4.1v instead of 3.3v.  But, the system will work at 4.1v so I deferred solving the problem until later.  [Edit: It turns out that I did something really stupid and then got lucky.  I will post soon about exactly what happened and how I fixed it.]

Test the OLED LCD Screen

Before I soldered in the LCD display, I decided to measure the I2C pins to make sure they were what I was expecting.  Unfortunately, when I measured them, I had about 800 ohms of resistance between the VCC and Ground which didn’t make a bit of sense.  To make matters worse the SDA and SCL were essentially shorted to ground.  After thinking about it for a while, I decided that the most likely culprit was the QFN accelerometer (which is also attached to the I2C bus).  That tiny little chip, with no-visible leads and 0.5mm pitch pads is an absolute beast to solder (more on this problem in a future post).  The accelerometer looked “OK”, but I decided to remove it anyway using my hot air tool.  As soon as I got it off the board I could see a big blob of solder on the pads.  After I cleaned up the blob of solder with a copper braid and soldering iron, I retested all of the pins.  They were now fine.  So I went ahead and soldered the display into the board (which also turned out to be a bad idea).  You can see the (unpopulated) accelerometer footprint just to the left of the display.

OLED Screen Test

To test the display I ported Oliver Kraus’ U8G2 library to the PSoC.  This library lets you use an I2C to interface with a bunch of different small OLEDs.  You can read more about using the display in a future post.  Here is the block of code that makes the display work:

Test the CapSense

PSoC CapSense Test

In order to test the CapSense buttons I wrote a simple block of firmware to read the state of the buttons and display that state on the screen:

Test the Buzzers

In order to test the buzzers, I just connected them to the PWMs and drove a square wave of 262Hz and 440Hz.

Buzzer 0 PWM Test

Buzzer 1 PWM Test

Here is the schematic for that circuit:

Buzzer PWM Test Circuit

Test the Motor Driver

In order to test the motor drivers, I used a PWM to drive a 50Hz Square wave onto the output.  Unfortunately, I got this:

Motor Driver Oscilloscope Measurement

Something is wrong.  When I first saw this waveform I wasn’t too happy.  But after doing some digging I figured out how to fix it.  This will be the subject of an upcoming post.  The good thing about this waveform is that my daughter, Anna, is studying exponentials functions in Calculus right now.  She recently asked me if there was an useful application of f(x) = e^x.  This was a perfect way to show her a practical application of a differential equation.

Test the LEDs

To test the LEDs I used the switching LED matrix component program that I showed in an earlier post.  To make things easier, I just stuck an LED in each pair of holes to make sure that they were working.  Here is a picture:

Matrix LED Test

Test the Switches

To test the switches, I used the Switch Matrix Component that I talked about in detail in a previous post.  In order to see the switches in their on state, I just plugged in a wire.  Here is a picture of a few of them being tested.

Switch Matrix Component Test

Test the Accelerometer

As I mentioned earlier in this post, the accelerometer had a big nasty blob of solder under it which shorted SDA/SCL to ground.  I am going to dedicate an entire post to fixing this problem.

Test the Bluetooth

The very last sub-system to test is the Bluetooth.  I decided to put in enough firmware that the device could:

  1. Advertise
  2. Disconnect
  3. Restart advertising

And display all of that on the OLED.  Here is a picture:

OLED Display showing BLE Advertising State

iPhone Light Blue BLE Browser Showing Advertising Devices

Bluetooth Advertising Test

Light Blue BLE GATT Database Explorer

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: PCB Solder Reflow the OSH Park – Eagle 1.2 Board

Summary of my PCB Solder Reflow Process

Getting the purple envelope from OSH Park is always exciting.  The big question is,  “After all those hours studying the Eagle PCB editor, did I make the same error three times in a row, or did I finally get it right?”  In this post, I will take you through all of the steps that I follow in in my PCB reflow solder assembly process.  I use a Qinsi QS-5100 PCB Solder Reflow Oven which I talked about in detail in a previous post.  One of the interesting things about this blog website is that it has driven me to write down some of my procedures and move away from the “just wing it” method.  I believe this will pay long term dividends for me.  So, Thank You!

My board assembly process is as follows:

  1. Take solder paste out of the refrigerator and let it warm up (probably at least 2 hours)
  2. Test fit the through hole and major surface mount components
  3. Print out the parts list to use as a checklist
  4. Setup all of the parts on the desk in some order (using checklist)
  5. Tape the board holders to the desk
  6. Make sure the solder stencil registers correctly
  7. Screen on the solder paste (video)
  8. Inspect the solder paste with a microscope
  9. Place all of the parts
  10. Reflow the PCB in the Qinsi QS-5100 oven
  11. Visually inspect the solder and clean up any solder balls
  12. Solder in the programmer connector and program the board
  13. Cleanup the disaster area

Take the Solder Paste out of the Refrigerator

You need to have solder paste at room temperature as cold solder paste does not spread very well.  I recommend that you take the solder paste out of the refrigerator at least two hours before you use it.  I use Kester EP256 solder which comes in a syringe or a tub.  In this case, I purchased it from OSH Stencils when I bought the original stencil.  In two of the videos I watched on the internet, the person put extra solder back into the tub but obviously that cannot be done with a syringe.  My experience has been that older solder paste that has been exposed to air will not reflow properly.  That will make you crazy, and is the reason why I have not gone down the road of saving extra solder.  I cannot emphasize enough to keep your solder cool and fresh.

Test Fit Components onto the OSH Park /Eagle PCB

When I get a new board, the first thing that I do is make sure that the major parts align to their footprint.  You don’t want to get down the road with paste on your PCB and find that you screwed up the size or placement of a component.  Here is a picture of my lab assistant test fitting the PSoC.

Parts Checklist

While I am designing the PCB in Eagle I always create a BOM spreadsheet with the names of the parts, the part number, the label on PCB silkscreen, etc.  I use this spreadsheet to ensure that I have all of the parts available to put on the board.  It sucks to get a PCB with solder paste on it, then be missing a part that you need.  Moreover, you need to move reasonably quickly once you have paste on the board (or the paste will harden) so making sure you have everything at hand is critical.

Setup all of the parts on the desk in some order

For some strange reason, it always feels stressful placing the parts onto the PCB.  In order to make the process smoother, I arrange the parts on my desk in some order.  In this case, all of the parts are by type i.e the resistors are all together.

Tape the PCB Brackets onto the Table

Once I have things setup, I use angled brackets (which came from oshstencils)  to hold the board.  I use blue painters tape from Lowes to hold it all together.  The other thing that I do during this step is remove the tabs from the PCB manufacturing process and file off the rough edges.  The file is just a finger nail file I bootlegged from my wife (don’t tell).

Make sure the Stencil Registers Correctly

The next step is to insure that the stencil registers properly with the board.  You need to verify that the stencil is aligned in both the x-y and angle directions.  It is easy to be “close” but twisted which will give you bad results.  For this build I am using a metal stencil from OSH Stencils.

Screen on the PCB Solder Paste

Once every is lined up, you screen on the solder page.  Here is a video of me doing it for this PCB.

When I was originally trying to figure out how to make this whole process work I found this video from SparkFun which was very useful.

Inspect the PCB Solder Paste with Microscope

Once you have the solder paste screened onto the board, you should look at it carefully.  I typically use my microscope because my vision is not that great.  However, this blowup picture of the board works pretty well.  The only real problem in this picture is the blob of solder on U2 (the Accelerometer) which will cause problems in the reflow.  It is very tough to not get too much solder on the 0.5mm pitch pads.

Place all of the Parts onto the PCB

I was originally planning on making a video of placing the parts onto the board.  But, I need to look in the microscope while I am placing the parts on the board and I didn’t have a good way to record video.  I use a pair of Hakko 7-sa non-static tweezers  which I bought from Amazon.  I have a bunch of different pairs of tweezers and these are by far the best.  This is a picture after all of the parts are placed:

Place in Qinsi QS-5100 PCB Solder Reflow Oven

Now that you have the parts placed onto the PCB, it is time to place it in the PCB solder reflow oven.  I have found that it works best to have my PCB sitting on another board in the middle of the tray (a tip that I got from Ian Lesnet of Dangerous Prototypes).

Visually Inspect the Solder and Clean up any Solder Balls

I almost always end up with 1 or 2 solder balls stuck between the pins of one of the chips.  When you are running the reflow, solder that isn’t attached to anything will ball up because of the surface tension.  Murphy’s law says that the solder balls will not end up anyplace good, and will for sure short some pins together.  You should look carefully for these balls or bridges and clean them up with your soldering iron.  This is a picture of a solder ball from another project.  You can see it between the right two pins on U6 (the chip labeled LTAJT).  The easy way to fix the ball is to squirt a little bit of flux on it, then touch it with your soldering iron.  That will melt the ball onto the pins next to it.

Solder the Programmer Connector into the PCB

The (almost) last step is to solder on the header for the Miniprog-3.  Then let it rip with a blank program program.

Cleanup the Disaster Area

Once all of that is done, my office is a complete and total disaster area.  Yes, I use gloves when I work with solder and you should as well.

In the next post I will take you through the steps I followed to test the Pinball PCB.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: PCB Layout 1.2 Updates using Eagle

Goals for fixing the PCB Layout using Eagle

In the last Pinball post I talked about the 1.0 version of the Eagle PCB not working.  You might notice that the version number on this post is 1.2.  It seems strange to skip a version number.  Well, it turns out that I didn’t skip a version number in fact,  I did the most ridiculous thing possible, I made exactly the same error twice in a row on the PCB layout. That is, I flipped a chip footprint.  Enough about that.

In this post I am going to talk about the new printed circuit board.  As I updated the PCB design for this version of the board I had the following objectives

  1. Fix the flipped footprint
  2. Put a 1″ LCD screen on the board
  3. Move the whole system to 3.3v and simplify the power routing
  4. Provide a jumper selectable 5v/3.3v source for the motors
  5. Fix the USB footprint to a USB plug that can be purchased
  6. Make the silkscreen more readable (and fix the errors)
  7. Fix the ground plane grid on the CapSense Buttons

Here is the OSH park rendering of the new PCB layout.

OSH Park Rendering of Pinball 1.2 Eagle PCB Layout

Fix the flipped footprint

I would have bet money that I fixed the Eagle library to have the correct foot print when I did PCB 1.1.  However, after I renumbered the pins in the package editor, I did not unhook and then rehook them in the library editor.  The result was a flipped footprint, again.  What is particularly frustrating is that I didn’t recheck it on the PCB.  I now have added that to my PCB checklist.

Put a 1″ LCD screen on the board

On one of our WICED WiFi development kits, the IoT team put a really cool 1″ OLED LCD screen.

Internal WICED 943907 WiFi Development Kit with OLED Screen

After I looked around a little bit, I found that the little screen was very available for $3-ish on eBay.  My original plan was to use a bigger screen with an external connector.  But these aren’t as cool and they cost $8.  See what I am saying?

16x2 Hitachi LCD Screen with PSoC 4200M Development Kit

In the upper right hand part of the PCB, I extended it a little bit and put on the footprint.  The only hitch is that it appears sometimes the pins are “VCC/GND” and sometimes the pins are “GND/VCC”.  In order to handle this, I setup four 0-Ohm resistors to allow me to switch the pins.

PCB Layout with 0 Ohm Resistors to select SDA/SCL and GND/VCC

Move the whole system to 3.3v and simplify the power routing

There was no reason to run the system on 5V other than giving a little bit of extra power to the motors.  So, to simplify things I moved the PSoC to 3.3V (which it will happily do).  That allowed me to remove the level translator that I was using for the accelerometer.  By doing this, I could move all of the 5V power to the far left of the PCB, and not route it all over the place.  Here is a screen shot of the PCB layout.  You can see that the power comes in from the USB connector, then goes straight to three places

  1. The 3.3v Regulator
  2. The Mini-Prog-3 Connector
  3. The Motor Power Selector

Eagle PCB layout of 5.0v power supply

Provide a programmable 5v source for the motors

I setup the motor power to be either 3.3v or 5.0v based on the selection of a jumper.  The jumper is a 3-position header on 100 mil spacing.

Eagle PCB layout of motor power supply selection jumper

Fix the USB footprint to a USB plug that can be purchased

In the first version of the Pinball PCB layout I used a USB footprint that I found on the internet.  But, it turns out that footprint was not available.  In fact, I had to search and search for those parts.  I finally found a scrap shop in Poland that had a few of them available.  That was a bad idea.  Here is the new footprint:

Eagle PCB layout footprint of USB connector

Make the silkscreen more readable (and fix the errors)

My eyes really don’t like any silkscreen that is less than 30mils tall.   There are some people who can see a smaller font, but I am just not one of them.  I really prefer 40mil tall letters to occur in my PCB layout.  I have updated the checklist with a chart of what is legible and illegible.  In addition I had a few errors like the one below (there aren’t two V50 pins next to each other, one is supposed to be ground.)

silkscreen error in original PCB layout

Fix the ground plane grid on the CapSense Buttons

To get the best CapSense performance you should not use a solid ground plane in your PCB layout (like the one below).  You should use a cross hatched ground (like the picture at the bottom).  You can read about this in the Cypress application note or in my design guidelines.

solid ground pour around PSoC Capsense PCB layout

Cross hatched ground pour around Cypress PSoC Capsense PCB layout

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: OLED Display

I screwed up the Pinball board design AGAIN!!!  It is so frustrating.  Ill write about the new design soon (and punish myself for the error.) As I worked on redoing the design I decided to put a footprint on the PCB for a small OLED LCD.   The display has an I2C interface, is about an inch wide and has 128×64 pixels… But, best of all can be purchased on eBay from China for about $3.00.  Here is a picture of the display with a PSoC4M driving it:

The display will go on the right side of the board.  Here is a rendering of the new board from the OSH Parks website:

After I decided to put the footprint on the board I bought several displays from Amazon to try out, and to make sure that I knew how to make them work.  I immediately ran into some drama which caused me an evening of frustration.  If you look at the picture closely you can see that the power and ground pins are swapped:

After I realized that was going to be a potential problem I put in a set of 0 ohm resistors on the upper right hand part of the board so that I could swap power/ground and scl/sda connections.  Here is a snapshot of the schematic and layout:

This left me with what software to use to drive the display which I will address in the next post.

 

Eagle PCB Layout Guidelines + OSH Park

Summary of Eagle PCB Layout Guidelines

I typically design my PCB’s in Eagle and have them manufactured at OSH Park.  Each new PCB layout feels like I am starting nearly from scratch because I only do about 1 or 2 boards per year.  Every time, as I go through the process, I promise myself that I am going to write down the list of things that I always need to relearn.  But, I never seem to get the list written down.  Today things change.  Here is my list:

  1. Make sure that you can actually purchase the components you put in your design
  2. No Airwires
  3. Vias tented (or not)
  4. Ideally no more than 2 vias on a net
  5. Power nets > 40mil
  6. Auto router setup
  7. Fill on the ground plane
  8. Ground fill around CapSense Widgets
  9. Test points on key nets – at very least power and ground
  10. Silkscreen font size
  11. Silkscreen labels on key nets
  12. Silkscreen key information onto the board
  13. Put in power supply jumper
  14. If there is I2C then put in a blank header to connect a mini-prog-3
  15. Extend the QFN footprints enough to be able to rework them
  16. Try not to route under QFNs
  17. Try not to use QFN with 0.5mm pitch
  18. Use the eye tool to compare every net in the schematic and layout
  19. DRC
  20. ERC
  21. CAM Job
  22. Don’t forget about the stencil

Make sure that you can actually purchase the components you put in your design

I used a footprint I found on the internet assuming that there was good availability for it.  But, I ended up having to order some weird USB connectors from a salvage shop in Poland.  I guess that I felt lucky to have been able to find them at all.  Unfortunately, I did the whole board and sent it to the shop before I was sure that I could buy everything.  Always always check to make sure you can purchase the device you place on the board.

No Airwires (seems like it would be obvious… but)

Airwires show the connectivity that is drawn in the schematic.  Unfortunately they don’t conduct electricity.  Until a REAL connection is made you will have a yellow flight line connecting between the pins in your layout.  Before you tapeout the board you MUST MUST press the Ratsnest button and get the message “Ratsnest: Nothing to do!”

Eagle PCB message when all connections are made i.e. no airwires exist

If you do this:

An example of an air wire that will make you Eagle PCB not be connected.

Then you will need this:

An example in Eagle PCB of what happens if you leave an airwire unconnected

Vias tented (or not)

A tented via or a plugged via is a connection between the top and bottom of the printed circuit board that is covered with solder mask.  In general there are probably enough vias on your board that if you don’t cover them you will not be able to see the silkscreen (either because it won’t print on copper or because the PCB vendor will trim it).  Here is a picture of one of the versions of Physics Lab where I forgot to tent the vias.  In the upper left where it says “Elkhorn Creek Engineering” you can see that the “l” in Elkhorn and the “g” in Engineering is partially missing where there is a via in the board.

An example of an Eagle PCB with untented vias.  This board was made at OSHPark

In Eagle PCB, Vias (and Pads) are automatically covered with the “tStop” mask.  Here is a screen shot of a PCB that I am working on with just the “Pads”, “Vias” and “tStop” layers shown.  You can see the “big” holes which are Pads for through-hole components.  You can see that they have the diagonal white lines through them that represents the “tStop” mask.  tStop is the mask that prevents the solder mask from being applied.  In the picture you can also see the tStop on places where there are SMD pads.  And, you can see a bunch of the smaller vias which are not covered.

An example of an Eagle PCB with via and stop mask turned on.

To tell Eagle PCB to turn off the tStop for vias you need to change the design rules on the “Tools->DRC->Masks” screen.  The limit parameter tells Eagle PCB to NOT create “tStop” for any via/pad that is less than 30mil in diameter.

Eagle PCB DRC rules screen where tented vias are specified.

No more than 2 vias on a net

I always strive to keep all of the nets on my two layer print circuit boards to have no more than 2 vias.   To look for this I click on the “eye” tool to probe each net of the layout, then I manually trace the net.  Here is a screen shot of a net that I try to avoid.  You can see that the net starts on the SMD pad in the lower right, then winds its way to the top left.  It goes through 4 vias.  Unfortunately it goes through one more via before reaching the SMD pad just below the upper left.

An example of proving a network using the Eagle PCB eye tool to look for more than 2 vias on a net.

Power nets > 40mil

I like the power and ground nets to be routed in at least 40mil wires.  To do this, you first need to create another net class in the “Edit–>Net classes” menu.  I always create a class called “power”.  Then I set the minimum width to 40mil.  If for some reason you want to have a minimum clearance or drill you can set this here as well.  If you leave it at 0,  Eagle PCB will use the default rules.

How to specify 40mil spacing on a power net in Eagle PCB.

After you have created the power net class, you then need to assign the correct nets to the net class.  You do this in the schematic by selecting the “I” tool, then clicking on the net.  Then you can select the “Net Class” for that net.  In this case I am editing the V50 net.

How to attach a signal to a specific net class in Eagle PCB.

Auto Router Setup

I am absolutely terrible at designing PCBs.  This frustrates me to no end.  One of the crutches that I like to use the the Eagle PCB Autorouter.  The only change that I currently make is to use the “*” option to let the router go whatever direction it thinks that it should.

Configuring the Eagle PCB Auto Router.

Fill on the ground plane

To create a ground plan you need to:

  • Draw a “polygon” around your board in the “top and bottom” layers.
  • Attach those polygons to the correct net e.g. “gnd” by typing the “name” command and then clicking on the ground polygon

When you press the “ratsnest” button Eagle will fill the ground plane.

An example of the ground plan pour in Eagle PCB.

If you want it to unpour it you can run “ripup @;”.  When the ground plane is not filled it will appear as a dotted line around the board:

Eagle PCB ground plane pour example

To attach the top and the bottom ground planes together you need to put a via on the correct net.  To do this:

  • Click on the “via”
  • Click where you want it to attach the top and bottom
  • Add to the the right net using the “name” command and then typing the signal name

How to attach a polygon to the ground plan in Eagle PCB.

Ground Fill Around CapSense Widgets

In order to get the best CapSense performance you want to have a “hatched” ground plane surrounding your widgets.  The methods for doing this are documented in the CapSense Design Guideline Section 6.4.9 “Ground Plane”.  Here is an idealized view of the back of the front and back of the board:

PSoC CapSense ground plane

PSoC CapSense ground plane example

The guidelines go on to recommend that you use 25% (7 width 45 spacing) coverage on the top and 17% (7 width 70 spacing) on the back.  To do this in Eagle PCB you draw a normal polygon on the top and bottom.  Then you use the name command to give it the “ground” name.  Then you click the “i” to set the parameters.

  • Set the width to 7 (mil)
  • Set the polygon pour to “hatch”
  • Set the Spacing to 52 (mil).  The only trick is that the Eagle PCB spacing isn’t actually the spacing between the lines but the Pitch between the hatched cells.  So to achieve 45 mil spacing with a 7mil line you need 45+7=52 “spacing”

Specifying the ground plane pour for a PSoC Capsense in Eagle PCB

Test points on key nets – at very least power and ground

It is a serious PITA to debug a board if there is no place to attach test leads.  I like to use a looped wire that you can install onto the board through a PAD.  Here is a red one that I use on power nets that I bought from digikey.com

PCB Probe Point

Silkscreen Font Size (don’t go less than 30mil@15%)

I believe that the best practice for your silkscreen fonts is to first tell Eagle PCB to use “Always vector font” on the “Options–>User Interface” menu.  This will make what you see on the board much closer to what you see on the screen.

Eagle PCB Vector Font

There are two issues with font size.

  • First, what can you see (Im 48… so my fine vision is going away) so I think 30mil is the absolute minimum.  40mil or 50mil is even better.
  • Second, what your PCB design house can print (about 5mil at OSH Park)

I am having my current PCB made at www.oshpark.com.  I could not find their silkscreen spec on their website… but an OSH Park Person “tweeted” that they can print 5mil silkscreen.

Given all of that.  Your best bet is to use a “vector font”.  When you select a vector font, you specify how tall the characters are, and how thick the lines are as a % of the height.  Here is a screenshot of my “SDAT” label.

Creating a silkscreen in Eagle PCB

I made this table of what I think is a safe range:

Eagle PCB Font Size Guidelines

On the the lukemiller.org blog I found a picture of an OSH park board with some different vector combinations:

Example PCB Font Sizes

On the justgeek.de blog I found another board:

Example PCB Font Sizes

Silkscreen on key nets

You should make sure and label every pin that you would need to interact with or debug.  For example, the board below has a place to plug in a miniprog-3 in 5-pin mode:  The connection is directional so labeling the pins is key: [Note: A friend of mine noticed that I labeled the MiniProg-3 connection INCORRECTLY!!!! notice that there are two V50 (when in reality the inboard one is supposed to be ground]

Example of an error in an Eagle PCB Silkscreen

Don’t forget about the back of the board.  If you don’t put labels on the back, you will endup trying to figure out what the holes are (like the ones in the lower right) by flipping the board back and forth.

Example of Eagle PCB Silkscreen

Silkscreen key information onto the board

You should definitely “comment” your board on the silkscreen with at very least:

  • Name of the board
  • Version number of the board
  • Name of the maker e.g. www.iotexpert.com

Key information on Eagle PCB Silkscreen

Put on Power Jumper

You should also put in a 2x100mil spaced jumpers with a 0 ohm resistor shorting them in the path of the power so that you can measure the power supply current.

If there is I2C then put in a blank header to connect a mini-prog-3

If you have an I2C bus in your design, and you have room on the board, you should provide a place to plug in the 5-pin mini-prog3 to help you debug.  This will let you interact with chips on the bus without having completed the firmware for the central MCU.

Cypress Miniprog-3

Extend the QFN footprints enough to be able to rework them

If you extend the edge of a QFN pad by 0.3mm past the edge of the chip, you will have some chance to be able to see that the original reflow worked (or didn’t).  In addition you will give yourself a small chance to be able to rework it with a soldering iron.  For example in the picture below you can see the pin one in from the left has no solder on it.  I was able to successfully rework this pin with a soldering iron.

Eagle PCB QFN Footprint

Try not to route under QFNs

If you have all solder mask under your QFNs it will be much easier to do the original reflow as it will push solder out from under the chip.  On tiny pitch QFNs if you have routing you may end up with a messy blob of solder.  Here is an example of what not to do.

Example Eagle PCB QFN Footprint

Try not to use QFN with 0.5mm pitch

Try to use 0.65mm pitch QFNs as they are much easier to reflow.  If you use 0.5mm pitch QFNs you are going to struggle to get them correct.  If you use a pitch less than 0.5mm then good luck to you.

Use the eye tool to compare the schematic and layout

I always open up the schematic and layout in side by side windows.  Then I click on each device in the schematic and look at the results in the layout.  In the picture below I clicked on “SWCOL2”.  This is called cross probing.  You should look at each net one by one to make sure that nothing funky happened.

Eagle PCB Eye Tool for net cross probing

DRC

The Design Rule Checker (DRC) in Eagle PCB works pretty well.  USE IT.  You can get a rules file from OSH Park (for their two layer process) from their website

You can also use the freedfm.com website to check your files.

Two things that you should be aware of when you run your final DRC.

  1. If you setup a special rule for the power net-clasesses that is greater than the minimum rule you may want to turn it back to the minimum when you run the final DRC.  For example, when I setup the ground layer as a power layer, I set the minimum rule to be 40.  Before I run the final DRC I set it back to 6.
  2. For any polygon that is setup as a pour, you will need to set the minimum width of that polygon to be the same as the minimum for the layer.  For example: the minimum top metal width at OSH park is 6mil.  This means you need to set the minimum width of the ground pour to be 6mil.  Here is a screenshot of the corner of the board:

Eagle PCB DRC

ERC

The Eagle Electrical Rule Checker (ERC) typically catches some problems.  By far my biggest problem with the schematics in Eagle is that I occasionally make two wires “connect” by touching, but Eagle doesn’t think that they are connected.  The ERC seems to catch this problem pretty well.  You should at least run it and go through the errors to make sure that they are false.

CAM Job

In order for OSH Park to make your PCB you need to make Gerber files.  Actually, OSH Park can do that for you, but I recommend you do it for yourself so that you are sure what is going to get made.  Gerber files are the lingua franca of the PCB business.  One file contains one layer for manufacturing, so you will need one file for each layer.

To do maker the Gerbers you need to run the “CAM Processor” which can be found on the tools menu.  I reccomend that you start with a preexisting CAM job (like the one that you can download from OSH Park)

The CAM job will have one “tab” for each layer that it creates.  In the picture below you can see that I am making the Top Silkscreen.  That layer is created by combining “tPlace” and “tNames” onto one layer and then writing it to the file “…/…/…/gerber/.GTO” in the GERBER_RS274X format.

Eagle PCB CAM Job Configuration

The file naming convention is:

File Extension Description
.GTO Top silkscreen
.GTL Top copper
.GBL Bottom copper
.GTP Top Paste (aka the solder paste layer.. you make the solder stencil from this layer)
.GBO Bottom silkscreen
.GTS Top Solder Mask
.GBS Bottom Solder Mask
.TXT Drill file – used for CNC mill that drills the holes in your board.. this is not a Gerber file

After you have the Gerber files you can look at them in gerbv which is an open source tool.

Gerbv Gerber Viewer

Stencils

Lastly, don’t forget your stencil.  I buy mine from www.oshstencils.com which is linked to www.oshpark.com, so you can just select your solder mask from the project that you already uploaded.

Pinball: The PCB Version 1.0 – Fail

I got the boards back and assembled several of them… and they do not work.  It has been a really really frustrating few days trying to figure out what was going on.  I started with the assumption that I had a soldering problem so I soldered it and resoldered it about 10 times.   I used the soldering iron, I used hot-air, I reflow’ed the board, and I did 3 different complete board re-dos.  None worked.  I really wanted this to work before Maker Faire.

Finally I gave up and sent my board to our kit team in India.  This is not such a simple thing to do as you need to have commercial invoices for all of the stuff that I sent them… after getting it rolling and patiently waiting for three days for Fed-Ex to get it through all of the customs hoops etc. I get this email from the Kit Manager:

email

Damn damn damn… I know that I double checked the package.  That is such an amateur mistake… alway always always check your footprints.  But Ronak is right, here is a screen shot of the Eagle Layout which I clicked on Pin 2. (I rotate the image to make it line up with the data sheet)screen-shot-2016-09-24-at-8-16-22-am

And it matches the the picture from the data sheet for the module… However… notice that it says “Bottom View” which means I flipped it.

screen-shot-2016-09-24-at-8-14-43-am

Here is a screenshot of the package in the eagle library… sure enough. It is flipped.

screen-shot-2016-09-24-at-8-24-47-am

More evidence, here is the top view:

 

screen-shot-2016-09-24-at-8-13-47-am

So, I need to fix the package and then re-do the layout.  I start this process by making a new branch in git.

screen-shot-2016-09-24-at-8-41-00-am

Then open the library and the package:

screen-shot-2016-09-24-at-8-40-10-am

To make things easier I turn off all of the layers except for Top.  This allows me to easily click on each pad.  One thing that is a bit of a PITA is that you have to change of all of the pads to something else before you can change each one to what you want e.g. you can’t rename the pad currently named 1 to be 32 because there is already a 32.  So, what I do is rename each pad to the new name with an A on the end (see the image below).  Once that is done I go back around and remove the “A”s.

screen-shot-2016-09-24-at-8-51-18-am

Once my package is fixed, I update the library that I am using in my layout.

screen-shot-2016-09-24-at-8-59-55-am

Eagle immediately tells me that I have a problem… which is true, so true.

screen-shot-2016-09-24-at-9-00-20-am

Then I ripup all of the nets, which is so sad.  The problem is that all of the things I had on the left are now on the right and visa-versa so I need to think about the whole placement.

screen-shot-2016-09-24-at-8-57-45-am

Once I have ripped up all of the nets, I then cross probe all of the nets (In this case M1R which is also pin 31) to make sure that I have the connections in the right place.

screen-shot-2016-09-24-at-9-04-12-am

OK.  Looks good.  Not commit the changes and put them back to the github with a change request.

In the next post Ill talk about the new layout.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: The Printed Circuit Board Version 1.0

I am supposed to be good at this stuff.  What is this stuff?  Simple, everything engineering.  Unfortunately, I suck at PCB layout.  This is something that I am loath to admit because it is so frustrating. There it is.  But I need a PCB to make this work, so here we go again.  What also sucks is that I entitled this post “Pinball: The Printed Circuit Board Version 1.0” because I know that it is going to take multiple versions.  I don’t know what the exact cause is going to be this time.  But it will be something.  Enough whining.  Onto the task at hand.

When you start from an empty board Eagle gives you the tantalizing picture of a blank board with the components you need laid out neatly.  All you need to do is move them onto the tabla rosa.

Screen Shot 2016-08-29 at 5.21.40 AM

Initially there are several constraints that I am trying to satisfy.

  1. I want the board to cost <$5 so it needs to be <5 Sq. Inches
  2. The Pinball machine has space on the front for something roughly the shape of a deck of cards (2.5″ x 3.5″)
  3. The power connector needs to be at the bottom
  4. The user interface needs to be at the right (buzzers, capsense buttons) because Billy is going to cover the left side with some acrylic.

We had originally thought about making a 3-D printed box for the design, but decided that it would be cool to be able to see the board.  It also saves several dollars in cost to get rid of the box.

All right, I suppose that it is time to get to it.  First I move all of the component from “off the board” onto the board.  They all need to appear inside of the dimension layer.  If you look at the pinball machine I want all of the wire to come from the top and then go down into the machine.  So I place the holes for the LEDs and the Switches at the top of the board.  I want the user interface to be on the right side of the board (since most of the world is right handed… sorry about the left handed people).  So, I place the capsense buttons and the reset button on the right side of the board.  The BLE Module needs to have the space under the antenna without a ground plane and without signals, so I decide to put it at the bottom of the board.  I decide that the I2C port for the LCD will go on the left side of the board as that will make the connection to the LCD on the left side of the pinball machine easier.  Finally I put the accelerometer and all of the stuff that it takes to run it on left left side as well.

screen-shot-2016-09-25-at-10-07-51-am

Once the placement is all done, it is time to route the signals.  I do this through a combination of the autorouter and manual routes.  After I get all of the routes done, I place GND via(s) all over the board to connect the top and bottom ground pours.

screen-shot-2016-09-25-at-10-06-25-am

When I click the rats nest button the pours happen and I can see that there are no unrouted nets.

screen-shot-2016-09-25-at-10-05-40-am

Next I  do the top silkscreen

screen-shot-2016-09-25-at-10-10-09-am

Finally the bottom silkscreen

screen-shot-2016-09-25-at-10-11-31-am

The last step is to re-check all of my printed circuit board rules (the subject of the next post).  Now that I have a printed circuit board I can send to OSHPark to be made.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: The Eagle Schematic

In the last bunch of posts I have talked about the main systems of the pinball machine electronics package.  Now it is time to assemble all of those pieces into a complete system on an Eagle schematic which you can find in the “eagle” directory on the github site.

I use the multipage capability of Eagle to partition the schematic into 7 pages.

  1. Main Page
  2. LEDs
  3. Switches
  4. Accelerometer
  5. Power
  6. Motors
  7. Test Points

The main page contains the

  1. PSoCBLE module:  Notice that I used every single pin except for VRef.  Also notice that I overloaded SWD-Clock and SWD-IO pins by attaching capsense buttons to those pins.  This means that I will never be able to debug and use Capsense at the same time.
  2. USB Connector:  When I was trying to figure out how to make the board less expensive my son suggested that everybody has a USB charger, so why don’t you just power the pinball machine with that?  I thought that this was a great idea as it eliminates a $5+ wall wart.
  3. Two buzzers.  These are super simple low cost 12mm through hole buzzers which are used by the MusicPlayer component.
  4. Two capsense buttons multiplexed to the SWDCLK and SWDIO pins of the chip.  Notice that they have a 560Ohm series resistor
  5. The reset button for the system which just pulls down the XRES when you press the button.  It also has the 10K pullup resistor which pulls up XRES when the button is not being pressed
  6. Pull-up resistors for the 5V I2C bus.
  7. A 5-Pin programming plug for the MiniProg-3 connected to SWDIO and SWDCLK and the Power/Ground
  8. A plug for the I2C LCD to connect to the I2C Bus

screen-shot-2016-09-25-at-6-44-48-am

Page two of the schematic contains two connectors for the LEDs which I talked about in detail in the Matrix LED Posts .  It also contains the current limiting resistors.  In order to save money in the BOM I am not going to actually put connectors into the 100mil center holes, but will let the kids learn to solder by attaching the wires directly into the holes with solder.

screen-shot-2016-09-25-at-6-45-06-am

Page three of the schematic contains the switch matrix connectors and diodes.

screen-shot-2016-09-25-at-6-45-20-am

I thought that it would be a really cool idea to have an accelerometer on the board to provide a tilt functionality.  This actually turned out to be a serious PITA because I couldn’t find a cheap accelerometer that was 5v.  So, in addition to the accelerometer I have to provide a level translator for the I2C bus (PCA9306) and a level translator for the Accelerometer interrupt line (the mostfet and pull-up resistors).  I also have to provide a 3.3v power supply (next page of the schematic)

screen-shot-2016-09-25-at-6-45-36-am

The 3.3v accelerometer requires a 3.3v power supply, so on this page I use an REG317 to create 3.3v from the VBUS power supply.

screen-shot-2016-09-25-at-6-45-54-am

In order to drive the two brushed DC motors I use a TB6621 motor driver chip that contains two H-Bridges.

screen-shot-2016-09-25-at-6-46-04-am

Finally I like to have test points on the board to measure stuff while I am assembling the board.

screen-shot-2016-09-25-at-6-46-15-am

In the next post Ill talk about the creation of the layout for the printed circuit board.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: The Motors + Hbridge

When Billy and I talked about making the electronics package for the Pinball machine, I suggested that it would be cool to have some motors.  Mr. Mechanical Engineer’s eyes lit up when I made that suggestion.  There are tons of things that the kids to could with a couple of controllable motors.  You could imagine conveyor belts, spinning obstacles, and all manner of lift systems.

I wanted to use inexpensive DC Toy motors.  The problem with most motors is that they require higher voltages (5-9 volts) and currents (250mA for the one that I wanted) than the PSoC (or generally any MCU) is capable of delivering.  Well that’s OK, it turns out there is a whole class of Power Management ICs (PMICs) which provide translation between an MCU and a Motor.  The one that I am going to use is called the TB6612.  This chip has dual Hbridges that help you control both the speed and direction of two motors.

First, the chip uses NMOS transistors configured as switches to let you control higher power (voltage and current) circuits.  Here is a picture of the input to the PMIC from the datasheet:

screen-shot-2016-09-25-at-8-15-00-am

Second you want to be able to control the speed and direction of the motor.  Here is a screen shot from the data sheet that shows the inputs and what happens with the motor.

screen-shot-2016-09-25-at-8-13-11-am

Here is a picture that shows you how the current flows through the Hbridge as well as showing the circuit that keeps you from short circuiting between the phases.

screen-shot-2016-09-25-at-8-16-46-am

So, how do you control the speed?  Simple, you use a PWM to create a train of pulses that have different duty cycles.  The greater the duty cycle, the faster the motor goes.  The lower the duty cycle, the slower the motor goes.

One last problem.  The chip requires IN1, IN2, PWM and Standby, but I want to only use two outputs from the PSoC.  So, what I decide to do is

  • Turn the standby off (so that the chip is always active)
  • Attach the PWM input to high so that the motor is always spinning
  • Attach In1 and In2 to the PSoC.  The PSoC will then set them to the correct value and PWM.

In the next post Ill start the process of turning all of the different blocks into a schematic that can then be turned into a printed circuit board.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

 

Pinball: The Music Player (Part 4)

In the previous three posts I created a Music Player component by building the symbol+schematics, making a public interface, and writing the firmware.  In this post I will show you the test program called “MusicTestComponent”.

In order to get access to the PinballComponents library project I first right click on my project and edit the dependencies.  Specifically, I click on the box that adds the “PinballComponents” as a dependency of the MusicTestComponent project.

screen-shot-2016-09-23-at-11-01-14-am

After setting up the dependencies you can then make a schematic with the MusicPlayer and a UART.  The UART will be used to trigger commands to be sent to the MusicPlayer Component.

screen-shot-2016-09-23-at-10-56-05-am

I start the main firmware by creating a test song called “scaleNotes” (lines 5-12).  I then turn that array of Notes into a Song by declaring  a Song and adding the scaleNotes to the song (lines 15-19).

screen-shot-2016-09-23-at-10-54-51-am

At the start of the program I turn on the interrupts and start the components (line 27-31).  Then I add my song to the component (so that it can play it) with line 33.

In the main loop of the program I grab characters from the UART and issue commands to the MusicPlayer component based on what button the users presses.

On lines 57-62 I have a debugging pinout that prints out the currently playing note number each time the note changes.

screen-shot-2016-09-23-at-10-55-10-am

Thats it.  In the next post I will start taking you through the process of designing the printed circuit board.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply

Pinball: The Music Player (Part 3)

In this previous posts I showed you the Schematic/Symbol and the public API for the Music Player.  In this post I will take you through the firmware.  The first section defines:

  • Parameters of the system, specifically the clock frequency and PWM prescaler (line 4-5)
  • The internal variables that are used to keep track with what is happening on the son (lines 8-12).
  • The notes for twinkle twinkle little star (Lines 22-43)
  • An array to hold songs (line 47-48)

screen-shot-2016-09-22-at-6-18-09-am

The GetNote function just returns the current songs currently playing note number.  I used this function when I was trying to debug the player.

The FrequencyToPeriod uses the settings of the PWM and the desired frequency to calculate the Period/Compare values to achieve the desired output.  The PWM has three parameters that change its output.

  • The input clock
  • The input prescaler (just a divider on the front end of the PWM)
  • The period (what you are trying to calculate)

screen-shot-2016-09-22-at-6-23-55-am

The next note function figures out the right settings for the PWM based on the desired frequency of the note, then sets up the PWM to the correct values (line 88-91), it then calculates how long to play the note (line 92).  Finally it sets thing up for the next note (line 97-101)

screen-shot-2016-09-22-at-6-20-46-am

The SysTickCallBack function controls the amount of time that

  • A note plays (lines 138-139)
  • The gap between the notes (lines 132-136)
  • The buzzer sounds (116-124) if the TWO_CHANNELS are enabled

screen-shot-2016-09-22-at-6-21-09-am

The Start function initializes all of the internal variables to turn off the songs.  The MusicPlayer uses the SysTick timer to keep track of how long the notes and the Buzzer have been on/off.

The Stop function turns off the Buzzers.

screen-shot-2016-09-22-at-6-21-31-am

The function PlaySong initializes all of the internal variables that are used to keep track of the song status.  It points at the first note, then it calls the NextNote function.  This function returns the ErrorCodes value which enables me to do a range check and existence check on the song number (lines 185-188).

The SetBPM changes the internal variable _BPM which is used to calculate the duration of notes.  This function also returns an ErrorCodes value after doing a range check.

The AddSong function allows the component user to define a new song and to assign it the list of Songs.

screen-shot-2016-09-22-at-6-26-49-am

The last section of code provides the buzzing functionality.  These function turn on and off the 2nd buzzer.  The first function turns on the 2nd buzzer at the requested frequency for either 0-means infinite time or a # of milliseconds.  Notice that this section of code only shows up if the user has turned on the second channel (line 230).

screen-shot-2016-09-22-at-6-34-43-am

In the next post Ill show you the test code for the component.

You can find all of the source code and files at the IOTEXPERT site on github.

Index Description
Pinball: Newton's Attic Pinball An introduction to the project and the goals
Pinball: Lotsa Blinking LEDs Everyone needs a bunch of LEDs on their Pinball Machine
Pinball: Matrix LEDs (Part 1) Saving PSoC pins by using a matrix scheme
Pinball: Matrix LEDs (Part 2) Solving some problems with the matrix
Pinball: Matrix LEDs Component How to turn the Matrix LED into a component
Pinball: A Switch Matrix Implementing a bunch of switches
Pinball: Switch Matrix Component (Part 1) The switch matrix component implementation
Pinball: Switch Matrix Component (Part 2) The firmware for matrix component
Pinball: Switch Matrix Component (Part 3) Test firmware for the matrix component
Pinball: The Music Player (Part 1) The schematic and symbol for a Music Player component
Pinball: The Music Player (Part 2) The Public API for the Music Player component
Pinball: The Music Player (Part 3) The firmware to make the sweet sweet music
Pinball: The Music Player (Part 4) The test program for the music player
Pinball: The Motors + HBridge Using an Bridge to control DC Motors
Pinball: The Eagle Schematic All of the circuits into an Eagle schematic
Pinball: The Printed Circuit Board 1.0 The first Eagle PCB layout of the printed circuit board
Pinball: The PCB Version 1.0 Fail Problems with the first version of the Eagle PCB layout
Pinball: PCB Layout 1.2 Updates using Eagle Fixing the errors on the first two versions of the Eagle PCB
Pinball: Assemble and Reflow the 1.2 PCB Assembling the Eagle PCB
Pinball: Testing the Eagle PCB Firmware to test the newly built Pinball printed circuit board
Pinball: Debugging the Motor Driver Fixing the motor driver PSoC project
Pinball: Hot-Air Reworking the Accelerometer Solder Using a Hot-Air Rework tool to reflow a QFN
Pinball: Debugging the LM317 Power Supply- A Tale of Getting Lucky Debugging the LM317/LM117 power supply