PSoC4000s and the CY8CKIT145 Stamp Board – Part 1

One of the cool things about my job is I get to try out lots of new development kits before they are released to the general public.  In the previous post I talked about the demonstration I gave at the Embedded World conference using the CY8CKIT-042 BLE.  You can find a complete video tutorial for that project on the cypress.com video tutorial website.  While I was at the conference, I picked up an engineering sample of a new development kit and put it into my backpack because I wanted to try a new feature of PSoC Creator on the way home.  But, when I got on the airplane, I thought I would build the same project I had demonstrated at the conference using this kit.  So, in the next few posts, I am going to show you the new CY8CKIT145 Stamp Board and how to build an IOT solution with it.

It is called a “stamp board” because it comes in a flat postage stamp-like postcard mailer.  Here is a picture of the front and the back (you can see that it has already lived a hard life riding around in my backpack).

IMG_2720

Here is the back of the mailer:

IMG_2722

In the picture you can see the yellow label proclaiming this to be an engineering sample.  It doesn’t seem like much, but when you pull back the front of the package you get to see the surprise:

IMG_2721-1

The kit can literally be broken into four separate pieces:

  1. The main board:
    • The PSoC4000S
    • A reset switch
    • A user LED
    • A user push button
    • A programming selector (to pick either the PSoC4000s or the PRoC BLE (that is on the back of the kit)) as the target of the programmer
    • All of the PSoC4000S pins are available on the 100mil center headers
    • A PCB footprint for a 10-pin ARM programming header
  2. A programmer board:
    • A PSoC5LP programmed with KitProg2 Firmware
    • A programmer mode button
    • 100mil center header with some of the PSoC5LP pins
  3. A Capsense slider user interface board with a 5 Segment Slider and 5 LEDs
  4. A Capsense button user interface board with 3 mutual capacitance buttons and 3 LEDs

145front-e

And the back, with the tiny 10mm X 10mm PRoC BLE module:

IMG_2706

Here is the schematic for the board:

CY8CKIT-145_PSOC_4A-S1-page1

CY8CKIT-145_PSOC_4A-S1 page 2

CY8CKIT-145_PSOC_4A-S1-page3

I wanted to build a project that would have two-way communication between my iPhone and the board, and would be compatible with the Swift App I had written.  The user of the board would have a capsense slider (and LEDs) of which the iPhone App could read the position.  In addition, it would have an LED that the iOS app could turn on and off.  Here is a demonstration that I filmed with my iPhone on the airplane:

In the next post I will describe the overall system and show you the firmware.

Embedded World 2016

I spent the past week in Nuremberg, Germany at the Embedded World conference doing my day job.  At the show, I spent some of my time teaching people how to program PSoCs.  For some crazy reason they thought that it would be a good idea to give me a microphone and find out what comes out of my mouth- generally that is something semi-crazy and it is always loud.    Here is a picture of me talking to the crowd (I am the one in the blue shirt facing the crowd)

IMG_5570

So what did I talk about?  Well, at this show, IOT was the big buzz.  So I decided to teach people how to make an IOT device using the Cypress PSoC 4 BLE.  This was similar to a recent video tutorial that I had made.  I started with a blank schematic in PSoC Creator and a CY8CKIT-042BLE,  I then added a capsense slider, an LED, a PWM, and the BLE component.  Then I showed people how to write the firmware.  I did all of this live, which can make things interesting at times.  At one point on Thursday, my wife called from KY and it seemed like a good idea to answer the phone.  She was a good sport when I put the microphone next to my cell phone and talked to her live during while I was presenting.

You can get the step by step instructions for this project on the cypress.com video tutorials website.  While I talked, the Cypress people handed out free development kits which was a big hit with the crowd.

The morning of the last day I reflected back on the last several years and realized that this show was a coming of age for the Cypress PSoC 4 platform.  We finally had a very robust family of parts from the tiny PSoC 4000 all the way to the large PSoC4200L.  The family had an ARM Cortex M0, Capsense, BlueTooth Smart, CAN, LIN, USB, ADCs, SPI, UART, OP Amps, Analog Mux and Programmable Digital Blocks.  In addition to the chips, we had a big library of well written application notes,  a bunch of cool development kits and best of all we had PSoC Creator which is an amazing, magical, free IDE for building your projects.

On Monday, we had just announced the new PSoC4000S (S stands for small) with a new low power capsense block that included mutual capacitance sensing.  During the show we were using a new “stamp” board to show off the chip.  In the next post Ill show you what I did on the airplane ride home from Germany.

IMG_2703

The Creek: CYPI, a Raspberry Pi to Arduino Bridge

