📜 ⬆️ ⬇️

Everything gets better when there is Bluetooth


I have long wanted to write about Bluetooth LE (4.0-4.1) kit ( CY8CKIT-042-BLE ) from Cypress Semiconductor.
In fact, the plans were to write in more detail another whale, a superficial review of which I published earlier. But he did not collect his thoughts, and then something more interesting appeared.

I will not describe the ordering and delivery process, firstly, it is in the old article, secondly, there were no surprises.
So, I will try to briefly describe the kit itself and examples of its use.

Hardware


I could not get an sensible photo; I’ll confine myself to a picture from a press release:

Contents of delivery:

That is, two modules are included with similar but still different chips.
It is worth noting that a dongle can only be used with Cypress software, OS tools cannot do it with it, well, except to use the UART in some way.
Each of the modules can be used either independently or used together with the motherboard, which is also a programmer.

CY8CKIT-142 PSoC 4 BLE

This module is interesting because there are more analog and digital peripherals (excerpts from the press release):

I was more interested in the following module:
')
CY5671 PRoC BLE

For me, he was interested in the fact that with him it was possible to use the library for recognizing gestures on the panel of capacitive touchpad, which, by the way, is not included:

The cost of a whale is $ 49 plus shipping.

Application Development


As I already wrote, Cypress Semiconductor provides a free IDE - PSoC Creator. Separately, I would like to dwell on the part that helps to get what is needed from BLE, in other words, configure the BLE Stack + Application layer. Now I do not want to delve into what Bluetooth Low Energy is (aka BLE). There is a lot of information about it, including on the habr.

PSoC Creator

The current version at the moment - 3.2 is available for download at the office. website: www.cypress.com/psoccreator after registration. The development environment has not undergone significant changes since the writing of the last article , so I don’t see any point in deepening, just to remind you that the entire development is based on the concept of components - libraries that implement this or that functionality.

BLE stack (component BLE)

Here I would like to elaborate in more detail on the description not of the BLE component itself, but rather on the examples that are available in PSoC Creator:

Each of these examples is a simple project that shows the implementation of a particular profile. For this article, I planned to use BLE_HID_Mouse, but for a number of reasons, the main one being that I do not have a touchpad that I could use to do without simulation (in the example, the cursor simply “draws” a square) I decided to use the example BLE_HID_Keyboard. Looking ahead, I will say that there is also a "simulation" of the keyboard, but so much more clearly.

So, let's open the example BLE_HID_Keyboard:



The project itself contains a DAC (battery level measurement), a COM port for debugging, LED indicators (a 3-color LED on the whale board), and a watchdog in the normal timer mode.

Open the configuration of the BLE components:



Profile Configuration Tab:



In addition to the keyboard profile, there are also services BAS (Battery Service), DIS (Device Information Service), SCPS (Scan Parameter Service). In principle, if you wish, you can add any service, both standard and your own:



After that, all characteristics and service descriptors will be entered into the GATT database, moreover, if the service is standard, APIs will be generated for it.

Each of the services can be configured, for example, a DIS service, a field with the name of the manufacturer:



Or device name:



Let's try to program the whale and enable the BLE 4.0-compatible adapter to start searching for new devices:



The same with the phone:



Well, if you connect to the device from the "keyboard" data will begin to come:











Why am i



Well, first of all, how simple and easy it is to plunge into the world of BLE. There were articles and described solutions from Nordic, TI, but there was no mention of Cypress Semiconductor, so I decided to fix it. I was also interested in the fact that it is relatively simple, you can make yourself a device that will not only have a wireless connection, but will also be supported by modern OS “out of the box” and without extra crutches.

Secondly, I would like to try to make a remote control for the PC on my own. Actually for this, I ordered a whale and began to deal with it. On what was determined with the whale, but the question about the touchpad is open. As a viriant, order another whale from Cypress with such a shield. Well, or try to dissolve yourself, but this is not the fact that there is enough enthusiasm and knowledge. Who knows any other options, write in the comments. Need a shield for capacitive touchpad at least 5x5.
Another interesting whale that would probably fit my goals more:
CY5672 PRoC BLE Remote Control Reference Design Kit (RDK)
But in my opinion it is much more interesting to do it myself, especially when there is an opportunity to do everything slowly, in pleasure.

Source: https://habr.com/ru/post/261287/


All Articles