Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to TMSuino2 #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
118 changes: 6 additions & 112 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,9 @@
Please use the latest release [TMSuino3](github.com/TMSuino/TMSuino3)
=======

TMSuino
========

_A low-cost arduino-based TMS ([transcranial magnetic stimulation](https://en.wikipedia.org/wiki/Transcranial_magnetic_stimulation)) device to influence the symptoms of bipolar disorder._

## Table of contents

- [Getting Started](#getting-started)
- [The Picture](#picture)
- [Prerequisites](#prerequisites)
- [Building it](#building-it)
- [Application](#application)
- [Rationale](#rationale)
- [License and Disclaimer](#license-and-disclaimer)
- [Contributions and Questions](#contributions-and-questions)

## Getting Started

Despite over 30 years of activity and over 500 patents **transcranial magnetic stimulation** hasn't yet found broad adoption.

It is my personal opinion that the reasons for this are two-fold:

1. On-going dispute about it being a placebo effect - due to a lack of provable scientific explanations

2. High costs - due to a focus on complex research devices

This projects' focus is on the second point: Drastically cutting down costs.

This is achieved using an Arduino UNO as the main driver module. Overall cost of parts is below 63 Euros ($75 as of August 2017).

The device requires no soldering, tools needed are a pair of scissors and a measuring tape / ruler / yardstick.

### Picture

Here's a picture of the thing:

![TMSuino](photos/the-thing4.jpg)

It is worn like a cap:

![TMSuino on head](photos/how-to-wear-rightside.jpg)

### Prerequisites

1. Arduino UNO R3 - as driver module

2. Six coreless coils - to create magnetic fields

3. Jumper cables - for wiring the coils to the arduino

4. Cloth tape - to put everything together

5. Double faced tape - to fix the coils onto the cap

6. Tools: A sturdy pair of scissors - for all cutting tasks

7. Optional tools: A printer - to print the placement pattern

8. Optional parts: USB power adapter or 9V power adapter or 9V battery holder - as alternative power sources

[For more details read the part list](partlist/README.md)

## Building it

It takes about two hours to build the device:

1. Making the cap<br/>
[For more details see coil setup procedure](coilsetup/README.md)

2. Wiring<br/>
[For more details see the wiring description](wiring/README.md)

3. Arduino Code<br/>
[For more details see the code readme](code/README.md)<br/>
[And if problems persist the troubleshooting readme](troubleshooting/README.md)

4. Fixing jumper cables<br/>
[See the details on fixing here](fixing/README.md)

## Application suggestions

#### Side effects

Sessions of 15 minutes' length might be required to register any effects. Head aches, a "pressure feeling", can occur - these are expected to be harmless and temporary. Slight nausea, especially on an empty stomach, can occur - this is expected to lessen after one week of application.

#### What to watch out for

The desired effect would be called **"sobering"** - hinting the disruption of a manic phase. Or **"stabilizing"** - hinting the improvement of a depressive phase. Nothing is felt if no phase was active or no change occurred.

**This is no treatment plan - just a starting point for your own research efforts.**

When you end a sitting, check that the LED of the Arduino is still on and _not_ blinking. Then you know it has not gone into error mode some time during the sitting.

## Rationale

If you are curious why mentioned parts and materials where selected, [read the details in the rationale](rationale/README.md).
But you don't need to know this to build and use the device.

## License and Disclaimer

For anything to be low-cost it must be open-source. Otherwise third parties will always take their share.

Therefore this work is licensed under CC0; putting all of it into the public domain. See the [full text of CC0 here](License-CC0.txt).

## Legal issue

For legal reasons every person that wants to try this device has to build it by themselves.

## Contributions and Questions

Are welcome. Please see the [contributing and questions section](contributing/README.md) for more.

**This project is outdated and kept for refernce only**

[Please use TMSuino3](github.com/TMSuino/TMSuino3)

[The older version TMSuino/TMSuino2 is kept for reference only](old/README.md)

25 changes: 22 additions & 3 deletions TMSuino/TMSuino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,36 @@
#define I6 (A5)

#define LED (13)
#define BUZZER (2)

const int outpins[6] = { O1, O2, O3, O4, O5, O6 };
const int inpins[6] = { I1, I2, I3, I4, I5, I6 };
int value = 0;
const int threshold = 1020;
const int threshold = 1015;
int ledState = 0;
int cnt = 2;

void beep() {
digitalWrite(BUZZER, HIGH);
delay(60);
digitalWrite(BUZZER, LOW);
delay(100);
}

void beeeep() {
digitalWrite(BUZZER, HIGH);
delay(300);
digitalWrite(BUZZER, LOW);
delay(150);
}

void toggleLED() {
ledState = 1 - ledState;
digitalWrite(LED, ledState);
}

void error() {
digitalWrite(BUZZER, HIGH);
//endless loop toggling LED
while (true) {
toggleLED();
Expand All @@ -49,7 +65,7 @@ void activate(int coil) {
//argument is 1..6, *not* 0..5
void writeAndCheckInput(int coil) {
activate(coil);
delay(50); //wait for the inpin to pull up
delay(20); //wait for the inpin to pull up
value = analogRead(inpins[coil-1]);
//Serial.println(value);
if (value < threshold) error();
Expand All @@ -65,6 +81,8 @@ void setup() {
//Serial.begin(9600);
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
pinMode(BUZZER, OUTPUT);
digitalWrite(BUZZER, LOW);

for (int i=0; i < 6; i++) {
pinMode(outpins[i], OUTPUT);
Expand All @@ -75,13 +93,14 @@ void setup() {
activate(1);
activate(6);
digitalWrite(LED, HIGH);
beeeep(); beep(); beeeep();
}

void loop() {
deactivate(cnt);
cnt = cnt + 1;
if (cnt >= 6) cnt=2;
writeAndCheckInput(cnt);
delay(200); //overall delay should be close to 250ms
delay(10);
}

6 changes: 3 additions & 3 deletions code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ sudo chmod a+rw /dev/ttyACM0

There is a row of three yellow LEDs on the board. The two leftmost yellow LEDs on the board should flicker for a short moment, that's the upload.

7. After a few seconds, the rightmost of the yellow LEDs should light up and stay constantly alight.
If it blinks fast, one of the coil connections is broken or connected in the wrong way.
In that case go back to wiring and check all connections.
7. After a few seconds, the rightmost of the yellow LEDs should light up and stay constantly alight, you should also hear a sequence of three beeps.
If it blinks fast, and the beeping is constant, one of the coil connections is broken or connected in the wrong way.
In that case go back to wiring and check all connections. Hit the arduino's reset button afterwards to restart the self-check.

| OK | Error |
|----|----|
Expand Down
30 changes: 1 addition & 29 deletions coilsetup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,7 @@ The lengths of all the bands connecting the coils are all the same. This is by d
The size of the pattern should be selected so that the outer coils are just above the ears.
Measure the distance between the ears along the top of the head. Use a measuring tape if available, use a piece of paper and ruler on the paper if not.

If you have a printer avaiable, you can then select one of the following [prepared templates](#prepared-pattern-templates-for-printing), print it and do the cut-out.

For those who need to draw it by hand, here is how to do that:

## Drawing the pattern template by hand

#### Calculating distances A,B,C

Use your measurement of the ear-to-ear length to calculate the lengths A,B and C.

Here is the [calculator on jsfiddle.net](https://jsfiddle.net/TMSuino/aajudjLj/embedded/result/)...

...or you can use these formulas:

```javascript
margin = 3 cm or 2 inch;
A = (ear2ear - margin - diameterCoil)*0.366025;
B = a*0.5;
C = Math.sqrt(Math.pow(a,2)-Math.pow(a*0.5,2));
```

#### Drawing

![pattern with construction lines shown](../images/handdrawing-construction-lines.png)

The bands between the coil circles should be wide enough so the tape does not overflow. Otherwise the tape would later stick to the hair.
Furthermore, if your coils have a large inner diameter center holes might have a use for you.

## Prepared pattern templates for printing
Just print one of following pattern templates, matching your size, and cut it out.

Following patterns are made for 3.6cm coil holder diameter and 19mm tape width.
Make sure printer dialogs' page setup is set to landscape.
Expand Down
9 changes: 1 addition & 8 deletions contributing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
Contributing and Questions
========

If you have questions you can reach me via e-mail [[email protected]](mailto:[email protected]) but please keep in mind that I cannot and will not give medical advice. I will only answer to those mails that have a **public** key attached, so I can easily encrypt my answer.
I believe this is prudent and in your best interests.

Furthermore putting an e-mail address into the open typically leads to a lot of spam. I believe spammers won't send public keys with their mails, leaving me an easy option to filter that stuff.

Of course, your are encouraged to encrypt your e-mails as well. Here is my [public key](tmsuino-public-key.asc) also available via Enigmail Keyserver (Fingerprint A4BF A8D1 9654 0268 D743 B873 6AE3 7A82 238A B985).

Please note that encrypting an e-mail only encrypts the content. Subject, sender and recipients are still visible to anybody.
If you have questions you can reach me via e-mail [[email protected]](mailto:[email protected]) but please keep in mind that I cannot and will not give medical advice.

I cannot guarantee to answer each and every question. But I will try to keep you informed of major developments.

Expand Down
53 changes: 0 additions & 53 deletions contributing/tmsuino-public-key-0x238AB985.asc

This file was deleted.

Loading