In the summer of 2013, I decided that I needed to design a printed circuit board.  I had worked on sections of chips but no PCBs.  I didnt really know which tool to use, but after looking around a bit it seemed like Eagle was a good simple choice as it had wide adoption in the Maker community.  At that point in time the Elkhorn Creek Measuring System was being run off a Raspberry PI and a PSoC5LP but Cypress had just released a new family of chips called the PSoC4200.  I thought that it would be a cool idea to have a PSoC to Raspberry PI bridge board.  So this is what I did.

On the bottom of the board I wanted female pins that matched the Raspberry PI, and on the top I wanted an Arduino pins.  Bottom line, I decided to build a board that was very similar to the CY8CKIT-042 except for having Raspberry PI GPIOs on the bottom of the board.

My board has:

  • Power System: Both 3.3v and 5.0v for the PSoC as well as 5.0v@1.0A for the Raspberry PI.
  • Reset System: A RPi connection to the PSoC and Arduino XRES.
  • An I2C connection between the RPi and the PSoC including the pullup resistors
  • A 3-Color LED
  • Arduino pins that match the pinout of the CY8CKIT-042

The overall schematic

Overall CYPI Schematic

I used the same RGB 3 Color LED (CLV1A-FKB- CJ1M1F1BB7R4S3) as exists on the CY8CKIT-042.

Screen Shot 2016-01-30 at 8.29.32 PM

I wanted to be able to reset PSoC and Arduino from the Raspberry Pi so I attached the RPi GPIO 1_11 to a pulldown transistor that is connected to the XRES of the Arduino and PSoC.  I also attached a small pushbutton to enable a user reset.

Screen Shot 2016-01-30 at 8.29.19 PM

I copied the Arduino pin out of the CY8CKIT-042.  This would allow me to easily use all of the projects that I had already developed that that development kit.

Screen Shot 2016-01-30 at 8.29.03 PM

This section of the schematic has the required power supply decoupling capacitors.  It also has the ARM standard 10 Pin programming header which allows me to program the PSoC using a MiniProg-3.

Screen Shot 2016-01-30 at 8.28.46 PM

I provided pull up resistors on the PSoC P4[0] and P4[1] to easily enable the PSoC to serve as an I2C Master for the Arduino shield.

Screen Shot 2016-01-30 at 8.28.18 PM

The connection to get data between the RPi and the PSoC is I2C.  The PSoC is setup as an I2C slave and the RPi is the master.  The connection on the RPi uses the RPI1_3 and RPI1_4 GPIOs.  On the PSoC it is connected to P3[0] and P3[1].

Screen Shot 2016-01-30 at 8.28.01 PM

The power supply turned out to be by far the most difficult part of the project.  In the first version of the board I chose a regulator that was to small to supply the Raspberry PI.  When the RPi was plugged in, the regulator immediately went into thermal shutdown.  In general this sucked as the PSoC Applications Manager warned me to pick a big enough regulator.  Oh well.  In the final version of the board I used a 7805 to supply the RPi, this regulator has a giant tab which allows you to sink heat into the ground plane of the board.  On the board I also provide a 5.0V supply and a 3.3V supply for the PSoC using a 1117 regulator.

Screen Shot 2016-01-30 at 8.27.34 PM

Here is a picture of the final layout

Overall Layout

And here is a picture of the first version of the board.

IMG_1176 (1)

On thing that you might notice on this board is that the vias are exposed.  What I didnt know is that you need to tell Eagle to “tent” the vias so that they are covered with solder mask.

There is a lot going on in the layout and it is probably easiest to review the layout using eagle.  You can get the design from github at https://github.com/iotexpert/cypi

Index Description
The Creek: IOT for the Elkhorn Creek Introduction
The Creek: Solution Architecture 1.0 Overall architecture
The Creek: Creek Board 1.1 Eagle layout of the board
The Creek: Creek Board 1.0 – RCCA A discussion of the errors in the 1.0 board
The Creek: CYPI, a Raspberry Pi to Arduino Bridge PSoC4 <--> Raspberry Pi Bridge Board
The Creek: PSoC4 Creator Schematic and Firmware Firmware to interface with the temperature and pressure sensors
The Creek: Testing the Firmware Using tools to verify that the PSoC 4 Firmware is working correctly
The Creek: Testing the Bootloader Make sure that you can load new firmware into the PSoC
The Creek: Software Architecture All of the Raspberry Pi software connections
The Creek: Install MySql Instruction to configure MySql
The Creek: Install Tomcat Instruction to configure Tomcat JSP Server
The Creek: Data Collection Java (Part 1) The Java program that reads the I2C and saves it in the database
The Creek: Data Collection Java (Part 2) The Java program that reads the I2C and saves it in the database
The Creek: Create the Chart with JFreeChart Using open source Java charting software to create plots of the Creek Depth
The Creek: Flood Event Data Processor A batch program to create analyze the database and create a table of flood events
The Creek: Flood Event Web Page A batch program to create the flood event web page
The Creek: Creek Server 1.1 Updates to all of the back off server programs to integrate charts
The Creek: JSP Web Page for www.elkhorn-creek.org The JSP program to make the table and display the website
The Creek: Raspberry Pi Clock Stretching Sorting out a bug in the system having to do with the Broadcomm Raspberry Pi Master not functioning well with clock stretching
The Creek: Creek Server 1.2 Caching the web pages to make them faster

