The Use of Microcontrollers by Scientists in Experimental Research Applications

If the microcontrollers are devices quite easy to use for experts in electronics, a scientist devoted to different research topics from digital electronics is generally totally unable to develop and use these complex components. Most of the time, the researcher is looking for simple devices able to control different parameters during his experimentation. He is obliged in this case to request the intervention of an expert in electronics to develop such a device and the result is sometimes different from the precise initial requirement. Nowadays, it is possible to find on the market, simple units able to satisfy the requirements of the scientist and easy enough to be manipulated by him in specific applications. The purpose of this paper is to present some of these devices and to compare their possibilities and the ways to use them. These devices are compared in optically stimulated dosimetry with applications found in external dosimetry, interventional radiology, nuclear medicine and space dosimetry.


Introduction
In many cases, the experimentalist is challenged or even confronted in his research to small but important questions such as: what is the value of this voltage?Was it stable during the experiment?How many times did this effect appear? ... All these questions require the use of complex and expensive material such as digital voltmeter or temperature sensors.Often this material is not available during the experimentation.Most of the time, a simple measurement device should be enough because it is not the specific value of the parameter, but its evolution which is impor-tant to measure or just to follow.The aim of this paper is to compare different products found on the market, which could be used by the scientist to easily reach his goal.Some are difficult to use and others are easy to mount and program.The question is to know which is best adapted at the moment of the experiment.The purpose of this paper is to show to the scientist non specialist in microcontrollers that measurements are possible with simple material dedicated without the knowledge of this complex science of advanced digital electronics.The work described here has been done in the framework of the development of measurement devices used for research in radiation protection.For this reason, a small description of the laboratory is first done.

Description of the Laboratory for External Dosimetry
When the first Belgian Reactor became operational in 1956, the film dosimeter was used to measure the effective doses in the body, the skin and the fingers due to external radiation with γ-, X-, β-rays and neutrons.These detectors were also used in case of criticality accident.In 1986, it was replaced by the thermoluminescent detector (TLD) using three LiF crystals in a one-inch diameter plastic box.The advantages of the TLD were a larger dynamic range, extending the irradiation period to one month instead of one week and an easier technique to read the detectors.The TLD technique is used today for routine measurements and accepted as legal mean for the assessment of the external dose received by the workers.The detectors (MTS type, model TLD-100) are measured by counting the light emitted when the crystal is heated to a constant temperature of 190˚C during 13 seconds, a measurement made by an "Automatic TLD reader 4000" developed by NRG-Re in Arnhem, Netherlands.Six thousand detectors batches are measured every month.The Belgian Nuclear Research Centre (SCK•CEN) also participates in different medical and space research programs.The research is oriented to the control of practitioners in medical applications (as interventional radioscopy) and in the measurement of radiation environment found in the International Space Station.
For about ten years, the laboratory is also using the optically stimulated luminescence (OSL) technique for dosimetry.The advantages of OSL are the rapidity, the cost effectiveness and the very easy development of devices to measure the detectors.The first stimulation device used for OSL measurements was an argon laser with a very stable power output.Afterwards, a modular device, called Apollo, has been developed to extend the application of OSL dosimetry to other detector types (BeO) and to other applications (retrospective dosimetry,…).
It is in this environment that the development of acquisition systems was required to control the stability of the stimulation light or other parameters in the experiments (temperature, time, vibration…).The next paragraphs will describe several equipment's which have been tested for the automatic measurement and control of these parameters.The conclusions we can take for the choice of a system in each situation will be drawn.We will describe and make some comments on the way these devices were developed, tested and used.

Request for Electronic Control of the Development of OSL Dosimetry
When the technique of OSL was initiated, the different parameters required a control:

Coordination of the Measurement and the Illumination (Stimulation)
When an OSL crystal is measured, all other sources of light must be eliminated.The ambient light is shut off a fraction of a second before the measurement.This required a control of the timing because the diaphragms used to open the photomultiplier must initiate the opening when all light is completely cut off.The diaphragm of the laser has to be open a quarter of a second later (Figure 1).

Control of the Stimulation Light Intensity
The laser light intensity of an ionized argon laser is very stable, according to the data sheet of the device.A control of this stability is done with an appropriate device, inexpensive and easy to program and to use (see further).

Measurement of Light Intensity
The measurement of light intensity is also important for special applications.The measurement of the optical transmittance of a detector crystal is a typical application in this type of measurement.

