Cranial Electro Stimulation

jwhooper

Senior Member
I found this circuit, and I was wondering if I can use one of my picaxe chips instead of the "CD4049 CMOS Hex Inverter Integrated Circuit" in the diagram at this site:

http://www.hackcanada.com/homegrown/wetware/ces/ces_circuit_2.html

Please advise if you like, but if you want to give me a lecture, I would prefer you not respond at all.

In the U.S., these are very expensive and must be prescribed by a doctor, unlike in Europe where they readily available.
 

pao

New Member
The hex inverter looks to be less than 1 USD, even at quantity 1, and requires no programming. I'd stick with it unless you need something more custom.
 

jwhooper

Senior Member
Well, the local store doesn't carry that IC or anything like it, but I have plenty of picaxe chips. I could order one and wait, but I only have the patience of a small child, and I want to play with this thing NOW.

From what I can understand, the inverter is only used to make a square wave. Surely the picaxe can do the same. Unfortunately, I am but a mere programmer by trade, and all of my electrical endeavours are limited to things powered by no more than a nine volt battery so I don't kill myself.

I've studied long and hard, but I still can't understand much about electrical circuits. Programming logic, yes. Hardware, no.

Oh well, if it's too hard I'll just wait a few more hours and my gnat-like attention span will have expired on this project.
 

pao

New Member
Thinking about it, you <i>might </i> be able to do something like
<code><pre><font size=2 face='Courier'>main:
b1 = pins 'put input into var
let pins = ~b1 'invert input to output
goto main </font></pre></code>
which would give you an octo-inverter from the input pins 0-7 to the output pins 0-7. The important &quot;however&quot; is that I'm not sure if this is electrically equivalent to the given circuit. A 9V battery won't power a PICAXE for long, and is in fact an overvoltage; you don't want to overpower the input pins; you may not be able to source enough current from the output pins. You would probably have to completely redesign the circuit for a microcontroller.

Along those lines, just producing a square wave isn't too difficult, though you would need to level shift it from 0-5V TTL to a balanced +/- voltage, which is the apparent meaning of &quot;biphasic.&quot; It may also need to be amplified, though I'm not sure the actual output voltage of the device. I'm not an electrical engineer, so I don't have a ready solution for those problems. You could perhaps tune the square wave by using an voltage divider input to the ADC.

Hope this helps.
 

womai

Senior Member
Apart from achieving 9V, generating the same type of &quot;biphasic&quot; wave with a Picaxe would actually be pretty easy:

<code><pre><font size=2 face='Courier'>
symbol frequency = 10
w0 = 500 / frequency
myloop:
pins = %00000001
pause w0
pins = %00000010
pause w0
goto myloop
</font></pre></code>

The above code will create a 10 Hz square wave. Attach the electrodes to output pins 0 and 1 of the Picaxe. The only limitation, you can run the Picaxe at up to 5.5V, not 9V (this would destroy it), but maybe that already gives the effect you are after?

To get a higher voltage, but keep the circuit simple while still keeping the output signal &quot;biphasic&quot; you could AC-couple the electrodes through two capacitors:

<code><pre><font size=2 face='Courier'>
VCC +18V
+
|
'----------------|
| ____ .-.
| | | | |10k
'--|7805|-. | | 100k
|____| | '-' || ___
| | |------||-----|___|- Electrode 1
GND | | ||
.---' |
.-----o----. |/
| )---|
| | |&gt; 100k
'----------' | || ___
o------||-----|___|- Electrode 2
| | ||
=== ===
GND GND
</font></pre></code>

You supply the circuit with 18V (two 9V batteries in series), and produce the 5V required for the Picaxe through a 7805 regulator. The Picaxe is driving a transistor switch (better would be a Darlington driver, but you may rather have a transistor lying around) - make sure it can handle the necessary voltage.

The lower capacitor is not strictly necessary but I put it in for good measure and also in order to avoid any direct (DC) contact with the 18V which is getting a bit high. Also, DON'T leave out the 100 kOhm (KILO!!!-Ohm) series resistors (you may even want to start with 1 Meg), as they will limit the maximum current to a safe value.

In this case you need only a single Picaxe output (e.g. output 0), and the program becomes:

