Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
 Pages:  1  ..  3    5    7  ..  12
Author: Subject: do-it-yourself nuclear magnetic resonance spectroscopy
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 25-9-2010 at 21:36


Chemical shift describes how much a particular nucleus' magnetic
precessional frequency (or Larmor Frequency) is changed by its
electronic environment.

The Larmor equation is ω = γB

  • ω is angular frequency (2πf)
  • γ is the gyromagnetic constant of the particular nucleus, and
  • B is the applied magnetic field in Tesla


Knowing the 1H gyromagnetic constant, 2.675 222 099e8, you can figure
a proton Larmor Frquency for any magnetic field you can express in Tesla.

Brigham Young University has a handy Larmor frequency calculator.

For the 1H nucleus in water, it is 42.5MHz at 1T field, and 60MHz at 1.4T.
For benzene, the protons precessional frequencies are shifted 450 Hz
downfield on a 60MHz/1.4T NMR.

Since the precessional frequency changes with applied magnetic field, it
is more useful to express the chemical shift as ppm instead of Hz, so
that 450 Hz becomes 450/60Meg or 7.5 ppm.

When the French speak of their 1GHz NMR, they are essentially bragging
about its 23.5T superconducting magnet wherein a 7.5 ppm chemical shift
is 7500 Hz.
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 07:25


Now, getting back to where I originally suggested the same, the outgoing sine wave is generated as a sawtooth wave, then smoothed by a lowpass filter. Is there any reason we can't do with this PIC what has been done with others, ie. generate a hex-coded sine wave (43.xxxx MHz) for the signal we want and put it out through the DMA Controls? That would save fucking around with DDS, etc.

With regard to both the front & back-end could we fuck around with this, Silabs Hybrid TV Tuner, which is a system on a chip for the 42-1002MHz range?




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 08:46
OpenCore NMR comments


Takeda has a site for his OPENCORE NMR. From the freely
distributable OpenCore NMR content, you infer that Takeda wants to bring
NMR to the masses.

A few years ago, there were a flurry of electronic designs that used an
FPGA for DDS and which relegated setup and off-board communication to
a small MCU. If/Once you get the FPGA program working, you have a
compact and relatively inexpensive hardware implementation.

I say 'relatively' because OpenCore NMR uses a $246 mixed-signal FPGA
that handles DDS, pulse generation, FFT, and outgoing data FIFO. Of
course, the price is low compared to even the smallest of commercial
NMR devices.

Designing an FPGA circuit is an onerous slog. Time-to-market on this sort
of project, when designed and built from scratch, takes about 1.5 years,
an interval that can kill a small company if they misjudge the market.

NB,
More than a few hobbyist USB oscilloscope+SigGen tools use an FPGA+CPU
topology since it so clearly brings down the build cost.


[Edited on 26-9-2010 by arsphenamine]
View user's profile View All Posts By User
12AX7
Post Harlot
*****




Posts: 4803
Registered: 8-3-2005
Location: oscillating
Member Is Offline

Mood: informative

[*] posted on 26-9-2010 at 10:09


Quote: Originally posted by arsphenamine  
@12AX7
I agree that the johnson noise for a 500Hz window is quite low,
but neither the initial preamplification nor the saddle coil
will be that notchy -- the preamp will necessarily see a
weak signal at the Larmor frequency. The net amplification required
before the FID signal is downconverted may be enough to
make noise a factor.


Nope, bandwidth is bandwidth. If the coil's bandwidth is 400kHz (i.e., Q ~ 100), then the converter picks up only twice the noise, because of the in-band noise (i.e., 40.0000 to 40.0005 MHz) and the image (for a 1kHz IF and 39.9990 MHz LO, the 39.9980 to 39.9975 MHz band). If better filtering and several conversion stages are used, the images can be rejected much better and noise will be nominal.

Then you have to look at the contributions from oscillator, converter and amplifier, since extra stages makes for extra noise. A noisy converter may be worse than picking up the image.

