PSoc Challenge

Take a tour of the Cypress PSoC 4 BLE kit.

Take a tour of the Cypress PSoC 4 BLE kit. The CySmart USB dongle (left), the PRoC BLE module (middle), and the BLE Pioneer Baseboard with PSoC 4 BLE Module onboard (right)

Right now there’s a huge range of microcontroller boards on the market, and more are released every week. But most of these new boards will disappear — almost without a trace — within a few months.

Cypress_125x125_bur1The ones that do hang around in the maker community tend to be those that have communities form around them. Right now, the two largest communities belong to the Arduino and Raspberry Pi. While other boards are doing interesting things and have sizeable presences in some markets, those are the two names that tend to dominate the conversation around microcontrollers and single board computers.

However beyond the maker and pro-maker communities there’s a whole other world — the people that build the products we use every day, from toothbrushes to cars. In that world, community isn’t necessarily as important as it is in ours.

However it’s a world that is starting to wake up to makers and pro-makers — Kickstarter and the Internet of Things have seen to that — and now that they’re taking notice of us they’re starting to build things for us. I think the community will soon follow, because what they’re offering sometimes lets us build things we couldn’t otherwise build.

You probably won’t immediately recognize the name Cypress, because for the most part they belong to that other world. But with the release of their PSoC 4 BLE kit, they’re doing something intriguing.

Built for Makers?

If you’ve been using a combination of different boards in your project — perhaps an Arduino, or one of the many Arduino-compatible boards, in combination with a Raspberry Pi alongside a Bluetooth LE (BLE) board or USB dongle — then the PSoC 4 BLE should be of interest to you.

If you’re a maker, one of the first things you’ll notice when you pull the boards that come with the kit out of their packaging is that the baseboard comes with Arduino-compatible headers. While it’s not going to be software compatible with your Arduino shields, you do have hardware compatibility, which means that a lot of your existing prototyping hardware can get reused with the new board.

Shield and PSoC Pioneer

A MakerShield connected to the PSoC 4 Pioneer Kit, demonstrating Arduino shield pin compatibility.

However, the real advantage of the PSoC 4 BLE module is when it comes off the baseboard — when you start putting together your own PCBs to carry the module, or go further and take the PSoC chip off its board entirely. That’s because the PSoC is probably the only chip around that has the MCU, a BLE radio, 4 OpAmps, 2 comparators, an IDAC, a SAR ADC capable of 12 MSpS, and programmable digital logic all integrated into a single piece of silicon.

Maker to Maker Pro

While there are now a lot of other boards with on-board BLE — the Light Blue Bean for instance — the PSoC 4 BLE is the only one with everything on a single chip. Remove the chip from the board and it still has the BLE radio, the op amps, and all the rest in it. So after you’ve used the Pioneer Kit to prototype your product — if you’ve been thinking about running an Internet of Things project on Kickstarter perhaps — then you can go ahead and build your product using the same software and hardware as you were using in your prototype.

In fact, if you want to skip all the hairy certification around BLE radios — something that has sunk many a Kickstarter — and if you’re happy to integrate the PSoC 4 BLE board directly into your project then Cypress is offering these units as pre-certified by the FCC for under $10.

Bluetooth LE Paints the IoT a Shade of Blue

One of the drivers behind the recent explosive growth in the Internet of Things has been the BLE standard. What made it so interesting was the ubiquity of smart phones — both Apple and otherwise — with support for the standard, which meant that thing-makers no longer have to worry about a display or a user interface. And that means that things, like smart lightbulbs, can look a lot more like lightbulbs, rather than a computer that happens to have a light attached to it.

However, working with Bluetooth LE is a lot different than working with other radios, and a lot of people are approaching using the standard in the wrong way. To my mind, one of the advantages of using a board like the PSoC is that you get to approach things the right way, which means that if you’re building a product rather than a project, it’s going to be a lot easier to build the UI — in this case, the smart phone application — around it.

Getting Started with the PSoC 4 BLE board