The Creek: Creek Board 1.0 – RCCA

At my company Cypress, “RCCA” is an abbreviation for “Root Cause Corrective Action”.  It is a formal process for changing the way that you work to prevent an error from happening again.

Unfortunately the title of this post is “Creek Board 1.0 – RCCA”.  What that means is that the first time I sent the Creek Board to be manufactured I made an error, in fact a really stupid error.  Specifically,  the error that I made was a fundamental failure of not having an LVS (Layout versus Schematic) clean design.  If you google “blue wire pcb” the first search result you will find is “Printed Circuit Board Repair and Rework Guides”,  I had no idea why blue wires were used to fix printed circuit boards so I called my friend Dave Van Ness.  He is an old grey beard type of guy.  He told me that the blue wire was traditionally an “official fix” to a circuit board.  It was used because other colors were already assigned (Red to power, Black to ground) etc.  I guess that I thumbed my nose at tradition by fixing my PCB with a red wire.

IMG_2024

After laying out a printed circuit board, the last step is to surround the board with a ground plane on the top and bottom of the board.  Then you press the “ratsnest” button on Eagle.  Then Eagle does a “pour” which fills in the empty space of the board with a ground plane.  It then will update the bottom of the screen with the message “Ratsnet: Nothing to do!” which means all of the schematic and layout connections are complete.  Or, if there are connections that still need to be made, it will update the layout with yellow “air wires” and it will give you a message like “Ratsnest: 1 airwires.”  If you send the board to be made with an airwire, that is exactly what you will get.  I will tell you that air doesn’t conduct electricity very well and you will end up needing your soldering iron.

In this case I missed seeing the tiny little airwire.  See if you can see it:creek1.0board

It is hard to see, eh?  In the next picture I turned off the ground layer and zoomed in so you can see that I am missing a power connection between the top and the bottom of the board.  I highlighted this issue by clicking on the “Show Objects” at the top of the toolbar, then clicking on yellow wire.  When I do that, Eagle tells me what the net is that is unconnected and it highlights every object that is attached to that net.

zoom-of-error

So now what?

What I ended up doing is the normal Cypress thing.  I created a “tapeout checklist”.  The checklist contains a list of all of the things that I double check before I send a PCB to be manufactured.  Here is my current (and short) checklist:

  • No remaining airwires
  • Vias tented (or not)
  • Silkscreen on all connections
  • Test points on key nets
  • No DRC errors

Index Description
The Creek: IOT for the Elkhorn Creek Introduction
The Creek: Solution Architecture 1.0 Overall architecture
The Creek: Creek Board 1.1 Eagle layout of the board
The Creek: Creek Board 1.0 – RCCA A discussion of the errors in the 1.0 board
The Creek: CYPI, a Raspberry Pi to Arduino Bridge PSoC4 <--> Raspberry Pi Bridge Board
The Creek: PSoC4 Creator Schematic and Firmware Firmware to interface with the temperature and pressure sensors
The Creek: Testing the Firmware Using tools to verify that the PSoC 4 Firmware is working correctly
The Creek: Testing the Bootloader Make sure that you can load new firmware into the PSoC
The Creek: Software Architecture All of the Raspberry Pi software connections
The Creek: Install MySql Instruction to configure MySql
The Creek: Install Tomcat Instruction to configure Tomcat JSP Server
The Creek: Data Collection Java (Part 1) The Java program that reads the I2C and saves it in the database
The Creek: Data Collection Java (Part 2) The Java program that reads the I2C and saves it in the database
The Creek: Create the Chart with JFreeChart Using open source Java charting software to create plots of the Creek Depth
The Creek: Flood Event Data Processor A batch program to create analyze the database and create a table of flood events
The Creek: Flood Event Web Page A batch program to create the flood event web page
The Creek: Creek Server 1.1 Updates to all of the back off server programs to integrate charts
The Creek: JSP Web Page for www.elkhorn-creek.org The JSP program to make the table and display the website
The Creek: Raspberry Pi Clock Stretching Sorting out a bug in the system having to do with the Broadcomm Raspberry Pi Master not functioning well with clock stretching
The Creek: Creek Server 1.2 Caching the web pages to make them faster

The Creek: Creek Board 1.1

In the previous post I described the entire system architecture.  In this post, I am going to describe the Arduino shield that I unfortunately call “Elkhorn Creek Water Level 1.1”.  It is unfortunate because in version 1.0 I made a really stupid error which ruined the first run of printed circuit boards.  You can read more about how I made the error and what I am doing in the future in the post Creek Board 1.0 RCCA.

To make this system work I need to be able to interface the PSoC4200 with two sensors:

Both of these sensors are subject to environmental noise so they both have capacitive or RC filters connected to them.  I originally built a prototype of this board using a proto board.  However, it was a PITA because the wires would come loose and the system would stop working.

IMG_2655

So I decided to make a real PCB.  To do the design, I used the Eagle 7.2 PCB editor as it seemed like it had the most support from the maker community.  The schematic for the system is fairly simple.  It has

  • Pressure Sensor
    • X1: A Molex Microfit 3.0 Connector to attach the two wires from the pressure sensor
    • R1: A 51.1 Ohm resistor to group to convert the 4-20mA –>  0.204mV to 1.022V
    • C1/R2: A low pass filter
    • TVS1: A ESD diode to clamp any ESD event to ground to prevent it from blowing up the PSoC4A or the Sensor
  • Temperature Sensor
    • TMP36: A sensor that turns temperature into a voltage.  The equation for temperature is T=0.5V+10mV/degreeC.  For 25 degrees C the Voltage = 750mV
    • C2 + C3: Two decoupling capacitors to filter power supply noise
  • Arduino Interface
    • A standard Arduino interface set of pins + the additional Cypress CY8CKIT-042 pins.  I only used the A0 and A1 pins for signals and the Vin pin (which is 12v) to drive the current loop
  • Measurement Test Points
    • Keystone 5000 test points.  These test points are a little loop of wire that sticks up from the surface of the PCB to make  it easy to probe a voltage with your DMM.  5000_sml

Here is the final Eagle Schematic for the board.

CreekBoardSchematic

And the layout:CreekBoard2.0Layout

Once I completed the layout I sent the board to OSH Park to be manufactured.  I have shared the project on their website.  OSH Park is an excellent company that is easy to do business with.  They charged me $22.55 for three of the boards.  The fit and finish of the boards is very nice.  Here is the board:

creekboard1.1

Here is the assembled board:

 

IMG_2652

I have posted all of the project files at github.  You can “git” them from https://github.com/iotexpert/TheCreek  The Eagle project is in the CreekBoard directory.

Index Description
The Creek: IOT for the Elkhorn Creek Introduction
The Creek: Solution Architecture 1.0 Overall architecture
The Creek: Creek Board 1.1 Eagle layout of the board
The Creek: Creek Board 1.0 – RCCA A discussion of the errors in the 1.0 board
The Creek: CYPI, a Raspberry Pi to Arduino Bridge PSoC4 <--> Raspberry Pi Bridge Board
The Creek: PSoC4 Creator Schematic and Firmware Firmware to interface with the temperature and pressure sensors
The Creek: Testing the Firmware Using tools to verify that the PSoC 4 Firmware is working correctly
The Creek: Testing the Bootloader Make sure that you can load new firmware into the PSoC
The Creek: Software Architecture All of the Raspberry Pi software connections
The Creek: Install MySql Instruction to configure MySql
The Creek: Install Tomcat Instruction to configure Tomcat JSP Server
The Creek: Data Collection Java (Part 1) The Java program that reads the I2C and saves it in the database
The Creek: Data Collection Java (Part 2) The Java program that reads the I2C and saves it in the database
The Creek: Create the Chart with JFreeChart Using open source Java charting software to create plots of the Creek Depth
The Creek: Flood Event Data Processor A batch program to create analyze the database and create a table of flood events
The Creek: Flood Event Web Page A batch program to create the flood event web page
The Creek: Creek Server 1.1 Updates to all of the back off server programs to integrate charts
The Creek: JSP Web Page for www.elkhorn-creek.org The JSP program to make the table and display the website
The Creek: Raspberry Pi Clock Stretching Sorting out a bug in the system having to do with the Broadcomm Raspberry Pi Master not functioning well with clock stretching
The Creek: Creek Server 1.2 Caching the web pages to make them faster