Anyway, noise is evenly distributed, so bandwidth has absolutely, positively no effect on the NMR signal itself, because the FFT looks at slices of narrow bandwidth (perhaps 0.1Hz). If there's noise up at 2kHz or down at 0Hz, we just don't even care, because it's in some far off bin that we aren't even looking at.

Quote:

re: internal ADC suck-osity, oversampling mitigates that 2 LSB error
if you are willing to wait for it, although 16x oversampling is
admittedly (cough!) suboptimal.


2LSB error cannot be corrected by oversampling, but it can be corrected by calibration (using a piecewise-linear or polynomial fit, or conversion table), and quantisation improved somewhat by dithering. Statistics always wins, and you need exorbitant amounts of oversampling to turn a crappy 12 bit ADC into a good 16 bit. To the tune 64x, plus the extra DSP filtering.

Quote:
re: bit banging any protocol
Get serious.
It's a WOMBAT.
If your MCU can't handle USB, find one that DOES.
Drool-proofed $20 OTC implementations abound.


No, you get serious. Why pay twenty fucking bucks for something free?
http://www.obdev.at/products/vusb/index.html
Bit bang an ATtiny, that will give all the power you need for controlling the DDS and pulse gen. No ADC or DSP is necessary.

Quote:
There are abundant implementations of FFT code for x86 processors
and it would be good to take advantage of them, FFTW is one fine example.
Unless you like endlessly adjusting an embedded FFT implementation for the
application, it is simpler to use proven code as a pro-active hedge against
the "Shit Happens" Law.


So what the fuck? You have no confidence in analog circuitry at all (an unfortunate sign of the times), and you have no confidence in software either! What do you even trust? It's no wonder you're bouncing around in this thread, suggesting the waste of money on expensive unobtainium unsuited to the task!

This is a bizarre forum. To begin with, chemists have a peculiar arrogance, comparable to a physicist's, and not entirely undeserved, given the large amount of wrote knowledge required to work in the field. The peculiarity, however, is that they assume their arrogance extends to all fields, even fields they are sometimes trivially incompetent in (global warming, electronics, mechanics, etc.). This has been seen time and time again on this forum.

What defense do I have against such people? Perhaps I should just assert my own arrogance with an equally immalliable fist. In just a few months, I will officially be an Engineer, that's with a capital 'EE', and you will have no choice whatsoever but to take my word as the Holy, Certified Truth. You may have arrogance in your own field, but I demand nothing less on my home turf!

I say this not so much for this thread, which I admit has already had some delightful turns, but for other members who have crossed me before. There is something to be said, and I want to bring it into the light.

Tim




Seven Transistor Labs LLC http://seventransistorlabs.com/
Electronic Design, from Concept to Layout.
Need engineering assistance? Drop me a message!
View user's profile Visit user's homepage View All Posts By User This user has MSN Messenger
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 12:25


@12AX7

re: bit banging
Belatedly, it occurs to me that you may have a different conception
of bit banging than was defined in the early days of expensive UARTs
when bit banging meant establishing bit periods by software timing loops.

It's a great way to turn a small preemptive multitasking OS into a
cooperative multitasker. Writing interrupt handlers for a decade or so will
sensitize you to unmaintainable WOMBATS, your own and that of others.

re: Ignorance of software
Heh! (snicker, chortle)

The more you work with software, the less you trust it.
I trust some software much more than others.

re: expensive unobtainium
You may have confused me with someone else, or misconstrued what I
have written. The fractured spelling 'cheep' has appeared more than
once in my posts. I concede your right to the misapprehension but would
appreciate your aiming that stream of urine somewhere else.:)
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 14:42


@12AX7,