Actions Controlled by Computer
Different means to control the excitation of detectors by light were used: Diaphragm or Nitinol (a shape memory metallic wire) for instance.These devices were remotely controlled by the computer.
All these examples show the necessity to have a mean, easily employed, to control or measure different the parameters.

Comparing Different MCUs and a USB Card
To control a device, we have two main approaches: the use of a microcontroller unit (MCU) or the use of a USB card.There is a very big choice for MCUs and it is not possible to compare all the models.The purpose here is to compare four different models of MCU and a USB card which were suitable for our applications: the 16F628 from Microchip, the Basic Stamp from Parallax, the Basic Atom from BASIC MICRO, the Propeller also from Parallax and the USB card K8055 from Parallax.The first one is a microcontroller and the models 2, 3 and 4 are circuits with embedded controller.The last one is a complete electronic card with all components and immediately controlled by a personal computer.

The PIC from Microchip (16F628, 16F627 and 16F630)
These devices are very small and very cheap 8-bit MCU [1].They are programmed in assembly language which is very difficult to use for a neophyte even for the basic commands.They can be used for simple commands such as diaphragm controls, but more complex applications such as data acquisition require a real skill to program these devices.It is not recommended for a scientist not specialized in MCU digital electronics.Figure 1 shows an example of application of the 16F628 for the control of an electrical diaphragm in a device developed for OSL dosimetry.When the acquisition sequence is initiated, the measurement device (here a photomultiplier module from SENS TECH inc.) sends a positive signal to the MCU.This one waits for 0.5 second and send a small current to an opto-coupler which orders the diaphragm to open.When the acquisition is finished, the signal goes to zero and the MCU closes immediately the diaphragm.
The required parameter in this application is the timing between the acquisition and the operation of the diaphragm.Even in this case, programming the chip is not a straightforward action.The program required for this action is presented in Figure 2 and is to be compared to the program written for the Propeller presented later.
The PIC 16F630, has a smaller footprint than the 16F628 (14 pins instead of 16) and present some other advantages.Both can work with internal oscillator to generate the clock pulses and require nearly the same pro-gram to work.The 16F627 is the 16F628 with a smaller internal flash memory for the program (1024 words instead of 2048).The data memories are the same (224 bytes of SRAM and 128 bytes of EEPROM).The 16F630 has smaller flash and SRAM memories).The PIC always requires a special card interfacing it to the PC to program the device.Different cards are available on the market (pickit1, pickit 2,…).These cards are sometimes difficult to use.The best card found on the market are the K8048, developed by Velleman ® .

The Basic Stamp
There is wide family of Basic stamp units (BS1, BS2, BS2p, BS2px, …).In fact the basic stamp is not an MCU alone, but a small printed circuit board with an MCU (containing only an interpreter programmed in machine language), a clock (resonator), an EEprom, a power supply and different connectors for input/output.The result is a small "computer" easy to install and very easy to program with a dedicated Basic program.This concept has made the success of this product in spite of its price.When a single element is to be used, this is the best choice because in less than one hour, an operational product is ready and this spared time is worth the high cost for a non-specialist in MCU.Another quality of the Basic Stamp is the user's manual which is very pedagogic for everyone.For the novice, we recommend the Basic Stamp 1 manual [2] which is freely downloadable from www.Parallax.comsite.On the same site, other documentations are available about all basic Stamps.BS1, the first product of Parallax is working with 8-bit words [2].This is much enough for many applications in experimental sciences, especially for automation like the control of the diaphragm described in Figure 2. The BS2 and all its variants (BS2,BS2e, BS2sx, -px, -p24,-p40, -pe) are working with 16-bit words.Each model has its particular advantages (such as PWM, I2C,… communication devices) and can have multiple applications in scientific applications.The most important characteristics common in all the Basic Stamps is the absence of interrupt.
Many programs are available in the Internet for free to use the different Basic Stamp for any applications.

