Part 2:
Introduction
This is part 2 of my 2-part blog, showcasing my Honeywell pressure sensing application using a PSoC 6 BLE Pioneer kit.
Part 1, which introduces the Honeywell SEK002 sensor shield and the sensors used, can be found by clicking here.
The origins of this project started with a post made by Randall Scansy, back in September 2018, for requesting someone to:
"Interface the pressure sensors of the Honeywell Sensor Shield with the PSoC 6 analog/digital peripherals and then transmit data via BLE or showcasing it on the E-ink display of the PSoC 6 BLE Kit. The project should have some kind of medical application. For example, measuring pressure in some kind of health/medical application."
As a reply to Randall's request I proposed to attempt the following:
"As such, I felt that creating an infusion device would be an achievable means to demonstrate the application of a pressure sensor in the medical sector. I can readily create my own manual test apparatus to demonstrate this syringe infusion technique, as all it requires is a large syringe with a small pressure sensor inserted in the base of the syringe. I can then measure the diameter of the outlet nozzle which then allows me to gauge force while ignoring any likely fluid compression for now. I then thought that if I add in capacitance measurement, which I can do with a PSoC 6 device, together with the pressure sensor, I should then be able to gauge the liquid flow rate as well as determine the dynamic viscosity of the liquid. I believe that in quite a few medical scenarios, fluid or liquid viscosity is an important parameter and any automated equipment would need to stop should viscosity fall outside a defined tolerance, for example. A further, nice to have, would also be a suitable Honeywell temperature and humidity sensor, as theoretically temperature needs to be measured when taking viscosity measurements. "
In part 1, I set out my PSoC 6 project application workflow, which set out 7 key steps to completing the PSoC 6 firmware that would read humidity, temperature and pressure sensor data and display this data periodically on the eInk display shield as well as provide a BLE bridge to allow this data to be transferred to another device. Here is that workflow again:
What is not covered in my project application write-up is the capacitive sensing part.
{gallery:autoplay=false} My Liquid Level Prototypes |
---|
This proved more of a "design challenge" for me, as I have never designed a liquid level sensing application before.
As I did not have the correct material to create the right capacitive sensing "pads" using copper strips or foil (or conductive ink), I tried single core copper wire instead, but my initial test apparatus failed to show anything of value. So, I decided to park this part of the project for another day.
One thing that did work was my aluminium foil shielding, which is under the duct tape (see picture). When I held the syringe no change in capacitive readings were detected - I used the PSoC Creator Capsense Tuning Tool for this test.
Needless to say, the rest of the project is complete and hence this blog post. So let's start with a video demonstration and then I will complete with a project walk through.
Video Demo
Apologies for quality of the audio. This is a bootstrap setup using a Amazon Fire tablet (microphone is not great at all).
PSoC 6 Project Overview
Thanks to Cypress Semiconductor there is a great range of PSoC 6 examples to work with.
I have incorporated different code snippets within my project, such as the BLE callback function, watchdog timer routine, eInk display (EPD display shield), temperature measurement from the EPD display shield thermistor, CapSense button detection and various other user interface routines such as LED control and SW2 wakeup.
{gallery:autoplay=false} PSoC Creator Top Level Design View |
---|
Top Level PSoC 6 Design.
Let's start with the Bluetooth 5.0 component.
Here we have it set up as a peripheral device. It is using both of the PSoC 6 cores. CM0+ handles the BLE interrupt timer and CM4 handles the logic for the defined profiles and exchange of information.
The BLE component acts as a GATT server and we have defined an Automation IO service (0x1815), which exposes an Analog characteristic (UUID: 2A58). For this characteristic I chose to use the NOTIFY property only. The Automation IO service also uses the Characteristic Descriptors to define what the Analog value means. This is very useful for information exchange between the central device and the peripheral device.
{gallery} Automation IO Characteristic Descriptors |
---|
For the purposes of my application, I defined my units as "unitless" (to make it simpler for my smartphone app - I transmit the raw 16bit value), but I could easily have defined the correct units and then transmitted the actual pressure value (note that for float variables this requires a specific conversion technique).
Moving onto the UART component.
Here I followed this Cypress Semiconductor tutorial: https://www.youtube.com/watch?v=ZJOF2f423nI
This tutorial provides guidance on how to use "printf" by enabling the "Retarget I/O" option in Build settings and then amending the shared "stdio_user.h" file to define the UART port.
For the I2C Sensor Bus, we include a I2C Master component.
Not much needs amending here. In my case I used the 100kHz as my data rate (I could have used 400kHz).
Other Code modules
These are all direct copies off PSoC 6 examples found via PSoC Creator, so does not warrant additional comment as all examples I have used are very well documented.
Smartphone BLE App
For the Bluetooth Low Energy bridge, I created a smartphone app, using MIT AppInventor as I was able to use an old project of mine, which is listed on Hackster.io.
Attachments
I have attached my PSoC 6 Code and I have uploaded my the MIT Appinventor project onto Github (as the Element14 website will not accept as an attachment) for those who want to look at and/or use.
Top Comments