I'm neither a chemist or an engineer, if what I write comes across as arrogant, then so be it, it most assuredly ain't intentional (I'm actually trying to learn this shit), that said I am "apparently" an arrogant SOB to start with.

For mine the sooner the signal is digitized the sooner it can be dealt with programmatically. The implementation of several algorithm's to reduce echo/noise/etc. as well as averaging the signal response sets. I'm not choosing the PIC32 because it will be optimal, but because it is cheap, available with built-in USB 2.0 for programming and is ready to go, plus it is certainly should be able to cope with what we require of it.

I'm actually wondering why we cannot do what used to be done with the Atmega/PIC controllers before and upload to them a digitized representation of our signal, frequency, signal-shape and duration in hex-codes, then push that through a DAC, then a low-pass filter. That would give us the signal we need with the duration, without the need for digital synthesis.

Here is a tutorial on using the PWM channels (1 or 2) to generate a sine wave, then there are several pages on doing so programmatically with the PIC18 (Example 1 & example 2). Smoothing out the resultant wave would be simple enough, it would also make the best possible use of what is on the board, instead of just arbitrarily adding more electronics when they aren't necessary.

Here is a single-chip MCU+Transmitter for the range we want (27-960MHz) which could presumably take in the timing signal from the PIC32 (it is an SOIC-14 Chip). IThey are ~$2.50US/ea in single quantities.

[Edited on 27-9-2010 by un0me2]




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1281
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 26-9-2010 at 18:15


I'd just like to add the benefit of my experience with coding USB on micros : avoid if you can. It took two of us three months to create a working USB mouse device (using window's inbuilt HID driver). Along the way we created a device that put windows into an endless reboot cycle. If I were building this NMR device I would use high speed serial port with an OTC USB-Serial converter (given that so few PCs have RS232 these days). Its possible to go to 4Mbit/s with these (using a quality one). Bog standard serial is dead simple to send and recieve, And the "serial port" in the PC will buffer the data until windows gets around to storing it.
Unless, of course, you really really want to learn about USB.



[Edited on 27-9-2010 by Twospoons]




Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 20:06


OH SHIT, you tell me that AFTER I ordered the USB 2.0 programmable PIC32? :o

Ok, well I guess I'm about to learn a whole lot about the problem:(




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 20:40


Quote: Originally posted by un0me2  
OH SHIT, you tell me that AFTER I ordered the USB 2.0 programmable PIC32? :o

Ok, well I guess I'm about to learn a whole lot about the problem:(

If it's the Microchip PIC32 development kit , it looks as if they already did
the USB software API for you.

Unless you are crufting up a USB bootloader or mouse handler on a PIC12
(see "Trial Of Job") or some such, I wouldn't worry.

Microchip gives you source code for libraries and examples in the order
of 100's of Megs. Surely, there are pertinent USB examples in the
Wired Communications section.

Get USB protocol basics at Wikipedia. The primary specs are at usb.org.
Concentrate on USB 2.0 since so little USB 3.0 hardware exists.

Otherwise, have no fear and be patient.
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 26-9-2010 at 22:23


There are some interesting files in the Microchip examples for certain, there is also a book (you'll find it on a torrent I'm sure;), Newnes, 'Programming 32-Bit Microcontrollers in C: Exploring the PIC32' 2008 or something like that).

I just found a pertinent link regarding the use of the PIC32's PWM ports for sine wave generation. If we could modify that for the relevant frequency(s) (supposing someone one day someone wants to try it with 2H/D, 13C, etc), that would save some board space, extra-chip programming, etc. It would also make fuller use of the capacity of what is already on the board.:)

PS Silabs also have an 8-bit Analogue-Heavy MCU that has a multiplexed 8-channel 24-bit ADC, with 2 8-bit DACS (C8051F35X NB uses the common 8051 core).

That with the MAX2306 should be a winner, 8 24-bit samples per xx ns, of a upconverted/downconverted, filtered radio frequency. It would actually probably be able to be shunted into the same space as the PIC32 (it is a 32KB chip itself, with 100 pins in the same package). Either replace the package or build a new board (sounds like fun, eh?) with the UART-USB2 210X Family.

[Edited on 27-9-2010 by un0me2]




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1281
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 27-9-2010 at 14:09


I can't say for the Microchip solution, but we were using Silabs parts. Silabs did provide libraries and a driver for USB, but frankly they weren't very good. Example : my co-worker re-wrote the controller code to include 3 endpoints instead of just one, and at the same time cut the code size in half!
This was over 5 years ago, so hopefully things have improved.