The Basic Atom
The basic atom and the Basic Atom pro [3] are devices developed by Basic Micro as clones of the basic stamps with many common properties.They are also present in different forms (SIL or DIL pinout).The most important advantage of these products is that they all work with 32-bit words (even the Basic Atom One).A Basic Atom Pro 24 has been used to measure light intensity with a TAOS TSL230 light to a frequency modulator (Figure 3).This 32-bit processor is able to benefit the full resolution of the TSL230.The Figure 3 shows the simplicity of the wiring to connect the PC, the MCU and the TSL 230 to measure the light intensities according to two directions around the illuminated area of an OSL measurement device.The Figure 4 presents a result of this measurement.This diagram shows a very good homogeneity in the illumination of the measurement zone.
There are different models of the Basic Atom and several documentations are available on the site www.basicmicro.com.The Basic Atom pro 24 is now discontinued but the Basic ATOM Pro One Module is more easy to use and more powerful (32 bit, 8 I/O, 100000 Basic instructions per second) than the BS1 from Parallax ® .

Characteristics of Propeller ®
This product, the last MCU developed by Chip Gracey, a cofounder of Parallax Company, is completely different from the other Parallax MCU modules (the Basic Stamps) [4] [5].
The Propeller chip is a multi-core architecture parallel MCU with eight 32-bit CPU cores.Each of these cores can work independently or in coordination with each other's.
The architecture of the Propeller is original.The cores are called cogs.Each cog of the propeller is clocked by an internal oscillator or by an external crystal.This clock is common for all cogs.The external oscillator can be over clocked until 16× by a clock multiplier, a PLL installed on the chip.This means that the device can work at 80 MHz with a 5 MHz Crystal.All cores are running with the same clock.This allows multiple coordinated tasks.The access to the 32 common input/output pins is controlled by a bus controller, called the hub, avoiding the simultaneous access to the same pin by two different cogs.Each cog also has two individual counters,   or a complex multiline LCD display.Each cog has 2 kB of RAM and the eight cogs share a 32 kB ROM and a 32 kB RAM.It is possible to write a program in a high level language, the "Spin language" or with machine language instructions called the Pasm, a kind of Assembler, much more powerful but more difficult to use than the Spin language.It is possible to mix both languages in a single program for optimization.When the Spin language is used, the maximum speed is 8 × 80,000 = 640,000 high-level instructions per second (0.64 MIPS).In the machine language, each instruction asking 4 clock-cycles, the maximum speed is 160 MIPS.Most of the programs required for the use of video or other important tasks are freely available on the site by the Company or can be found via a dedicated forum.When not in use, a cog can be turned off to reduce the power consumption of the Propeller.The Propeller works at 3.3 V.The best way to use the Propeller is to use an external crystal and an external 32 kB EEPROM but the propeller can work without them when it is connected to a computer via a USB adapter (called a Propeller Clip or Propeller Plug).

Two Points Are to Be Carefully Control with the Propeller ®
1) Polarisation of the input/output pins The maximum voltage on each pin is 3.3 V.This can lead to a problem when most of the power supply and signals are at 5V but it is seldom a source of damages because most of the circuitry is made of CMOS components.
2) The output pins When a pin is in output state, it could be damaged if a voltage is applied on it.To avoid this, it is better to set all unused pins at the high impedance input state ("tristated").
Instead of using the propeller chip alone, which requires an external EEPROM and a prop clip for the programmation, it can be easier to use the Propstick, as shown in Figure 5, which requires only a simple USB cable to connect it to a computer.
The Propeller has 32 K bytes for ROM and RAM memories but no flash memory.The capacity of an MCU seems to be a limiting parameter when we now speak in terms of megabytes.In fact it is rarely a problem because in 95% of the automation problems in scientific experimentations, only a small part of the active memory is required.

Applications for the Propeller
A first application of the propeller is the measurement of the transmittance of Al 2 O 3 :C crystals (Figure 5).This measurement requires a stable light source and a measurement of this source intensity.An L.E.D. is powered by a USB card (the green card on the figure which will be described later) which generates a constant current intensity.This L.E.D. is placed at 1 centimeter in front of a TSL230 light to frequency converter whose frequency is measured by a first cog of the propeller (the blue print on the breadboard in Figure 5).The TSL230 is covered by a black tape to avoid perturbations by parasitic lights and measure only the transmitted light.Next to the first one, a second TSL230 is connected to a second cog of the same propeller.This one will measure the light emitted by the L.E.D. to control that the intensity is constant.If the fluctuations are observed, corrections will be made to the measurement.The crystals are placed on the aperture made in the black tape placed on the first TSL230.By this way, a large number of crystals can be measured in a very short time with good precision and sensitivity.The results of the measurements are stored in a file managed by the propeller and can be used afterwards.
Figure 6 shows the transmission of 78 crystals of Al 2 O 3 :C measured in about 30 minutes and Figure 7 gives the same results for the measurements of 17 Luxel TM detectors, a powder of AL 2 O 3 :C between two films of polyethylene and used also for the measurement of radiation doses.
The program used to control a diaphragm described before is given in Figure 8.This program controls a shutter by using only one cog.At first sight, it seems quite complex but the spin language is much more powerful and easier to use than the assembler for PIC 16F628.The wiring to connect the shutter, the MCU and the computer is also simpler.
Another application of the circuitry of Figure 5 is the control of the stability of a small laser (a diode pumped solid state laser-DPSS laser) emitting a green light at 532 nm.The result of the measurement, shown in Figure 9, indicated that, at start up, the laser intensity is very unstable.Afterwards, the output signal is much smaller.