While Cypress has a lot of resources around the PSoC to let you get started, it can still be pretty daunting, especially since the community around the board — which I think is so necessary to makers — is only really starting to form.

However, Cypress is currently publishing 100 Projects in 100 Days for the PSoC 4 BLE board, and this is an amazing resource. They really seem to be working hard to bring together their scattered documentation and publish something that’s going to be a solid foundation that will let you get to grips with the board, build a project or product, and then learn how to debug it when it doesn’t work quite right. You can track and fork the code for individual projects from this PSoC 4 BLE tree on Github.

Thus far, we’ve talked about how the Bluetooth LE standard is put together elsewhere, and how the software that ships with the Pioneer Kit lets you access pretty much everything you’ll need to put together custom services and profiles.

While the software is Windows-only, PSoC Creator runs just fine inside a VMWare instance on OS X, and it might also be possible to package it up in the same way I did for Nordic’s nRFGo Studio using Wine, and get it working that way.

Mind the GAP and GATT and Move On

The CySmart app, available for Android and iOS users.

Two screenshots of the CySmart “BLE test & debug” app, available for Android and iOS users.

In the Bluetooth LE standard, GAP is short for Generic Access Profile. This is the layer that makes your project visible to the rest of the world and determines how it interacts with it. Essentially, this decides whether your project is acting as a Central or Peripheral device, or less frequently, a Broadcaster or Observer.

Most of the time you’ll want to create a Peripheral device. These are exactly what they say on the label — generally small, low powered, resource constrained devices that connect to more powerful devices (like smart phones and tablets). If you’re building a smart light bulb, or a smart lock, it is a peripheral.

Most of the time you’ll probably be putting together Peripheral devices — which advertise their capabilities and are connected to a Central device. But there are some cases, like iBeacons, where you really only need to advertise. This is where Broadcast mode comes in, although it’s possible to go beyond simple static advertising and create dynamic broadcasters which change the content they’re advertising over time.

Alternatively you can configure the board to act in the Central role. Normally Central devices are things like smart phones or tablets — or even laptops — but you can make the PSoC act in this role fairly easily. Doing so means that it’s easier to build things like a distributed sensor network, with a number of scattered sensor boards acting as Peripherals, along with another board which acts in the Central role to gather. And you can, of course, switch between modes.

As well as the GAP, there is the GATT. This is short for Generic Attribute Profile, and is the layer in the Bluetooth LE standard that defines things called Characteristics and Services. These are are collected together into what are called Profiles, and its these profiles that are advertised by Peripheral devices. Essentially, the GAP determines what type of device your thing is, while the GATT determines what it does.

There are a number of GAT Profiles provided by the standard. Beyond the standard adopted profiles — like the ubiquitous heart rate monitor or thermometer, which seems to be used as the starter project by so many manufacturers, is the realm where you have to create custom profiles, like proximity sensing. This is where BLE can get really interesting, and powerful.

Getting to the Lower Layer

A diagram of StackEventHandler()

A diagram of StackEventHandler()

Below the GAP and the GATT are the lower layers of the BLE stack, such as the Link Layer, L2CAP, and Security. Normally, these are pretty difficult to work with, but Cypress has managed to expose things like Whitelist, Bonding and Authentication on the PSoC pretty well. It’s these things that will let you implement things like real security more or less out-of-the-box, which is a real win for the PSoC.

In Closing

We’ve given away a number of Cypress PSoC 4 BLE kits. However, if you’re interested in taking part in the PSoC Challenge — and potentially winning $2,500 to travel to Maker Faire Bay Area in May — then you can still pick up a discounted kit at Arrow Electronics for $49. The deadline for submissions has been extended to April 6th.

Enter the PSoC Pioneer Challenge and you could win $2,500 for travel to Maker Faire Bay Area in May. Projects should include the PSoC 4 BLE kit from Cypress Semiconductor. This new development board includes Bluetooth and CapSense, along with a software IDE that makes building for the IoT both challenging and fun .