Custom Hardware Seizure Detector

We have made some progress with a feasibility study into running OpenSeizureDetector on very low cost hardware – I have started a page Custom Hardware Seizure Detector that I will update as we develop it.

It would be really good to know if people are interested in this – please either get in touch with graham@openseizuredetector.org.uk or our facebook page http://facebook.com/openseizuredetector.

Custom Hardware – Back to Basics

clone tag: 4666059039841896442

I have been carrying the proof-of-concept custom hardware set up (an ESP8266 module (clone of Wemos D1 mini) and an ADXL345 accelerometer module – shown right) up and down the country for a couple of weeks.

I can program it to flash an LED on and off, so the input output is working, but it wouldn’t talk to the ADXL345 accelerometer – I tried adding pull-up resistors, switching which input output line I was using, but to no avail.

So this evening i went back to basics and started with a new ESP8266 board and a new accelerometer module, and wired it on a breadboard so I can probe what is happening easier (see right).

This is a straight connection (no external pull-up resistors etc.   Wemos D1 (=GPIO5) connected to SCL, Wemos D2 (=GPIO4) to SDA.

Then I ran a simple i2c scanner, which just looks for a non-error response for every possible address (see source code on Github).   With that, I finally get a response….the module is using address 0x53, which is the ALTERNATIVE ADXL345 address, not the primary one I suspect my earlier problems could have been as simple as trying to read the wrong device address rather than wiring issues as I had assumed – Doh!!!

Potential Custom Seizure Detector Hardware?

With Pebble watches not being available any more, and Android Wear devices being very expensive, I am still wondering about an alternative seizure detector hardware platform.

I have heard about ESP8266 modules – they are small microcontrollers with built in wifi capability.    Although most people connect them to another microcontroller, it is possible to write your own software to run directly on it so I am wondering if it may be possible to make a seizure detector watch with them – It would need an ESP8266 module, an accelerometer chip and a LiPo battery, and put it in a 3D printed case.

I have just got an ESP8266 module with a built in USB interface.  This is a bit on the big side, but about the same size as a Pebble Time, so not out of the question (top image on right)

I have also got a few smaller modules that do not have a USB interface, so will take a bit more programming, but they are a lot smaller (bottom image on right)

The most surprising thing is the cost – the big one with extra hardware was just over £5, but the small ones are less than £2 each – it is hard to believe anyone can manufacture things and ship them from China for that price….

I have set up the compiler toolchain from https://github.com/pfalcon/esp-open-sdk, and obtained the tools to interact with the boards from https://github.com/espressif/esptool, and finally obtained some example programmes from https://github.com/esp8266/source-code-examples.git, which includes a ‘blink’ example.

After a bit of faffing to get the Makefile to work with my new cross compiler, ‘make’ will compile the programme, and ‘make flash’ will write it to the board.

After which – the on-board LED flashes on and off every second – success – the Microcontroller equivalent of ‘Hello World!’.

Next steps are:

  • Connect an accelerometer chip  to the board, using the SPI or I2C interface and try to read data from it (like I did using an Arduino back in 2013 – Soldering onto Surface Mount ICs).
  • Port the Pebble_SD seizure detector algorithm to the board to see if it will fit.
  • Get it to act as an OpenSeizureDetector network data source so that other devices can connect to it to detect alarms etc.
  • See if we can get the power consumption down enough that running it off a watch battery is feasible.
  • If it seems feasible, re-commission my 3D printer and try to make a case.
  • Think about adding an optical heart rate and blood saturation measurement to it.

The video below is not exciting, but it proves we can at least run a programme on one of these tiny (and very cheap) boards.