<code><pre><font size=2 face='Courier'>
symbol frequency = 10
w0 = 500 / frequency
myloop:
toggle 0
pause w0
goto myloop
</font></pre></code>

To vary the frequency, you could e.g. use a Potentiometer between +5V and GND and read in the voltage using readadc10, then scale this value to get the frequency.

Finally, I don't agree with the previous post in that the Picaxe will drain the battery quickly. It uses very little current (around 1mA) for its operation. The consumption only goes up if it has to drive current-hungry loads like LEDs etc., but the proposed circuit doesn't do that (the 10k resistor limits the additional current to less than 2mA). Actually the proposed TTL gate (not the CMOS replacement though) in the original cicuit will use much more current.

Wolfgang


Edited by - womai on 27/05/2007 08:57:04
 

pao

New Member
Regarding the 9V battery, I was just going by the official manual. What you say makes sense, though. jw, listen to womai :)
 

jwhooper

Senior Member
Thanks Wolfgang, that was very thorough.

Actually I have a solderless breadboard with 9v on one side regulated to 5v on the other. This one, to be exact:

http://www.phanderson.com/picaxe/picaxe08m/picaxe08m_dev.html

&quot;Solderless Dev Package - 8-pin consisting of 830 point solderless breadboard, serial connection to solderless breadboard, PICAXE-08M, 5VDC voltage regulator and associated capacitors and monitor LEDs, 9V transistor battery connector (battery not included) and 22 awg solid hookup wire suitable for use with a solderless breadboard. Assembled and tested with blinking LED example. $16.95 US Only. Others, please contact me for shipping costs.&quot;

I also ordered 3 extra picaxe08M chips, and an extra breadboard.

Just out of curiousity, keeping in mind that I know nothing, what it the purpose of using two 9v in series to start with 18v? These are the kinds of things about electronics that mystify me.

I will heed that warning of everyone and carefully test my voltage before hooking up the picaxe. Despite two years of Electronics 25 years ago in high school and many Beginning Electronics books, I still find myself struggling with the simplest things.
 

womai

Senior Member
The original circuit, running off 9V, produces a square wave with 18V peak-to-peak amplitude:

- first half of cycle, output 1 is 9V and output 2 is 0V, so output signal across your brain :) is +9V

- second half of cycle, output 1 is 0V and output 2 is 9V, so output signal across your brain :) is -9V

So the total peak-to-peak amplitude is high - low = +9V - (-9V) = 18V


My proposed signal only produces a voltage varying between 0V and Vcc at the output of the transistor. With 50% dutyc cycle (equal time in high and low state) the AC coupling capacitor will move that to be centered around zero, i.e. going from -Vcc/2 to +Vcc/2 (the capacitors prevent DC current flow, so over longer time scales the total positive current must equal the total negative current). Thus in order to get the same swing, you need to double Vcc to 18V.

I checked and the 7805 regulator can take up to 35V at its input, so 18V is still safe.

Wolfgang


Edited by - womai on 27/05/2007 18:46:47
 

boriz

Senior Member
Quite aside from the fact that rife-machines and there ilk have been around for over 50 years and there is STILL NO EVIDENCE of efficacy, (or even consistent explanations of how they are supposed to work!). Isn&#8217;t anyone else here alarmed at the prospect of people using advice from this forum to electrocute their brain?

Friend. You will get better results from rubbing a crystal against your head and lighting an incense stick.
 

jwhooper

Senior Member
Boriz, all I can say is that while I generally agree with you about such quack devices, this one does have scientific backing, including FDA approval:

http://en.wikipedia.org/wiki/Cranial_Electrotherapy_Stimulation

Still, my expectations are low. It seems to have a perfect safety record, and operates in the low milliamp range.

The most common comment seems to be &quot;It helped some, but it wasn't worth $500.&quot;

I can try it for almost nothing.

Besides, what kind of an electronics hobbyist would I be if I didn't hook up something to my head and run electricity through my brain every now and then?
 

jwhooper

Senior Member
Wolfgang,

Thanks for all your help. I have exactly ONE transistor, a PN2907 PNP. Will that work?

http://www.fairchildsemi.com/ds/PN/PN2907.pdf


 

womai

