Why doncha PIC on someone yer own size!

April 27, 2008

Well, there’s been a whole lotta heavy experimenting goin on, but i just haven’t found the time to post what I’ve been up to. First things first… the LTC clocked filter was a total flop, so I had to incorporate a 4 stage Sallen Key filter (wonder if you love & hate analog like i do)… Later, I switched to a Fliege filter. Results are pretty clean (for now)… And there’s more to come in the Bio-signal front…

…In the meanwhile, I was also working on setting up a decent Serial Data Logger (opto-isolated, no less). Can’t mess around with your life when it comes to recording bio-signals… so the best way to go is definitely optoisolation. Anyways, I played around with the 8 bit, 8 channel ADC 0809 coupled with the USART 6402 and MAX232 plus 6N139 (for the optoisolation of course). It was all a miserably failed attempt. And I’m glad it failed… coz I found an easier way to get the signals logged.

Enter PIC 16F73 (or 76 or 876… you take your PIC 😉 ) . I had already created a custom-made Serial Data Logger software in Visual Basic and it was designed for 8 bit sampling ranging from 1200 bps to 57600 bps. I didn’t want to rewrite the code for 10 bit sampling, so I just stuck with the 16F7X series instead of the 87X series. Well, once you decide on your PIC, you obviously need to have a programmer. Prior to this, I made a cute l’il programmer for 16F628A, but it wasn’t a generic programmer… so I had to build another one from scratch.

The programmer I chose was a modified version of the famous JDM programmer. The good thing about this progger is that you can use it for most PICs ranging from 8 to 28 pins. Please check out the links below if you wanna build yourself a highly affordable generic PIC programmer:

Link1: http://www.stmental.net/~dfoster/dmf_picprog/

Link2 (for the original JDM progger): http://users.tpg.com.au/btkelly/jdm_b.htm

Note: There is a small correction to be made in the schematic at Link1. The Drain and Source of the MOSFET as shown in the diagram need to be reversed. I learnt this the hard way. Everything else in the schematic is A-OK.

Here’s a pic of the modified JDM Progger I made myself (couldn’t find a 28-pin ZIF, so had to use a 40 pin socket instead)

After plenty of coding an recoding and tweaking and twisting, I finally managed to get a decent output from the PIC. Since it has an inbuilt ADC as well as a UART, it made my job MUCH easier. The only thing I had to get was a 20 Mhz crystal to run the PIC, but after that, everything just worked perfectly (almost… still get a couple of glitches in the output… will have to iron them out soon).

Here’s a snapshot of data sampled by the PIC and fed to the computer via the Serial port. Say Hi! to my very own Serial Data Logger software:

Serial data logger

The beauty about this software i wrote is the flexibility. My favorite part is choosing the number of channels… a corresponding number of data display frames are automatically created and I can view each multiplexed channel separately in its own frame.

Here’s a picture of the Opto-isolation section of the Data Logger circuit. You can’t see the chips clearly, but those are MAX232 and 6N139 along with 7805 for power supply regulation.

Max 232 with 6N139

On the output side of the 6N139, the MAX232 and 6N139 are powered by a cable that runs directly from my PC’s own power supply. I used the 9V terminal from the PC supply and regulated it with 7805. If you dont wanna use the regulator, you could always use the 5V terminal from your PC’s power supply connectors instead.

On the input side of the 6N139, everything is powered by a 9V battery (regulated to 5V by another 7805). This ensures that your bio-signal end is galvanically separated from your PC.

And for the finale, here’s a pic of the PIC 16F73. The serial output from the PIC goes to the input of 6N139. I segmented the two parts, so that I could experiment and fine tune each one separately first…

PIC 16f73 - ADC with UART

Stay tuned for more updates. The next time I blog here, it’ll be all about putting this entire mess together and just hoping that it all works like a charm :-))

Advertisements

~ by teknomage on April 27, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: