Quicksilver ECG demo
(Project Manager: Bradley Evans; Applications Engineering Interns: Ryan Brooks, Emily Dalton, Fiona Doyle, Gillian Fahey, Amdon Giday, Erik Holmgren, Michael Maxwell, Priscilla Vazquez, and Thomas Wilkinson)
The purpose of this project is to demonstrate the capabilities of Cypress’s two featured products, the Quicksilver IoT development board and the PSoC 5LP. This project utilizes the PSoC to simulate the ECG waveforms similar to what an ECG device would output from a patient. We treat the ECG like a black box and simply collect the data streaming from it. The Quicksilver is used for data formatting and wireless communication between the client devices and the access point. This high rate of data flow exemplifies Quicksilver's ability to transmit data reliably. Additionally, we can potentially connect the Quicksilver as a gateway to an analytics application, such as IBM Watson, to detect abnormalities in heart rates. Analytics are the logical next step. All code, 3D models, and guides are attached to this post.
What is an ECG?
Electrocardiography (ECG or EKG) is the process of recording the electrical activity of the heart over a period of time using electrodes placed on the skin. These electrodes detect the tiny electrical changes on the skin that arise from the heart muscle's electrophysiologic pattern of depolarizing and repolarizing during each heartbeat. It is very commonly performed to detect any cardiac problems. (Wikipedia)
The heart rates that we chose to simulate are:
ECG Dashboard with 6 Quicksilver nodes attached
How to Set This Up
What You'll Need
> 2+ Quicksilvers (1 for an access point plus however many clients you want to make)
> 1+ PSoC 5Lp (1 for every device you make)
> 3.7v battery
> 3.7v -> 5v power booster
> 3D printing material
> 5 buttons for every device you make
> Super glue
1) Download all necessary files (I.e. code for Quicksilver access point, client, PSoC code for ECG)
2) Flash Access Point Quicksilver with appropriate software
3) Flash all client Quicksilvers with appropriate software
4) Flash PSoC with ECG simulator files
5) Ensure PSoC is connected to client Quicksilver according to Schematic 1
6) Ensure 5V regulator and battery are connected to Quicksilver according to Schematic 2
7) Connect to the ECG access point (SSID: EKGServer, PASS: ArrowEkg)
8) Navigate to the dashboard at http://192.168.0.1
9) Flip on however many ECG simulators you want to use using the client Quicksilvers and attached PSoCs. (NOTE: ECG simulator will not start until you push a button)
1) Download all 3D printing files and Laser cutting files
2) Print out all components
3) Cut acrylic to fit lid door
i) Laser cutter works best but acrylic can be cut with a dremel
4) Fit acrylic cover into lid, secure with glue along the edges
5) Attach hinges to lid
6) Fit magnets into the slots on the lid edge and the main case and secure
i) Make sure the magnets go into BOTH sides in the correct orientation or the lid will not close
7) Fit button bases into the 3D printed shelf, solder the wires appropriately
8) Fit 3D printed buttons on the button bases, secure with glue in the indentation
i) Make sure buttons are in the right order, matching the design to the waveform the button will trigger
9) After wiring, slide the PSoC into the runners in the handle of the base, make sure the button shelf remains on top of the upper runners
10) Run power and data wires through the hole between the handle and main chamber of the case
11) With the buttons in place attach the button lid and secure it with glue
12) Attach bottom door over the PSoC and secure with glue
i) After programming the PSoC the bottom piece with the USB attachment can be broken off at the perforations to fit in the case
13) Wire Quicksilver to power booster according to the diagram
14) Wire switch to power booster according to the diagram
15) Insert switch into the hold on the right side of the case, power booster should fit into the slot at the top of the case
16) Plug battery into power booster and insert it into the depression in the center of the case
17) Quicksilver will fit into the center chamber above the battery, line up the mounting holes with the screw holes in the case
18) Bring up and attach the wires from the handle according to the wiring diagram
i) These wires are from the PSoC that were routed through the hole between the handle and main chamber in step 9
19) Screw the Quicksilver board down into the case
20) Attach the lid by gluing the other side of the hinges to the main case
i) Small nails can be used here to help secure the hinges
Schematic 1: Wiring Schematic for PSoC and Quicksilver Connection
Schematic 2: Wiring Schematic for Battery, 5V Regulator, and Quicksilver
Currently, we're only demonstrating the data stream from an IoT node to webserver; so there are no analytics. In the future, we can connect our data stream to a cloud computing platform for insight about the heart rates. Here we describe how to connect our data stream to Arrow Connect and IBM Cloud.
Here's What You'll Need To Do
1) Set up an account with Arrow Connect
3) Connect Arrow Connect to the IBM Watson IoT Platform. Detailed instructions on how to do this can be found on the Arrowconnect.io Developer Hub or here.
i) Create an IoT Watson Platform
ii) Generate a Watson IoT Application Key & Authentication Token
iii) Connect Arrow Connect to IBM
4) Provision devices in Arrow Connect, and they should populate in IBM automatically. For each device:
i) Create an Asset Type (the same one will be used by all our Quicksilver devices)
ii) Create a Gateway (one for each Quicksilver)
iii) Create a Device (one for each Quicksilver)
iv) Find HID, API Keys, and Certificates:
- Click on the Assets tab, then select Devices.
- Select the device you have created.
- Select Developer in the menu on the left.
- Under the Ingestion tab, find the HID of the Device and copy it.
b) API Keys:
- Click on the Access Keys tab next to the Ingestion tab.
- Click on the the Raw API Key to expand it, and copy it.
- Click on the button labeled Secure next to the url at the top of the browser.
- Click on Site Settings at the bottom of the box.
- Click on the back arrow twice, until you are in the Content Settings.
- Select Manage Certificates.
- Select Settings in the drop down box, then scroll down to the bottom of the page and select Advanced.
- Select the Intermediate Certification Authorities tab.
- Find and click on DigiCert SHA2 Secu...
- Click on View.
- Select the Details tab.
- Click on copy to File.
- Click on Next.
- Select Base-64 encoded X.509 (.CER)
- Click on Next.
- Name the file, and save it where you want.
5) Download the code (included in a .ZIP file at the bottom) and modify using the HID, API keys, and Certificate.
ECG Software Setup
- Assembled EKG Nodes (as many as required)
- Additional or Windows/Linux computer to act as the server
- WIFI Router optional
- Computer with WICED Studio and WICED code
- Configure compile time options for code. These include UDP (recommended) or TCP, UDP Multicast (Used if Server IP address will not be known in advance), and Debugging options (DEBUG_PRINT, Packet Return)
- Compile and flash EKG nodes
- Configure the software to mirror the network settings of the clients.
- Compile and flash the server firmware.
- Linux Server:
- Configure network settings depending on your distribution and the functionality you need.
- If you intend to use the Linux machine as the hot spot, you will need to configure and (https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md). Ensure that the created network is NAT type, and that the Linux machine is given the IP address 192.168.0.1
- If you intend to use an existing network, ensure that UDP_MULTICAST is enabled on the firmware, then simply connect the server and clients to this network ( firmware by default connects to SSID: , password: ).
- The Linux code is written in python3. Install the python3-tornado package (package may be named differently depending on distribution) using either pip3 or your distribution’s package manager.
- You can configure the python code to start at boot using (https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6).
- Windows Server:
- Install Linux, then follow Linux server steps.
- Connect the display device (laptop, powerful tablet) to the network or whichever WIFI network you are using.
- Navigate to http://188.8.131.52 or the address of the server device if you are using UDP_MULTICAST.
- Power on the nodes with the toggle switch on the side.
- Nodes may take 10-20 seconds to connect to the router. In theory a status LED on the should turn green once the network connection is made, but this feature still needs a little debugging.
- As soon as the node is powered on, one of the heartbeat buttons may be pressed. Once the node has finished connecting to the server, the dashboard on the display device will begin to draw the graph of that heartbeat.
- Impress your customers