The USB Card
Another easy way to control a device in scientific experiments is to use a USB card.A USB card is an experi-   mentation card connected to a PC via a USB connection.This card is usually able to measure and to send a lot of parameters (analog and digital signals).The USB card used in this experiment is the K4055 developed and sold by the Velleman Company [6].This card is used in the Apollo Framework to control the intensity of an L.E.D. to read dosimeter crystals.The advantage of this card is that it can be programmed with different programming languages (Delphi, Visual Basic, …) and that the program can be easily modified by the user for special purposes.In the case of the present study, where the light intensity is to be controlled, an LDR, connected to an analog input of the USB card, is placed near to the L.E.D. The Figure 10 hereafter shows the evolution of the light intensity while modifying the position of the LDR in the vicinity of the L.E.D.In this case the resolution of the measurement is better than 1% (8-bit counting) is lower than the resolution of the mounting presented in Figure 5 with the TAOS (32-bit), but is enough for the purpose of this experiment.The card acquires two measurements (adjustable value) of light intensity per second and the graph in the figure shows 2000 consecutive counting values, but the results of the full measurement have practically no limit and is stored in a special file for further analysis after the measurement.

Discussion
After the different tests performed to find the best solution for data acquisition and parameter control, the best choice for a non-specialist in MCU electronics is not so difficult.The PIC micros from Microchip can be found in a large variety of models with 6 pins to 80 pins and working with 8-bit till 32-bit words at very low prices.But this type of components requires a deep understanding of their internal design.They also require an external electronic circuitry to program the MCU.The use of this interface also requires another understanding of the microcontroller internal work.And the choice of the interface is not easy.This is certainly not the best choice for a non-specialist.For the prices, the cheapest is the 16F628 with $4, compared to the Propeller ($8) and to the Basic Atom which starts at $30.The Propeller can be found in three different cases (44-pin QFP chip, 44-pin QFN chip and 40-pin DIP chip).The Propeller can work alone with a unique interface for programmation by a computer.

Conclusion
Several ways exist to control the parameters or to automatize any small process of an experiment.Among the different possibilities found on the market, five have been tested for comparison: the PIC 16F628, the Basic Stamp from Parallax, the Basic Atom Pro from Basicmicro, the Propeller from Parallax ® and the USB card from Velleman.For all the applications, the Propeller from Parallax seems to be a good choice for an experimentalist without any experience in microcontroller units and only a small experience in digital electronics.More experimentation will require very few components and very small program to allow fast acquisition of data.The example given in Figure 8 occupies less than 1% of the available program memory.Finally, the Propeller from Parallax ® and a USB card are the best choices for a novice who wants to initiate to the data acquisition or to the automation in experimentations.

Figure 1 .
Figure 1.Configuration of a diaphragm control by the computer using a 16F628 MCU (Microchip).

Figure 2 .
Figure 2. Part of program used by the MCU to control the diaphragm described in Figure 1.

Figure 3 .
Figure 3. High resolution measurement of light intensity with a basic atom and a TSL230 light-to-frequency converter.

Figure 4 .
Figure 4. Measurement of the light intensity around the detector zone in the Apollo device for OSL counting.Two measurements in different orientations are shown.increasingthe possibilities in design and to an individual video register able to generate signals in three different television systems (PAL, VGA and NTSC).This allows a full screen access for output without using a computer

Figure 5 .
Figure 5. Mockup for the measurement of the attenuation coefficient of detectors used in OSL dosimetry.

Figure 9 .
Figure 9. DPSS Laser output power after start up.The beam presents different multi-mode transverse before reaching a stable transverse mono-mode.

Figure 10 .
Figure 10.Window used for the measurement of light with the K8055 card.