Skip to content
Snippets Groups Projects
Commit 8fd19208 authored by MuijzerF's avatar MuijzerF
Browse files

Corrected offset from ADC output, updated readme

parent 4ccf3847
Branches
No related tags found
No related merge requests found
No preview for this file type
This diff is collapsed.
......@@ -28,7 +28,9 @@
<ol>
<li><a href="#about-the-project">About The Project</a></li>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#Hardware modifications">Hardware modifications</a></li>
<li><a href="#Installation">Installation</a></li>
<li><a href="#Concept of the code">Concept of the code</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
......@@ -79,7 +81,7 @@ If not, try other devices in the pulldown menu.
You can verify the COM port number in the Windows device manager under the "Ports (COM & LPT)" group. Simply unplug and plug the ECG monitor to see which device appears.
<!-- Hardware modifications -->
### Hardware modifications
The TCO ECG monitor needs to be modified once to allow usage of this new firmware. This should only be performed by a experienced engineer.
......@@ -101,6 +103,7 @@ The TCO ECG monitor needs to be modified once to allow usage of this new firmwar
- Unrelated, but good to do when the device is open:
- Replace battery
<!-- Installation -->
### Installation
Teensy should have the correct firmware in place. If it does not identify as USB Serial Device, you can reprogram it.
......@@ -113,6 +116,30 @@ The "Compiled Firmware" folder contains the HEX and ELF files. These can be flas
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- Concept of the code -->
### Concept of the code
Code is Arduino based.
A task scheduler by https://github.com/arkhipenko/TaskScheduler/ is used to time aquisition and data sending individually.
The aquisitionTask samples data from the ADC, and creates a binary sample set (including the microsecond counter).
This sample set is appended to the either send buffer A or B, depending on which buffer is locked by the communicationTask.
The communicationTask locks one buffer before it sends it to the serial receiver. Via this mechanism, the communicationTask and aquisitionTask never use the same buffer at the same time, avoiding conflicts.
The const long communicationTaskDuration = 10000; variable defines that 100 times per second the data is send to the serial receiver.
Because the raw signals from the AD7683 turned out to be noisy, an oversampling mechanism is implemented.
const uint8_t downSampler = 16; defines the number of samples from the ADC wich are averaged before sending them to the serial receiver.
const long aquisitionTaskDuration = 125; defines that the ADC is sampled at 8 kHz. Since 16 samples are averaged, the resulting output frequency is 500 Hz.
The downsampler just calculates the mean of the last 16 samples, no filtering is applied.
The code contains a debug log function with different verbose levels. It should always be on silent:
const int verboseLevel = helpers::verboseLevels::silent; supresses all log output which would otherwise interfere with the sample data.
<p align="right">(<a href="#readme-top">back to top</a>)</p>
......
images/USB_Pinout.png

18.3 KiB | W: | H:

images/USB_Pinout.png

21.7 KiB | W: | H:

images/USB_Pinout.png
images/USB_Pinout.png
images/USB_Pinout.png
images/USB_Pinout.png
  • 2-up
  • Swipe
  • Onion skin
images/screenshot_uscope_ECG.png

121 KiB

......@@ -9,7 +9,7 @@ using namespace helpers; // contains the verbose levels from Instr
#include <BufferSupport.h> //data buffers
// #include <SerialSupport.h> //Serial object
const float versionNumber = 0.1; // version displayed on boot
const float versionNumber = 1.1; // version displayed on boot
const uint16_t serialTimeOut = 1000; // timeout in ms
const long serialBaudrate = 115200;
static uint16_t logFreqSamples = 200; // give samplecounter and summary every n samples
......@@ -187,6 +187,7 @@ void aquisitionTask_Callback()
// convert to float voltage
ADCvolts = (5.0 * ((float)ADCresult / 65535)) / downSampler ; //convert to float and compensate for downsample
ADCvolts = ADCvolts - 2.5; //offset to compensate for the single supply ADC
// convert to bytes
byte *bADCvolts = (byte *)&ADCvolts;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment