Tag Archives: tinkering

Building a good tDCS device – part 2

So basically, to have my super simple and easy to build, yet safe (as can be under the circumstances) brain zapper, I determined the following block components as necessary:

  • Current source
  • Protection against reversed polarity
  • Manual current shunt for start and stop
  • Transient suppression
  • Test points for measuring current and voltage
  • Voltage indicator LED

Current source

I wanted to be able to experiment with various current levels, so I opted for using miltiple CRDs in parallel. Using jumpers to turn them on or off allows me to set the current to 1.0, 1.5 or 2.0 milliAmps.

CRDs are kind of expensive as loose components go, so I wouldn’t necessary do the same for a device that goes into mass production, but that wasn’t the goal here.

Protection against reversed polarity

This one is needed because a CRD acts as a short circuit (well, actually it acts like a forward biased diode) when biased in reverse. Since I was going to build this on a veroboard with an el cheapo pinheader to connect the battery holder, I needed to make sure there won’t be any surprises if I ever connect the thing backwards.

Solution: I just added a diode between the battery and the positive rail. Since I’m using two 9V batteries, the .6 Volts I’m losing there is insignificant.

Manual current shunt for start and stop

If we add a potentiometer the the simple circuit I linked to in my last post, there are two ways we can do it. Either in series with, or parallel to the load (ie. our head).

Manual start/stop configurations

Manual start/stop configurations
a) Potentiometer in series
b) Potentiometer in parallel (shunt)

Now the series configuration is absolute rubbish, the only reason I included it here is to explain what’s wrong with it. We can treat the CRD, for all intents and purposes, as a “smart” resistor that sets its value to whatever is necessary to maintain a specific level of current flow through its terminals.

It is meant to nullify whatever changes might come along in series resistance, and keep the current static, as long as there’s enough voltage to keep things up. So it would end up fighting any series element meant for start or stop. Regardless of the value of the potentiometer I use, the result will always be quite inadequate.

Current curve for potentiometer in series

Potentiometer in series:
This is how the current would change in response to turning the knob. Not so pretty, huh?

The better, and safer way to cut current flow to one’s head is to reroute it, to create an adjustable shunt to ground in parallel with the load. Now this has its own fleas. Due to the nonlinear nature of the current divider equation, I still get most of the current turned on (or off) on the first 10% of the pot’s rotation, and the rest changes naught.

However, “audio taper” potentiometers came to my rescue. They are pots with a nonlinear curve optimized for volume adjustments, to compensate for the logarithmic nature of human perception. In this case, they compensate adequately for the nonlinearity of the current divider law. While not perfectly linear, and subject to change as the resistance of the load changes, it’s good enough.

Current curve for potentiometer in parallel

Potentiometer in parallel:
This is how the current would change in response to turning the knob.

As you can see though on the diagram, we will always lose about 10% of the current with a 50k potentiometer, and an average 3.5k resistance across the electodes (in my experience, using standard 2″ saline sponge electrodes, resistance varies between 1.5 and 4k, so this is a good approximation). Since my CRDs were off by about +10% compared to their nominal value, I decided this might be a good thing even.

Transient suppression

What happens when I connect the trodes to the device after it has been turned on? What happens if the potentiometer malfunctions? If a wire breaks? Well, even though none of these should be dangerous in the strictest sense, they would potentially lead to voltage and current spikes on my brain, which are, in the very least, extremely unpleasant.

The worst case scenario is suddenly connecting up an open circuit. If the loop is broken, the current is zero, and so is the resistance of the CRD. It allows almost the full input voltage onto the terminals. When you first connect up a loop like this, and your head happens to be the last element to be added, you’ll be treated to almost the full 18 Volts for a few moments, and before the CRDs catch up and stop the current, you’ll get transient currents potentially higher than 2mA.

You don’t even have to be an idiot for this to happen. A wire could break, and then by a minute movement, become reconnected, resulting in the above scenario. So what can be done about it? I explained my disdain for “soft start capacitors”. A CRD works by varying voltage in order to keep current stable. A capacitor resists changes in voltage. They are “enemies”, fire and water.

However, an inductor does the exact opposite. It resists changes in current. Just what we need, huh? It’s kind of the electric equivalent of a flywheel. The only problem is that a DC choke large enough to make a noticeable difference is big and heavy – this time I decided to accept the big and heavy, and got a 10H choke, but unfortunately, for a portable device this would be far too much bulk in my opinion.

Note: a choke needs a flyback diode (a diode biased in reverse across its terminals), to make sure it doesn’t create crazy voltages when you take the current away, allowing it to wind down.

I’ll post some oscilloscope screenshots, for now you’ll just have to take my word that without the choke, there was significant ringing, and transient currents up to 4mA upon connecting up a broken loop. With the choke added, the overshoot and ringing were gone, and the current never passed the 2mA threshold.

Test points for measuring current and voltage

Well, I have two multimeters, so I didn’t want to burden the design with any dials or digital meters. Added a 1k precision resistor as a current shunt (making 1V of measured voltage equivalent to 1mA of current), and test points for measuring voltage across the current shunt, across the load, and across the battery terminals.

Voltage indicator LED

My last idea to make this as safe as possible was to include a LED that would light up if there is a voltage on the terminals. Just to make sure I’d never plug my head into a live connector.

To isolate the LED from the load (I sure as hell don’t want a LED’s 30 milliAmps on my head, no matter what happens), I used a 1M resistor, and a darlington pair…

Putting it all together

Based on the above, this is the final design, and the device. It’s pretty small, fit on the tiniest veroboard I could find, is safe, and works good enough. All in all it cost me less than $50, and a few hours of work.

Schematic for my diy device

Schematic for my diy device

The device built


Building a good tDCS device – part 1

After reading all up about tDCS, and deciding it might be a good idea to take a crack at it, I was faced with a dilemma. You see, professional tDCS devices cost a lot, and are medical devices, ie. you can’t just buy them off Amazon.

Of course, there were a few options beside that. One of the awesome things about tDCS is that the technology is so easy it’s almost ridiculous. To have a fully functional tDCS device that does exactly what the professional ones do, all you need is a current regulator set for 2mA, some wire, and two saline sponge electrodes.

Since it caught the fancy of many geeks and makers, there was an awful lot of resources out there. I first came across an initiative to create a kit, called GoFlow. Their webpage is still up and dandy, though the project itself went under years ago. It was intended to be a simple device with a standard bifrontal electrode layout (more on that stuff later, do some googling if you’re interested).

Now even if it was available, it has its shortcomings. For example, they have this big ass, 470uF electrolytic capacitor across the ‘trodes. I fail to see how that would EVER be a good idea in a current regulated loop. I do love the concept pic tho’, all those Apple-esque colors…

The next candidate was the foc.us. If you haven’t seen it already, it’s the big game in town. I’m not entirely convinced what they are doing is legal, but they are popular and the device looks cool. That said, it’s expensive for what it is, requires an iPhone 4S to access all functionality (a regular iPhone 4 just won’t cut it), and seems to have been designed by a herd of insane marketing managers high on MDMA.

So, I decided against it. Since then, it turns out I was even more right than I thought I was. The foc.us is a dog with fleas. I’m particularly struck by the fact that it goes to the length of having 64 Volts as its maximum driving voltage. How irresponsible is that?

That’s when I read this article on the Speakwisdom blog. It’s a beautifully simple design, and as far as I know at least two commercially sold kits (the kind of pricey Biocurrent kit, and the humbly named – and priced – tdcs kit) are based on it.

Simple tDCS design

The design is based on a so-called current regulating diode, or CRD, which is a simple and robust device. It’s a FET wired in a current limiting configuration, and factory-tuned for a specific current level. They are quite stable, very low maintenance.

So I got some, plugged them up in a breadboard, wired up a pair of Amrex electrodes, and well… It worked. However, I felt quite shocked when I turned the thing on, and had lights flash in front of my eyes when I disconnected it. Of course these side effects are well known and harmless (the flashing lights are called phosphenes and are due to some neurons firing in the retina or the optical nerve), but I just couldn’t shake the thought that it could be made safer and nicer.

Of course I wouldn’t think of connecting a big ass “soft start” capacitor across the terminals, like the crazy GoFlow guys, especially not that my design is not a nice, single package like theirs, ensuring constant electrode contact. Things can get disconnected, a wire can break, and then the “soft start capacitor” gets a new job as a “very hard start capacitor”, or more aptly the “help a donkey kicked me in the head capacitor”.

Adding a potentiometer for manual starts and stops seemed like a good idea, but it wasn’t trivial either, due to the nonlinear nature of the entire system. The trick is to get a setup where the intensity is at least somewhat linearly distributed across the movement range of the pot. I didn’t want the current to come up in a jolt at either end – I wanted a smooth, nice ramp.

While I was thinking about solving that, I also gathered a few further requirements pertaining to the device:

  • Should be cheap,
  • Should be simple enough to build on a veroboard,
  • Should be as safe as I can make it,
  • I should be able to build it in a day or two once I have the components delivered…

I think I came pretty close.