NIM-duino as ersatz counter-ratemeter (counts up to ~50000 counts per second)

Semi-permanent mounting and wiring configuration of the Arduino/Ruggeduino in a NIM casette.

Figure 1: Semi-permanent configuration of the Arduino/Ruggeduino in a NIM casette.

The Bonse Hart USAXS instrument is coming along nicely, and the expectation is that we can start using X-rays pretty soon. One missing element in my detector electronics chain, however, is a counter and rate-meter. Normally, one would buy these as NIM modules, in which case they are very nice, reliable and expensive (for example the Canberra 512 one which will cost on the order of 5 kEuro, and a similarly priced ratemeter module would be required as well). Alas, such money is not available in my budget at this time, so an alternative solution had to be found.

Those of you who are following my Twitter stream (user @drheaddamage) will have seen the occasional tweet on the solution: letting the counting and ratemeting be done by an Arduino (or rather, a Ruggeduino variant, which is an Arduino for stupid people like me who like to make many mistakes in electronics engineering). I am happy to say that the project is now pretty much complete, with only the actual integration in the detection chain left to do (edit: this has now been done, and it works if the 100kOhm resistor connected to the BNC is replaced by a 120 Ohm resistor. Otherwise it will not detect the short pulses emanating from the Single Channel Analyser (SCA) module.).

The concept is straightforward: Sense the rising edge of a pulse coming in on one pin and count it. Simultaneously, keep track of the time spent actually counting (i.e. not the time spent on other administrative tasks) and be ready to export this information through the serial port to the controlling computer.

Hand-drawn connection schematic for fitting the Ruggeduino/Arduino into a NIM module

Hand-drawn connection schematic for fitting the Ruggeduino/Arduino into a NIM module

As it turns out, this is easy to do with an Arduino Uno, as it has two pins that can do event-based operations. Simple wiring, with the occasional resistor thrown in to help keep things under control (though this is not strictly required in the Ruggeduino) and a lot of crossed fingers when it is actually put into action may just do the trick.

The attached picture (Figure 1) shows the Arduino in its semi-permanent state, mounted in a NIM module. This module used to be an Ortec high voltage power supply, but turned out to be broken. The potentiometer, LEDs, switches and NIM and BNC connector have been reused. Testing with a signal generator showed a counting capability up to about 100000 counts per second, which is also pretty much the limit of my scintillation counter. Serial overhead seems to be very small so intermediate readout of the counter is no problem. I, for one, am quite excited to see if this all will work!

If anyone is interested in the code, it can be downloaded here: Counter_and_ratemeter_v0p2. It is not neat code, but I tried to keep it organised and legible. The connection diagram is hand-drawn and shown in Figure 2.

I have to agree with Pete Jemian, who noted that “the prospect of low-cost control systems involving Linux, EPICS, and the Raspberry Pi with Arduino or BeagleBone I/O boards has begun a new generation in value automation systems”. Let’s see what other (ab-)uses we can find for these things in the X-ray sciences! As always, questions and comments are very welcome below.

Share

A review of data collection and correction procedures.

