This is an instruction on how to use uECG kits that we sell, but it’s also useful if you want to make your own uECG. Or maybe you were just browsing Hackaday and accidentally found our projects. In any case, thank you for being interested in uECG!
For clarity, we also made this video to show everything described in the instruction:
We tried to make the package as simple and environmentally friendly as possible! It doesn’t contain plastic packaging, but is still antistatic and protects well.
The devices (uECG, base and programmer) are stored in separate cardboard cutouts; the electrodes, wires and pins are in the smaller box.
The most popular (Developer’s) uECG kit includes the following:
- uECG device;
- 3D-printed case;
- 10 single-use electrodes;
- base station for connecting to laptop/PC (a simple nRF52832 USB board designed by us);
- USB programmer for firmware upload (ST-Link v2, we use a tested Chinese clone);
- pogo pin adapter (4 pogo pins/2.54 spacing).
- To turn uECG on, use the slider on the side of the device;
- After switching it, you should see a series of blinks on the left side - first red, green, blue; then three green flashes; then pink. The pink LED means the device is on and ready to use;
- The pink LED should periodically flash when device receives signal - i.e. in contact with the skin.
- Attach round gel electrodes to the snap connectors on the bottom of uECG;
- Peel off the protective layer from them and stick them to the chest as shown in picture below;
- Gently press the device onto the skin once to ensure it sticks;
- After use, peel off the device and detach the electrodes (they are single-use);
- It’s good to minimize the amount of hair and wipe the skin with alcohol for better signal. It will also be easier to remove, too :)
Please turn off uECG after use! The sleep mode may be glitchy, so the battery may discharge too much.
4Using the app
The app is only for Android currently. Not all Android phones may be supported: please feel free to complain loudly in the comments on Hackaday and we’ll try to fix it! :)
This is steps for Android 7+:
1. Download the free uECG monitor app from Google Play (or enter “uECG” in the search).
2. Go to the settings of the installed application and allow location access (required for Bluetooth) and saving files.
3. Turn on the bluetooth.
4. Turn on the device.
5. Launch the app and bring the phone close to the device. Wait up to 30 seconds. The data should appear, and within a minute signal should become stable.
6. If you don't see any signal within 1 minute, then:
a) click on the cross (in the upper left corner) to exit the app, then remove it from the history of open tabs - both steps are necessary.
b) turn off bluetooth for ~5 seconds, then turn it on again
c) then start the app.
7. To switch between the tabs, click on the upper right button "HRV":
- the default tab displays RR variation, ECG, detected BPM, SDNN, and steps.
- the second tab shows Poincare plot: length of previous beat vs length of the next beat. If the pulse is perfectly stable, all points are on the central line. This chart is important for spotting certain types of arrhythmia, and also gives some insight about stress level.
- on the third tab there are 5 charts which can be turned on and off by activating the boxes with their names - steps, etc. HRV parameter indicates average deviation in length of consequent beats. GSR indicates skin resistance (auto-scaled to fit current range).
- the third tab has buttons for displaying data in different time scales - by clicking on the desired interval accordingly - 1 minute, 5 minutes, etc.
8. For Android up to 9th version, files are saved in "phone storage / documents / uECG"
9. For Android version 10, files are saved in "phone storage / android / data / com.ultimaterobotics.uecgmonitor4_2 / files / documents / uECG"
Android 6 and less has something in BLE we can't figure out, so you will need additional app to get it running: BLE scanner app should be active in the background in order to get data into uECG monitor. It properly configures some parts of BLE scanner which our app doesn't :)
1. Find BLE scanner in google play and install it (it has some non-free functions which we don't need, so a basic version is enough).
2. Run BLE scanner. It should be able to see uECG non-connectable device when it's on.
When BLE scanner is running, everything else is the same as for Android 7+.
And all of that you can see in our video!
- To turn uECG off, use the slider on the side of the device;
- Make sure to always turn the device off after use to conserve battery.
- uECG uses a micro USB port for charging. You can charge it from a usual phone 5V USB adapter (or laptop/PC USB port). Insert the micro USB cable into the port and the device will begin charging;
- Remove the cable to stop charging;
- The device does not have to be turned on to charge.
We hope you will enjoy using uECG! Please write us if something doesn’t work - if everything works, write too :)
7Firmware update part 1 (connecting hardware)
Once in a while, we'll update firmware for the device. You can upload it using a USB programmer and a pogo pin adapter. Software part of this guide is in part 2 (step 8).
1. Connect the 4 colored wires to the programmer. The wires come in random colors; to remember which is what, we usually choose the most neutral/dark color for GND, most warm/closest to red for 3.3V, lightest/closest to white for SWCLK and what’s left is usually ok for SWIO.
Please connect all wires on the same ("lower" if you look at it the standard way) row of the st-link programmer. We have reports that even though GND, 3.3V lines are present in both rows, they actually might not work.
2. Then connect the wires to the pogo pin adapter.
3. Press the pogo pins into the pogo pads (holes in the plastic case next to electrode connectors).
4. Hold the pins in place during firmware upload. Remove the pins after upload is completed.
8Firmware update part 2 (uploading pre-built fimware)
This instruction covers upload process on Linux (tested with Ubuntu 18.04 but should work with other distributions too), and on Windows (tested on Win7 but also should work on other versions).
You can upload pre-compiled .hex files which are available on our github, or build firmware from sources (instruction for this process is provided at step 9).
The latest firmware is located here: https://github.com/ultimaterobotics/uECG/tree/master/uECG_firmware/build , version 422.
Important note: if your st-link connection is breaking before you can finish the process (which easily can be the case if you are holding wires with one hand and try to type commands with the other), you can copy all required commands into buffer, and when pasting it into terminal, they will be automatically applied one by one.
Firmware upload on Linux
Install openocd with:
sudo apt install openocd
Connect the device to the programmer. Pins on uECG have text labels, check pinout of your particular STLink programmer for proper connections.
In the folder with .hex file execute openocd command:
cd ~/< hex-file-folder > openocd -f interface/stlink.cfg -f target/nrf52.cfg
If everything’s ok, command will not return to the shell, so open a new terminal window and enter:
telnet 127.0.0.1 4444
This will establish connection to OpenOCD via telnet. In telnet prompt type:
halt nrf5 mass_erase reset halt flash write_image erase uECG_vxxx.hex (put correct name of .hex file) reset
And that should be it! When everything is done, press ctrl+C in the openocd terminal to close connection (not telnet one).
Firmware upload on Windows
Download openocd here: https://gnutoolchains.com/arm-eabi/openocd/ (use the latest version). Unpack it into some folder. Plug in st-link programmer.
Inside the folder run drivers\UsbDriverTool.exe - and there activate driver for st-link (it should appear in the list). From multiple options select Libusb - Winusb.
After that copy .hex file into \bin subfolder of the openocd (in this case path to the .hex file won't be required, only its name).
Install any telnet client - we tested it with PuTTY. For PuTTY, set IP 127.0.0.1, port 4444, protocol - telnet. Don't press "connect" yet.
At this point everything is ready, connect all wires, run cmd and move there into \bin subfolder of the openocd, then connect the device to st-link, and, while connected, run
openocd -f interface/stlink.cfg -f target/nrf52.cfg
Command should not return to shell, if connection is successful. When that happens, switch to PuTTY (or other telnet client) window, start the connection. In the new shell run the same commands as for Linux case:
halt nrf5 mass_erase reset halt flash write_image erase uECG_vxxx.hex (put correct name of .hex file) reset
And that's it!
9For compiling firmware: installing SDK/compiler and building
You will need
- Nordic SDK version 14.1 (both older and newer versions won’t work without config modification, although functionally it should be compatible with any version at all - we use only very basic SDK functions, no soft device)
- Arm-none-eabi compiler version 8-2018-q4-major or higher
In Nodric SDK you need to write path to arm-none-eabi compiler tools, it is located in file components/toolchain/gcc/Makefile.posix Its content should be following for given compiler version:
GNU_INSTALL_ROOT := ~/<path to uncompressed compiler folder>/gcc-arm-none-eabi-8-2018-q4-major/bin/ GNU_VERSION := 8.2.1 GNU_PREFIX := arm-none-eabi
(if you use a different version, adjust folder name and version code accordingly)
After that, inside project folder, you need to adjust SDK path in makefile. Open project Makefile and put correct path in this line:
SDK_ROOT := ~/< path to Nordic SDK >/nRF5_SDK_14.1.0_1dda907(adjust SDK folder name accordingly if your version is different)
That’s it for build config. Now you need to run
makein project folder and it should produce compiled .hex file.
10Application installation process for PC
1. Install Node JS (with npm). The process is quite intuitive and there are plenty of tutorials on how to make it
2. Download the app here: https://github.com/ultimaterobotics/uECG/tree/master/uECG_nodejs_app
3. Go to the app folder via command line. For this:
- on Linux and macOS: start the terminal, run series of "cd <folder_name>" commands to get to the folder with downloaded app (where "server.js" file is located)
- on Windows: start cmd app for accessing command line, if the app folder is not on disk C - run "D:" if it's on D, "E:" if it's on E etc, then run series of "cd <folder_name>" commands to get to the folder with downloaded app (where "server.js" file is located)
4. Install two required packages by running commands:
npm install express
npm install serialport
5. On Windows and macOS, install drivers for cp2102 chips from here: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers (not needed on Linux)
6. Start the server via command line interface: while in the app folder, run "node server.js"
7. In browser, enter address 127.0.0.1:8080 to access the UI. Note: if you already have some web development environment running on the port 8080, node server won't override it - in this case you can change the port number in the last line of server.js to any other value (and use it in browser correspondingly)
8. On uECG device, after it's turned on and finished blinking startup sequence, press button once to switch it into direct stream mode - after that, you should immediately see data in the browser interface. (pressing the button 2nd time would switch it in arduino-compatible streaming mode, also recognized by the base station, and pressing it for the 3rd time returns to BLE mode, the base won't receive this signal)