Git Product home page Git Product logo

heg_esp32's Introduction

HEG_ESP32 - Open Source

Now on CrowdSupply!!! This includes an article elaborating on the science: https://crowdsupply.com/alaskit/hegduino

Hemoencephalography meets highly affordable IoT! Now with bluetooth! Incoming schematics, app, and how-to's. Join the Slack!

We have patched the original open source HEGstudio by Jonathan Toomim to work with our HEG!

v0.1.2 with EXE, Tested for Windows 7, 8, and 10: https://files.fm/f/78ufkvzy

Source available in this repo, but requires the resources and media files available from the original sourceforge: https://sourceforge.net/projects/hegstudio/

See also: Arduino Nano V3 HEG

Materials

  • Arduino Huzzah32 Feather or Lolin32 V1.0.0. Other ESP32 arduino boards are compatible but usually have different pinouts.
  • ADS 1115 w/ PGA, 16-bit ADC
  • OPT101 Photodiode
  • 1 HAN1102W Infrared LED
  • 1 BR1102W Red LED
  • 6 pin SOT23 socket (for mounting LEDs)
  • MicroUSB cable.

You can save quite a bit of money if you use Ebay or Aliexpress for the ESP32, ADS1115, and OPT101. Mouser or Digikey should have the LEDs, note the HAN1102W is the latest version of the AN1102W and is easier to find. You can get a prototype together for less than 15 dollars buying singular components (before shipping) if you know what you are doing.

What is it?

HEGs typically cost hundreds or thousands on the market, so this is a much better solution for people wanting to get their feet wet with biofeedback and do a cool DIY project to understand the extremely straightforward science better. HEG biofeedback was originally developed as a safe and non-invasive method to treat ADD in the late 90s, later expanding to treating disorders like PTSD and Depression due to common stress symptoms like Hypofrontality being treatable with this tool. It is implicated for much more, but there's not a whole lot of data (which this 20 dollar version could solve). It is informally called "brain pushups" for how it works out your brain to enable better bloodflow and oxygenation, therefore cognitive functioning and self-control. It only takes 5-10 minutes in the first session to gain control of bloodflow in the targeted area. I don't recommend doing more than 10 minutes at a time with this thing. Be wary of fatigue or headaches the first few times when you start gaining control of your bloodflow. View the RecommendedReading.txt for some resources to educate yourself more deeply on this subject.

Explanation

Explanation

Placeholder...

Schematics

Schematic

Assembly

We used cheap protoboard to mount our DIY prototypes. For the sensor we used a protoboard snapped in half and taped together for a pseudo flexible circuit.

  1. Cut your wire leads to be the desired length between the sensor, which goes on your forehead, and the receiver. Sensor-only or ADC to ESP32 leads should be the shortest distance, which will vary for different setups so use your judgment.

  2. Wire it up based on the above schematics diagram. The anode marks on the LEDs are green. Use a 6 pin SOT23 socket to mount the SMT LEDs, they should only be a few cents. Use electrical tape to cover any pins or wires exposed so they do not contact your forehead.

  3. Install ESP32 firmware on device via Arduino IDE. Requires ADS1x15 library and arduino ESP32 library

  4. Secure sensor to forehead, make sure ALL light is blocked as the photodiode is very sensitive.

  5. The data output via serial USB or bluetooth (toggleable in the script or via serial) is structured as: "ADC_READ, RATIO_READ, POSITION_FROM_BASELINE" The Ratio section will transmit "WAIT" when it is still gathering samples, including when getting the initial baseline.

We'll soon be adding free Windows and Android apps, including compatibility with the original HEGstudio by Jonathan Toomim!

Testing Notes

The photodiode is very sensitive. Any moisture or stray light will throw off the readings. Block off any light in-between and around the LEDs and the photodiode to ensure no leaks.

The maximum ADC reading is 32768 (15 bits) and each step is 0.125mV at the maximum 16X gain on the ADS1115. This is plenty sensitive for blood-oxygen detection. The range for real data is in the 200-3000 range. The script will not set the baseline unless it is below a specified light threshold.

Be sure to cover the photodiode pins and the LED contacts with electrical tape so your forehead doesn't complete the circuit and throw off readings.

If there is moisture expect ADC or score readings to decline to zero and even negative values.

If your IR LED is not working the ratio will be positive as the red LED has a lower intensity. Ratio = Red / Infrared. You can reduce the flash rate in the arduino script to test conclusively via the ADC.

App Features

React Native with SPP or custom BLE support. Still bare-bones at this point. Working on multi-threading. Packages for Android and iOS incoming!

Example Data

Graph 1 is about 1 min of ratio data. Graph 2 is about 4 min of scoring data (a simple ratio - baseline, will be changed to the cumulative change in the SMA) Graph 3 is about 3 seconds of ADC data at 20hz LED flash frequency. data

HEGstudio with this HEG

heg_esp32's People

Contributors

joshbrew avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.