Following my previous work in progress detailing the data correction steps to obtain good data, I finally had the chance to write this down in a review article. This review article (http://arxiv.org/abs/1306.0637) has been submitted on Monday. After it has been reviewed and (hopefully) published in the journal, I will ensure that that latest version is available as an open access paper (thanks to funds from NIMS/ICYS). Until then, please enjoy the pre-submission version and as always feel free to comment!

 

Share

Paper highlight, Madrid meeting and Detector electronics

A few things came up in the last two weeks which may be of interest.

Firstly, I will be in Madrid for a magnesium alloys conference next week Tuesday to Friday. If anyone wants to meet up there, please let me know through e-mail (check the “about” page), message below or send me a direct message on Twitter (@drheaddamage).

Then there was a paper which made me quite happy. This paper by Brûlet discusses in detail how to correct for samples sandwiched between two sample-holder walls. It contains a detailed description of the sample direction-dependent absorption (derived separately in a previous post here, and further discussed here for capillaries and spherical samples here). It furthermore indicates that you have to be careful with such sandwiched samples, as the sample receives an attenuated  radiation flux from the first wall. Secondly, the background scattering from the upstream wall is absorbed with direction-dependence by the sample and both walls, the sample-scattered radiation absorbed with direction dependence by the sample and the downstream wall, and the latter again scattering and exhibiting direction-dependent absorption from itself. As you can see, it is a very well put together experimental consideration. Definitely one to add to the reference list!

Lastly I wanted to give a quick update on Bonse Hart instrument construction status. I have been handed a scintillation detector tube to use by one of my advisors. After scrounging through some storerooms in the building, I came across some useful stuff:

Scrounged from the storerooms!

Scrounged from the storerooms!

The owner was quick to point out that it was slightly aged (15 years) but that I was welcome to take it. I collected the following bits: a NIM bin with some NIM modules (bottom left, the modules are a Tennelec high voltage power supply, Ortec amplifier and NAIG single channel analyser), an oscilloscope (top right), a fancy multimeter (top left) and a power supply (bottom right). The beefy power supply is overkill for powering the small detector preamplifier, but it was what I could find. The NIM stuff, for those not familiar with it, is a modular system for analog signal processing developed in the 1960′s. It can house a wide variety of modules, each geared towards a specific task. I am still missing two modules: a pulse counter and a ratemeter (which come at about 5 kEuro each), but I figure I may abuse an Arduino Uno to do those tasks for me if I do not stumble across another stash somewhere. Still, I am very happy to have come across the most tricky bits. Soon I will get the chance to try it all out! See you then!

Share

Public day demonstration

I think it is safe to say that “everyone” is familiar with electron microscopy for looking at small things, but the same cannot be said for small-angle scattering. Introducing more people to the wonderful world of small-angle scattering may be one of the ways of getting more support for and interest in the technique. With this in mind, and with some contacts in the PR department, we managed to get last-minute approval to do a demonstration at the public day at NIMS.

hairlaserteam

The team of the 2013 NIMS public day with Martin, me, Novi and Ryo. Missing from the picture is Julian.

The plan was to have people measure their own hair diameter using a laser in a similar way as demonstrated before in these youtube videos. As I was not expecting more than a few visitors per hour, 5 minutes per visitor was considered a suitable amount of time. To help them, we prepared a step-by-step instruction sheet and some “tools” that the people could cut out and use for their experiment. The procedure was as follows:

  1. Visitors would be lured in by our blatant advertising to “measure the diameter of your hair using a laser!” (stuck in big letters on the wall, taking up lots of floor space and having a big screen with the program running on it. Also, we had foreigners at our desk in an otherwise very much Japanese event. There was even some Dutch candy!). Visitors would then be given an instruction sheet and some tools.
  2. They would cut out the tools (one target and one holder for their hair), find a hair and stick it on the paper. Surprisingly, almost everyone could spare one (or had one cut off by one of the staff), and they very much enjoyed the bit of manual labour of cutting out pieces of paper, sticking hair on it and so on.
  3. Going over to the laser, where the staff mounted the hair in front of the laser (which was a bit finicky work to get it to sit right) using a couple of paper clamps. The laser pointer was forced “on” using another paper clamp holding down the button (the laser pointer itself managed about half a day on a set of batteries, surprisingly).
  4. Clamping the target onto a clipboard stuck to a tripod, and aligning the central black spot on target with the laser pointer beam, the scattering from a hair becomes clearly visible. The clipboard was about 2m from the hair and laserpointer. At this point I would always take a moment to explain that the central spot was from the laserpointer, but the oscillations were coming from their hair (in my best Japanese).
  5. We would then ask them to draw arrows in the center of the oscillation spots. This is where it would most often go wrong, as people were unsure on where to draw the points and my Japanese would not be sufficient to explain this. Nevertheless, they had fun drawing points.
  6. Taking that piece of paper, I would take them to measure the required values: the distance from hair to the target (in meter, with a tape measure if there was time), the number of spots from the target center they could see, the distance from the target center to that last spot (in mm), and reading the wavelength from the laser (green=532 nm, now forever etched in my memory).
  7. Filling in these values in a Python program (available here) they were then given the diameter of their hair. In the beginning this was set to display the diameter in micrometer, but after an hour or two it became evident that that was not very well known with the public. We therefore changed this to mm. We had our Japanese staff stand at the computer, so he could explain a little about common hair diameters (European: 40 micron, Japanese: 80 micron with the occasional outlier at 110 or 120 micron). Significant digits and uncertainty were a bit of an issue, some wrote down all nine digits resulting from the calculation.

Before I tell a bit more about the experiences on the day, here are the tools you can use (conveniently in English and Japanese):

As this was the first time we did this, we had no idea what to expect. We shared the big lecture hall with three other demonstrations, which helped to draw people to us. We set up the demonstration in a slightly inefficient way, whereas we should have considered the flow of people through the steps. This was exacerbated by the sheer number of visitors. Visitors tended to come in groups of four or more (with the occasional elementary school class to make things really hectic), after which it would be quiet again. Overall, we “served” an estimated 70 people during the 6 hours, which were about 50% schoolchildren and about 50% adults. We had two to four people staffing the set-up at any time.

Ideas we have gained for next time include:

  • Setting up the tables a bit better, so that there can be a more logical flow from stage to stage (whilst still keeping it compact), and reserving a separate table for the cutting and sticking-work.
  • The set-up using commonly available bits and pieces worked in our favour. Some said they intended to repeat the experiment at home, showing that they noticed it consisted of nothing more than a laser pointer and some paper clamps.
  • If we prepare for groups we can explain only once for a group of four or five.
  • Staffed stages could be three stages (cutting, measuring and computation) or four stages (cutting, “laser”-ing, measuring, computation). Parallel laser stations would be preferred, perhaps of different wavelength.
  • A microscope table can be included for people who want to verify (which should be encouraged if there is time).
  • It would be nice if a form was printed with a picture of the measurement with maybe a picture of them, their hair oscillations and the “scientist”-guaranteed number (signatures and such).

I strongly encourage people to try this demonstration at their institute as it was good fun! We’ll do this next year again if we have the chance so do drop by if you have the chance!

Share

Build Your Own Instrument update: Making it cool

Some of you have asked about the current state of the Bonse-Hart USAXS instrument I have been building (reported here). Well, it has seen some progress here and there, though  there was no pressure to get it finished quickly as the X-ray generator was not working yet due to high-vacuum troubles.

Unfortunately, just when the offending x-ray generator components were replaced and the molybdenum rotating anode target was about to arrive, there was a bit of a snag. My advisor was fortunate enough to land a professorship at another place to focus on a very cool new development: compact neutron sources. Sadly, his imminent move meant that I would “lose” a very good colleague and advisor, and easy access to some of his good instruments which would follow him to his new position (though he did leave a large amount of really useful parts, almost enough to build a complete instrument!). The cooling system of the Bonse-Hart rotating anode generator had to go too, leaving me with a working rotating anode generator, but no way to cool it. His moving away got me a bit down but such is the way of science (“kenkyudo”, or 研究道): the path of you and your colleagues only runs parallel for a short time, so you better make the most out of it.

Anyway, ballpark figures for a cooling system come to about 20 kEuro which are slightly above my available budget. The one large budget proposal I had submitted came back negative (which I had pinned my hopes on), so that’s not going to be a solution. If I would have gotten it, I would have had the chance to buy a cooling system and maybe even one of these microfocus X-ray sources to see if the Bonse-Hart instrument would work on those relatively inexpensive radiation sources (which come to about 75-100 kEuro). Coolness aside, it would have been genuinely useful to find out if such sources are a viable option.

Not all is lost, though, and it will only take some time to find a suitable solution. In short the Bonse-Hart instrument is aligned with a laser now, and even has some shielding. It should now be ready, though it still lacks a detection system. Help is always welcome, though, so please feel free to drop me a line in the comments or find my e-mail address on the “About Me”-page. Until then, here is a picture of the instrument in its current state showing part of the outer radiation shielding in place:

Bonse-Hart today

Happy Scattering!

Share

Conference plan and a new poster…

A day later than planned, but here’s another post…

I am planning to speak at the TMS Magnesium Workshop Madrid 2013, some time during the conference lasting from May 21 to May 25. During this conference I will be focusing on the results we obtained for ex-situ and the preliminary in-situ results studying the growth of precipitates in MgZn alloys. Naturally, I will be heavily plugging SAXS and the MC analysis methods. If you are in Madrid or at the conference at that time and want to meet, please leave a message…

Secondly, For a recent conference I had the chance to make another poster. It has been a while since I posted any posters on this site, so if you want to get an idea what they look like these days, take a look here. The design is still a bit full of text but in a font large enough to read. Additionally, the text is laid out in a newspaper column-format to make it easier on the eye to move from the end of one line to the beginning of the next line (some info here). The whitespace at the right-hand side should make it easier to distinguish the section headers, and given that this poster was presented in Japan, where comics are read from right to left, this poster has section headers rightmost, followed by an image left of the header, and then two columns of text (which are read left-to-right, unfortunately breaking the mould). The introduction and conclusion section is typeset to a larger font as this is what most people are interested in, and the authors and affiliations is at the bottom (because that is what people should remember at the end). The space at the bottom should contain my business cards in a pocket so people can grab one if I am not around. Lastly, the background is meant to appeal at large distance for its colour, but set to a transparency which does not hinder reading at close distances.

Despite these considerations, the poster has not enjoyed much success, so for the next one I may employ a different style.

 

Share

Monte-Carlo: now in 2D!

Small-angle scattering analysis has never been easy for those working with oriented nanostructures (e.g. fibres, processed polymers, rolled metal alloys), whose structure may lead to anisotropic small-angle scattering. Upon the collection of such 2D scattering patterns, one can integrate thin pie-slices of the data to obtain 1D curves and analyse them in the same way as “normal”, isotropic scattering patterns. This way, however, important cross-correlation information is lost. Alternative full-pattern fitting methods have been developed (amongst others during my Ph.D. studies), but they are complicated to tune to the system at hand and can be quite unstable in least-squares optimisations.

One alternative is to analyse the scattering pattern by using Norbert Stribeck‘s 2D inversion method to obtain a two-dimensional pair-correlation function. Unfortunately, correlation functions are not always the easiest for the researcher to understand. Recently, I presented a 1D Monte Carlo method for obtaining form-free particle size distributions from isotropic scattering patterns, which —as it turns out— can be adapted to analyse anisotropic scattering patterns as well. The first results of this two-dimensional Monte Carlo analysis was presented at the SAS2012 conference, at which it was shown that it can obtain three distributions: the width and length distribution and an orientation distribution.

These initial results were written down for the conference proceedings, which have been submitted recently. The pre-submission manuscript is available (as before) on ArXiv here. Now is the time to try to apply this method to a variety of samples, so if you are working with oriented structures (and their scattering) and you are interested, please drop me a line!

 

Share

Papers! One of mine and one on detector data read-in

It has been a long time in the making, but now the day has finally come where the 1D Monte Carlo method has been published! To top it off, the publication is open access (courtesy of my current institute: NIMS), and has a wicked showcase document as supplementary material. Feel (very) free to check it out here!

In short: the MC method can retrieve form-free particle size distributions from isotropic scattering patterns, complete with uncertainties. There is more to it than that, but the details are in the paper. The Python 2.7 code is available in a Git repository as indicated in this post, available under a creative commons attribution sharealike license.

In the same J. Appl. Cryst. edition that my paper appears in, there is another paper which caught my interest. This is a paper by E. B. Knudsen, et al., which presents a bunch of code under the name of FabIO that can be used in Python to read in detector images (under a GPL license). There is even some code there for the more obscure of image formats, with improvements to follow. For me, this is part of what I was looking for to augment my own procedures, so I really appreciate it when others make their stuff available with a suitable license!

That FabIO package is part of larger programs for XRD and data reduction, respectively. Given that this is a program which is sustained by the efforts of a variety of user-driven institutes (ESRF, for example), I am very much looking forward to see which direction it will be taken into. One of the authors has assured me that if there is a need and an example (say, for supporting an imageplate image format or some of the stranger wire-arrays), they are more than willing to implement that particular image format. Naturally, that open-source project is available for collaborative efforts as well!

 

Share

Job offer: Anything you want!

It is that time of the season again, when the group I am working in is hiring. In short: if you are a fresh Ph.D. graduate or a post-doc within 10 years of obtaining your Ph.D., and you want to do your own research with at least a tenuous link to materials science, this is the place for you. The job opening is advertised here: http://www.nims.go.jp/icys/recruitment.html and the application deadline is March 29.

In a little more detail, this is what it entails:

  • The program is intended to offer tenure-track positions to scientists, i.e. if you are in ICYS (this group) and apply for a permanent position at NIMS (the institute where the group is located), you have automatically passed the first round of application. Despite that, many people use this as a stepping stone for positions in other institutes and universities as well.
  • Officially, the ICYS program is intended to improve communication between foreigners and Japanese scientists.
  • It is a project for 2 years, with a possible (not so difficult) extension to three years.
  • The salary is quite decent, in line with the scandinavian salaries after subtraction of tax.
  • You have a research budget of 20 million yen per year (about 20kEuro/year) for anything you want: travel, stuff and even Open Access fees. You can also apply for one of the many funds available in Japan if you need more money.
  • You get secretarial support to take care of most of the paperwork, and further support for getting settled in Japan by another organisation.
  • You are assigned two “advisers”, but it is up to you how much you use them. They can be useful for getting contacts or access to instruments. Essentially you are free to research anything you want, you are an independent scientist. They may also help you get a permanent position.
  • Tsukuba is a great city to live in: quite inexpensive and only 45 minutes by train from Akihabara in the heart of Tokyo.
  • The ICYS group is definitely fun, with young people from all over the world, so apply!

Now I understand that it can be quite tricky to think what projects would be considered, so let me give some examples of what some of the ICYS researchers do:

  1. One researcher is developing new, stable field-effect electron sources for electron microscopes from LaB6 nanowires.
  2. Another is working on a theoretical project calculating magnetic structures, and a third is measuring and simulating magnetic behaviour at various temperatures of permanent magnets.
  3. One is calculating the photonic properties of a variety of hypothetical and practical situations
  4. Some are working on developing better organic and inorganic solar cells
  5. Others are studying phosphors and ways of improving them
  6. There have been chemists working on fundamental behaviour of functionalized materials in liquids, and another working on practical, green synthesis routes for a variety of industrially relevant materials.
  7. There are those of us improving the methods used for studying materials, such as improving SPM systems for nanofabrication and analysis and my research to improve the SAXS methodology.
  8. There are many working on polymers and biological systems as well, but they work in another building so I am not fully aware of what they do.

So you can research a wide variety of topics, as long as it somehow has something to do with materials science. I found this place a pleasure to work at, with uncommon amounts of freedom. No-one is standing over my shoulder which allowed me to do weird things like spend many days in the workshop milling, drilling and cutting my own instrument. I can go to whatever conference I like, I can collaborate with whomever I want. NIMS also has an enormous amount of instrumentation available, some quite specialised, and money doesn’t seem to be much of an issue.

So, if you want to work here, and are not yet convinced by what I wrote, if you have any further questions, please drop me a line.

Share