Senior Member
Unfortunately, that won't work. For my circuit you need an NPN transistor, not PNP. But you can get those for pennies at your local electronics store (pretty much any NPN transistor will work).

As for current, I hope for you it's microamps rather than &quot;low mA&quot;. Around 10mA through your heart will kill you. That's why I added the series resistors to make sure my circuit never exceeds

18V/(2 x 100 kOhm) = 0.09 mA

Wolfgang


 

jwhooper

Senior Member
I only have the PNP and a 555 timer and packages of resistor, capacitors, and other ordinary things. I have a lot of junk equipment, so I could probably salvage an NPN transistor ... I'll go read my electronics books some more, I still don't really understand how the circuit works.
 

jwhooper

Senior Member
What if I just used the outputs from the picaxe08M, and toggled them? If I only want such a low amperage, why do I need any more voltage? My picaxe is already setup to regulate 9v down to 5v, so it probably puts 5v out on the pins, right?

Yeah, I know, I don't know anything, but please explain.
 

womai

Senior Member
The 2N3904 transistor would work (accepts up to 40V across collector-emitter).

If you can live with +/-5V output (as opposed to the +/-9V of the original circuit), then just use my first circuit suggestion and program (the one that toggles outputs 0 and 1 at the same time).

My goal with the second circuit is simply to prefectly reproduce the characteristics of the logic-gate based one.

Wolfgang
 

jwhooper

Senior Member
OK, having it output on the pins is fine for me. I measure 5v to 0v alternating between them. My mA reading is rather strange. It seems to be all over the place, and since I've seen it as high as 20 mA I don't think I'm ready to stick it on my head yet.

I'm guessing I need resistors, so I'll try some 100k on the outputs like you had in the other drawing.
 

jwhooper

Senior Member
Well, I noticed absolutely nothing. No sensation. I moved it up to 1 mA -- nothing. Some units go as high as 4 mA, but I'm not willing to go any higher on my home build.

Here is what I am wondering. If I am on going from 0 to +5v on one side and +5v to 0 on the other side, does this induce the current to flow, or should I be gain -2.5 to +2.5 with the reverse on the other side?

From one build:
&quot;The waveform of this device is a 400 milliseconds positive pulse followed by a negative one of the same duration ...&quot;

another says:
&quot;Pulses are Bi-Phasic (AC) with no DC or offset bias. Output is transformer coupled so that no direct current can appear at electrodes. The algebraic sum of positive and negative-going pulses is zero. This obviates any possibility of electrolysis, ion migration, or polarization.&quot;

So am I getting electrolysis, ion migration, or polorization if I'm using the output of two pins on a picaxe08M?
 

BrendanP

Senior Member
jwhooper, if you have some money to spend you might like to look at a electronics design package called Circuit Wizard. It is designed for kids to use in schools but I have used it to layout complex pcb's for picaxe projects. It also allows you to make a circuit on the screen and see it 'run'. It will help you understand more about electronic hardware issues. I have found it very helpfull.

 
 

sedeap

Senior Member
Why spend money if you can Try for free?
Try this...
Links http://www.*****************.com/files/lw12d_st.exe
or
http://www.*****************.com/files/cw11d_st.exe

for Livewire or circuit wizard
 

jwhooper

Senior Member
I appreciate the information. The products would certainly be helpful.

Although we do home school our children, even the student versions are more money than I would spend for as often I tinker with electronics.

I am happy to state that I did get this apparatus working according to spec (thanks to Wolfgang). The sensation isn't unpleasant, but I wouldn't call it relaxing, exactly. I don't feel significantly different, but I'll give it a few more sessions.

I've written a lot of biofeedback and neurofeedback software, if you are wondering where my nutty interests in such things comes from. Biofeedback seems to be modestly useful for relaxation, but I'm still not sure neurofeedback is good for anything, just speaking from personal experience.

Thanks to all!
 

sedeap

Senior Member
WOW ! I feel all this like electroshock therapy... Warning to not end like Frankenstein !
I read some parts of the article in Web about this and feel that isn't good enough to try it... lol :0)

They say they use &quot;electric fish&quot; in Old Greece and Rome... (Mmm... Maybe Nero(n) try this before burn rome...) hehehe LOL

Be carefull no matter what anyone say !

Bye
:eek:)
 
Top