On another note, using a 24 bit converter may let you get away with less signal amplification, and hence a lower overall noise figure. I know thats one of the things Silabs were pushing with their 24 bit converter. I think we still have the dev kit kicking around somewhere ...




Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 27-9-2010 at 18:54


Ok, you wouldn't happen to still have access to the adapted code? Because I intend to utilize Silabs component (USB 2.0 - UART) when I try and build a single board version of this - quite simply the 2 DAC's on the MCU pose an interesting question as to whether one could programmatically form a sine-wave by modifying the squared/sawtooth waveform & frequency by passing the square/sawtooth waveform through an amplifier IC with dedicated filters & a shitload more. That would take care of getting the amplitude of the signal (in dB) up while avoiding the need for DDS chips

Any further gripes with the SILABS components? I'd prefer to know what to be on guard for before I start:)




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1281
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 27-9-2010 at 20:55


Somehow I knew you'd ask - sorry the code is not mine to give away. I've no other gripes - in fact I rather like the Silabs micros, given they have onboard regulators and trimmed oscillators, and a rather nifty crossbar switch that lets you move the peripherals around the pins. I guess my point is simply that company supplied code isn't always that great. You will probably find the UART code and driver work fine (our needs were a little more complex) - silabs have been doing USB-UART converters for years.



Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 27-9-2010 at 22:22


Thanks, you had to know I'd ask on this board:D With the dual 8-bit DAC's, couldn't we feed them directly into a Class D Amplifier as a full on, full off, waveform @ the appropriate frequency (or a modification thereof)? If so, 12V can give 40W (2 x 20W - MAXIM9744 of power, as an approximation of a sine wave. That would be MAXIM IC's for the front & back end, with the USB & MCU dealt with by Silabs IC's.



quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1281
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 28-9-2010 at 14:01


I getting confused here - would you mind posting a complete summary of the system parameters? eg field strength, frequencies, power levels etc. Its all got a bit scattered through the thread, and I can't quite work out the current state-of-play. Don't want to make stupid suggestions based on wrong data ...



Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 15:39


Ok, as it stands at present

1. The system will be utilizing a 1T (actually 0.989 ± 0.001T) field, with the proton frequency being ~43-44MHz, based upon a modified Halbach Array.

2. The system will be utilizing the simplest possible electronic spectrometer

(a) the original will be based upon a PIC32 Board from Sparkfun (availability)

(b) the next step will be a bread board design based upon PCB breakouts for the various chip packages, including, if needed, power supply, USB 2.0 (Silabs USB-UART), MCU (Silabs), Back End (MAX2306 + multiplexed 8 channel, 24-bit ADC's on the MCU), Front-End is based on a simple Class D Amplifier (MAX97xx), which can presumably take in a Digital signal (given the use of the same by the Class D) to output a sine-wave at nW to the speaker. The DAC can be programmed to give whatever frequency (based upon the onboard clocks) / speed of pulse, the length of the pulse can also be programmed based upon user input.

(c) the final design will be a fully custom designed PCB with design based upon the changes that end up being made in part (a) or (b). This may well include small Golay coils to improve the homogeneity of the field, we'll see if that is necessary, if it is a DAC would be useful.

If possible I'd like to avoid using excessive power, there are 2-3W available using a 3.3V-5V supply which is available from the USB 2.0 if I am reading the specs correctly.

I am trying to optimize the design so as to avoid under-utilization of the components, and to ensure the fullest possible utilization of what is on the board, while ensuring the highest possible sample bit-rate & speed (the Silabs MCU @ 24-bit is the best I've found for the price). The Digital Frequency Synthesis utilizing one of the DAC channels coupled with a D Class Amplifier (which already have to transform a digital to an analog signal) removes the need for external frequency synthesis.





quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 17:22


How to do you generate the 42.5MHz signal for excitation and downconversion?
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 18:06


With the Digital to Analog Converter /(ADC Tutorial, PWM Tutorial, Analog Devices, App. Note.928). Particularly with the Class D Amplifiers, which should take the rough edges off, you could pretty much just output a triangular waveform to the Amp, which would then convert it to an amplified analog signal. Here is a primer on Digital Synthesis (a Tutorial and a primer).

The point is that it is probably inefficient to filter it too much between the DAC & a Class D Amplifier, which essentially converts it back to digital, amplifies it and outputs it as an amplified analog signal. It has to be measured in Watts because it cannot be measured in dB, it is inaudible.




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 18:44


If your 42.5MHz signal is generated by PWM, what are the pulse widths and clock rate of the PWM output?

Which chip's PWM had you planned on using?
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 20:09


With the PIC I'll have to use the PWM ports for Digital Synthesis, with the other chip (the Silabs MCU) one of the DAC's will be utilized. I haven't had a chance to look at the programming for the PIC, but there are several examples of using smaller PIC chips for sine wave generation.



quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 21:05


Look at the PWM clock frequencies required to generate a given sine wave frequency.

The PWM tutorial demonstrates how to generate a 4kHz sine by pumping a low pass filter at 30kHz or 500kHz.

That suggests that a 42.5MHz sine might require a ~320MHz PWM clock.

For one, if the internal CPU clock on the PIC32 is only 80MHz, there may be difficulties generating the 42.5MHz.
And two, the processor crystal's accuracy would determine that of the generated clock.

Is a DDS chip completely out of consideration, despite Analog Device's seeming monopoly on low RF DDS IC market?
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1281
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 28-9-2010 at 21:18


Quote: Originally posted by arsphenamine  



For one, if the internal CPU clock on the PIC32 is only 80MHz, there may be difficulties generating the 42.5MHz.
And two, the processor crystal's accuracy would determine that of the generated clock.


Seconded: 80MHz clock will let you create 300kHz PWM with 8 bit resolution.
Crystal accuracy should not be an issue, ordinary crystals give 30ppm stability, a TCXO is even better (1-2ppm). Or, for lots of $, you can use an ovenised crystal (better than 1 ppb!). Phase noise might be more of an issue.

Also, that maxim amp is an audio amp and wont work at 40MHz.

Its looking more and more like DDS is your best bet. Or at least a fractional N synthesiser.

And I hope you realise that the 24 bit Silabs converter will only do 1ksps?



[Edited on 29-9-2010 by Twospoons]




Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
un0me2
aliced25 sock puppet
***




Posts: 205
Registered: 3-2-2010
Member Is Offline

Mood: No Mood

[*] posted on 28-9-2010 at 21:43


Righto, what about DS1085L? That will do the job in terms of the frequency?

OK, what amplifier is needed?

As to the 24-bit resolution @1ksps, we are back to the trade-off that started the argument, a faster sampling rate or better resolution?




quam temere in nosmet legem sancimus iniquam
View user's profile View All Posts By User
densest
Hazard to Others
***




Posts: 359
Registered: 1-10-2005
Location: in the lehr
Member Is Offline

Mood: slowly warming to strain point

[*] posted on 28-9-2010 at 22:10


The DS1085 spec doesn't include short-term frequency stability or phase noise. That suggests it isn't very good.
View user's profile View All Posts By User
arsphenamine
Hazard to Others
***




Posts: 236
Registered: 12-8-2010
Location: I smell horses, Maryland, USA
Member Is Offline

Mood: No Mood

[*] posted on 29-9-2010 at 06:45


Quote: Originally posted by densest  
The DS1085 spec doesn't include short-term frequency stability or phase noise. That suggests it isn't very good.
Agreed. The accuracy is not good enough for the application, either.
It synthesizes the frequency but has no external crystal.

If the clock source is selected for accuracy, the Maxim-IC tables
turn up chips like the MAX9450 family and MAX3674; purchased directly,
they cost $24 and $20 respectively, or nothing at all if you can
get a free sample.
View user's profile View All Posts By User
 Pages:  1  ..  3    5    7  ..  12

  Go To Top