A Conceptual Atomic Force Microscope using LEGO for Nanoscience Education

A Conceptual Atomic Force Microscope using LEGO for Nanoscience Education

Tsung-Han Hsieh1,4, Yu-Chi Tsai2,4, Chih-Jan Kao3,4, Yin-Min Chang1, and Yen-Wen Lu1,*

1Department of Bio-Industrial Mechatronics Engineering, National Taiwan University, Taiwan
2Department of Physics, National Taiwan University, Taiwan
3Department of Mechanical Engineering, National Taiwan University, Taiwan
4CAVE Education Group, Hennes Co., Taiwan

(Received 24 October 2013; Accepted 12 December 2013; Published on line 1 June 2014)
*Corresponding author: yenwenlu@ntu.edu.tw
DOI: 10.5875/ausmt.v4i2.358

Abstract: A lack of effective educational materials is limited general public awareness of, and interest in, nanoscience. This paper presents a conceptual atomic force microscope (AFM) model built by using the LEGO® MINDSTORMS series. AFMs are perhaps one of the most fundamental and widely-used instruments in nanoscience and nanotechnology, thus the introduction of this LEGO® AFM should be beneficial to nanoscience education. Programmed in LabVIEW, this LEGO® model has the ability to scan the samples and construct a three-dimensional (3D) surface graphs of the sample, based on the mechanism used for AFM. With this LEGO® AFM, the students can directly access nanoscience concepts through hands-on experience constructing an AFM model. This interaction will lead to a better understanding of nanoscience principles, and motivate learners to further explore both the theoretical and experimental aspects of the domain.

Keywords: Atomic force microscopy; scanning probe microscopy; LEGO® MINDSTORMS; mechatronics; robotics; LabVIEW


Nanotechnology is an increasingly crucial scientific domain, and there is a growing need to educate students in basic principles of nanotechnology. However, there are very few instructional materials or approaches which can effectively and properly demonstrate nanotechnology concepts. Instruction in nanotechnology concepts could be made accessible to younger learners through hands-on experience with the types of tools used in related research, but these devices are too expensive and fragile to be entrusted to young learners.

Several research groups have recently developed nanoscience-related teaching tools using wooden models [1] and LEGO® bricks [2, 3]. Using LEGO® as an educational tool has certain advantages over traditional toys because the versatility and the interface integrity of the LEGO bricks. The LEGO MINDSTORMS series has been used to excellent effect in providing learners with hands-on experience in math, science and engineering, giving students the opportunity to solve practical problems in the classroom [4-6].

The atomic force microscope (AFM), or scanning probe microscope (SPM), is a powerful tool that allows scientists and engineers to visualize, characterize, and manipulate nanostructures for nanoscience research and technology applications. Challenging learners to build an AFM system using LEGO® will help them understand the underlying theories and applications of nanoscience and nanotechnology in a fun and engaging way. As such, we have developed a conceptual AFM model completely using LEGO® parts. Both hardware and software designs of this LEGO® AFM are presented. Unlike previous teaching tools [1, 2], our proposed LEGO® AFM has a design based on the operation principles of an AFM in contact mode. Thus, our LEGO® AFM model not only demonstrates critical AFM concepts, but also potentially provides a prototype instrument that can realize the surface topology of objects with reasonable resolutions.

Core AFM Concepts

Invented by Binning and his team in 1986, the atomic force microscope (AFM) is an atomic level imaging device which collects information by “feeling” the surface with a mechanical cantilever [7]. Since its invention, AFM has been widely applied not only to realize surface topology at the nanometer scale, but also to microscopically measure the electrical [8, 9], chemical [10, 11] or magnetic properties of materials [12]. Moreover, AFM can be operated in a vacuum, gas or liquid environment.

The key element in AFM is its cantilever, which generally consists of silicon (Si) or Silicon Nitride (Si3N4) as the needle tip. The diameter of the needle tip can range from 20 nm to 100 nm. During operation, the cantilever moves up and down as it follows the surface topology of the sample objects. This vertical displacement of the cantilever, although tiny, can reflect the sample’s surface topology and structures when the atomic forces (or distances) between the tip and the sample can be controlled. Depending on the interactions between the tip and the sample, AFM is most commonly used in three operation modes, including:

  1. Contact mode (also “static mode”):
    The atomic interaction between the tip and the sample directly deflects the cantilever at each lateral position (x and y). The topography (z) is geometrically magnified using a laser beam reflected on the cantilever to a light sensor or photo detector.
  2. Non-contact mode:
    The cantilever oscillates at its resonant frequency, rather than having its tip physically contact the sample surface. The van der Waals forces, which interact between the tip and the sample surface, decrease the resonance frequency of the cantilever. Thus, by controlling the tip-to-sample distance and feedback control, the system can maintain the same oscillation frequency. The tip-to-sample distance at each (x, y) location can be used to recreate a topographic image of the sample surface.
  3. Intermittent contact mode (also “tapping mode” or “dynamic mode”):
    The cantilever oscillates at its resonant frequency, while its tip physically taps the sample surface. The light sensor, or photo detector, acquires a shift in the resonant frequency of the oscillating cantilever due to interatomic forces.

LEGO Programmable Robotics Kit

LEGO® programmable robotics kits are based on the development of computer languages for educational purposes, such as Logo, developed at Massachusetts Institute of Technology (MIT) in the 1960s. Designed as learning tools to stimulate students, these programming activities led to applications in a variety of fields, such as mathematics, robotics, and science [13]. Logo was later integrated with LEGO® building blocks to form the LEGO/Logo® system, which not only provided a programming environment for children to learn, but also encouraged greater creativity in design [14]. The development of programmable LEGO systems allowed for learning environments which allowed students to engage in hands-on experience in math, science and engineering in the classroom [15].

Further collaboration between the LEGO® Company, Tufts University, and National Instruments in the late 1990s resulted in the development of a new software tool, ROBOLAB, which was written in LabVIEW [16]. ROBOLAB provided students with an intuitive graphical programming environment that allowed for expanded development possibilities. Although programmable LEGO systems were initially designed for children, the versatility of the tool set also supported the development of complicated projects for experienced users who developed additional robotics application programming interfaces (APIs) in several custom programming languages, including Java for LEGO NXT (LeJOS NXJ) and Not eXactly C (NXC) [17, 18]. Given these advantages, we selected the LEGO robotics kit as a platform for promoting nanoscience education and engaging learner interest in the subject.

System Architecture of LEGO AFM

The LEGO® AFM was designed to be highly modular so that students can work in teams to construct the model. As shown in Figure 1, our LEGO® AFM consists of five modules: (i) X-Y 2-axis motion platform, (ii) laser platform, (iii) cantilever, (iv) sample plate, and (v) light sensors platform . The functionality and construction of these five modules is explained in detail in the “Hardware” section.

Each module can be constructed individually and then combined to construct the AFM. The model is not only to build but is highly portable when disassembled. It takes about one hour to assemble from scratch and 2 minutes to disassemble the LEGO AFM into the five main modules. The modules can then fit in a 22-inch suitcase, though the 37.92 cm × 37.92 cm LEGO® base plate must be carried separately. The complete AFM model requires about 200 LEGO bricks/linkages and 100 pins/connectors.

The completed modules are assembled based on the workflow illustrated in Figure 2. A PC was used to run the program, while the NXT programmable brick receives commands directly from the PC and controls the target input and output devices. While scanning the uneven sample surface, the light sensors measure the deflection of the cantilever, and the NXT sends data back to the PC. The PC then calculates the scaled values based on the reading values from the two light sensors, and generates a 3D surface graph on the user interface. The 3D surface graph is continuously updated during the measuring process.


The LEGO® AFM was constructed mainly using LEGO® parts, aside from a custom-made aluminum plate used to reflect the laser beam, and a custom-made laser module modified from the circuit of the LEGO® light sensor.

X-Y 2-axis Motion Platform

An X-Y 2-axis motion platform was designed to move the sample plate in a Cartesian coordinate system using gears and gear racks. Figure 3 depicts the motion platform without the sample plate.

Two LEGO® interactive servo motors (model 9842) are used to drive the motion platform. Once the motion platform’s position had been calibrated, its position could be tracked from the built-in encoders.

Sample Plate

A sample plate measuring 143.7 mm × 143.7 mm was constructed using LEGO® bricks. The sample can be modified freely, as shown in Figure 4, and can be easily fixed on the 2-axis motion platform.

Laser Platform

The system uses a custom-made laser module which can be directly connected to the NXT sensor ports. The circuitry for this laser module was similar to that used for a standard LEGO light sensor, except that the red light emitting diode (LED) was replaced by a red laser module (SKU 5928, DealExtreme), as shown in Figure 5 (a). The circuit was packaged and wrapped in heat-shrinkable tubing, as shown in Figure 5 (b).

The laser module was fixed on the platform, as shown in Figure 6, targeting the reflective plate on the cantilever. The focus of the laser module could be adjusted so the focus area of the laser beam can be modified and controlled.


The cantilever in Figure 7 (a) was constructed from LEGO® plates (Figure 7 (b)), and two pentahedron bricks were combined to form the pyramid-shaped tip (Figure 7 (c)).

Light Sensors Platform

Two LEGO light sensors (part #9844) were fixed on the platform, as shown in Figure 8. The position of the light sensors, the angle of cantilever and the laser module were aligned to allow the sensors perceive the lasers and determine the deflection of the cantilever.



Produced by National Instruments (NI), LabVIEW is one of the most popular graphical programming languages and used extensively in industrial and academic applications. NI, Tufts University, and LEGO collaborated to develop ROBOLAB and NXT-G. However, using LabVIEW to directly program LEGO® systems was not possible until 2008, when the LabVIEW toolkit for LEGO MINDSTORMS NXT came out and is now the standard module in the LabVIEW environment. Combining LabVIEW and NXT created an appropriate tool for higher level education. LabVIEW can be used to program the NXT brick under two modes: direct and remote. In the remote mode, the program will be downloaded into the NXT, while in the direct mode, the program is run by a computer companion with a software shield running on NXT. Under direct mode, the NXT robot can be considered as the computer’s actuator, with the computer playing the role of the ‘brain’. Therefore, under direct mode, the student has full access to all the LabVIEW functions, including mathematic functions that are far more advanced than those in NXT-G, and even some professional modules and toolkits, like signal processing and image processing.

The LEGO AFM program was developed in LabVIEW 2011 and operated in direct mode, thus the LEGO AFM can be controlled via the user interface on the PC.

Graphic User Interface (GUI)

Figure 9 shows the intuitive graphic user interface (GUI) was developed for use by students. The right part of the screen shows a 3D surface plot which refreshed every time a scanning column was completed. A set of buttons allows students to initialize the AFM model, start the measurement, stop immediately, save the 3D plot, or save the data. The left side of the GUI contains a waveform chart (upper left) that shows the one-dimensional (1D) data plot of the scaled value from the light sensors. A set of radio buttons and numeric inputs (lower left) is used to set the target resolution and the motor speed. A set of status indicators (lower middle) is included to show the rotation angle of the motors and the calibration status of the light sensors. In addition, two numeric bars (lower right) indicate the initial reading of the two light sensors.

Sample Scanning

Figure 10 illustrates the scanning procedure of the LEGO AFM. After the sample is loaded, the system is first initialized by returning the motion platform to its point of origin. The light sensors are then calibrated and the lasers are turned on. The motion platform then begins to move along the x-axis and then y-axis to allow the cantilever tip to raster scan the sample to build the AFM image pixel-by-pixel.

Sample Preparation

The scanning sample can be constructed simply using LEGO bricks or real objects with reasonable feature sizes. Figure 11 shows one example from our tests: the Chinese characters “台大” which is an abbreviation of the Chinese characters for “National Taiwan University”. Chinese characters are chosen for the sample to demonstrate the versatility of our LEGO® AFM model. While building the scanning sample, the height should not be more than 4.8 mm to correspond to the height of a single LEGO brick. If the height of the scanning sample exceeds this height limit, the laser will not able to target the light sensors, and the cantilever might break.

Scanning Parameters

Once the sample plate is fixed in position, the scanning parameters can be adjusted, including the scanning resolution and motor speed. The proposed model includes six different scan resolutions (i.e., 20×20, 30×30, 40×40, 50×50, 60×60, and 70×70 pixel for the 143.7 mm × 143.7 mm sample plate). Therefore, our AFM model can resolve a feature size of 2.05 mm while the scan resolution is set to 70×70. Based on the scan resolution, the program automatically adjusts the rotation angle of the motors. The default speed of the two motors was set to 10% of their maximum speed. The encoder built inside the motor has a resolution of one degree, and an internal closed-loop controller was used to minimize errors. In addition, although scanning resolutions of 100×100 pixels or higher are possible, the image was not clear at higher resolutions since the scanning results were also limited by the rotation resolution of the motors.


After the parameters are set, students press the start button on the user interface to initiate calibration of both the light sensors and the motion platform. To calibrate the light sensors, two ambient light values were calculated based on the average values of 100 measurements from the each light sensor. While scanning the sample, it is important to keep environmental light conditions consistent. The ambient light value must be subtracted from the measurement values of the light sensors.

On the other hand, calibrating the motion platform uses the “Return to home position” function, in which the angular velocities of the two motors are calculated. When moving toward the home position, the angular velocities of the motors are constant. Therefore, when the platform stops at its home position, the angular velocity of both motors is reduced to zero. By monitoring the encoder readings, and by calculating the angular velocity, the motion platform could return to the home position.

The scanning process automatically starts after the calibration. The time required for a complete scan depends on the resolution and the motor speed. It takes our AFM model approximately 7 minutes to finish a 20×20 pixel scan resolution, while 40 minutes is required for scanning at 7070 pixel scan resolution.



One of the biggest issues affecting the scanning result is the leveling of the sample plate. If the LEGO AFM is not completely horizontal, the scanning image will tilt. However, because LEGO parts are made of plastic, they bend easily under external force.

Data Collection and Operation

The scanned data was represented as a 2D array, while each value in the array is a scaled value from the two light sensors. Because the height limitation was 4.8 mm, the laser was placed such that the laser beam can target the lower light sensor while the tip fails to detect an object (see Figure 12 (a)), and then targets the higher light sensor while the tip detects a 4.8 mm object (see Figure 12 (b)).

The light sensor reading ranges from 0 to 100, representing the light intensity of the reflected laser beam, where 0 indicates that only ambient light is detected, and 100 indicates that the laser beam is fully targeting the light sensor. During AFM scanning, the laser beam targets on a spot in between two light sensors and moves with the cantilever. By placing two light sensors in close proximity, the beam’s impact point could be determined using a weighted average value from readings from both light sensors. The weighted average values are calculated as:


where ${{I}_{U}}$ is the reading of the upper light sensor. ${{I}_{L}}$ is the reading of the lower light sensor, and ${{a}_{i,j}}$ is a 2D array that stores the weighted average values from the readings of the two light sensors. After the scan is complete, the 2D array of the weighted averages is further scaled to the actual height, as follows:

\[{{s}_{i,j}}=\frac{{{a}_{i,j}}\times h}{\text{max}[{{a}_{i,j}}]},\tag{2}\]

where $h$ is the height of the object, and ${{s}_{i,j}}$ is the normalized weighted average values, referring to the actual height of the objects (${{a}_{i,j}}$).

Scan Results

Figure 13 shows the scanning results on the sample at scanning resolutions of 20×20, 30×30 and 40×40. At 20×20 resolution, the LEGO AFM can only collect data in 7.19 mm intervals, resulting in an ambiguous 3D surface plot, as shown in Figure 12 (b). As the scanning resolution increases, the detail of the Chinese characters on the sample plate becomes clearer, with only the studs on the top of the bricks not represented. At a resolution of 30×30, data are collected at a 4.79 mm interval, and most studs are visible. Finally, at 40 × 40 resolution, data are collected at a 3.59 mm interval, which is close to the 3 mm gap between the studs; therefore, almost all of the studs were detected and presented in the surface plot.


A LEGO AFM was developed as a tool for teaching high school students about nanoscience. The hardware design is similar to that of a contact mode AFM, thus providing students with insight into both related theories and practical applications. The scanning sample can be constructed freely using LEGO bricks. The software, programmed in LabVIEW, provides an intuitive graphical user interface. During scanning, the LEGO AFM calibrates itself automatically, and provides variable scan resolution. The highest resolution can discern differences of 2.05 mm. Constructing and using the LEGO AFM gives students the opportunity to learn from hands-on experience, thus providing improved understanding of AFM concepts and linking theory and real-world applications.

The LEGO AFM suffers from certain precision-related limitations. LEGO blocks are made from plastic and can bend easily under the application of external force; even the weight of the motor units can cause deflection of the motion platform. In addition, sample height is limited to 4.8 mm, and the resolution of the 2D scanning image depends on the step size, the number of scanning lines, and the tip sharpness. However, these limitations, properly explained, can give students additional insight into the basic concepts, capability and limitation of AFM in nanoscience study.

Supplementary Material

A video demonstrating the operation and functionality of the LEGO AFM can be found at http://youtu.be/1okl0gkwwUw


  1. A. Lindell and A. L. Kähkönen, "Learning the core ideas of scanning probe microscopy by toy model inquiries," Nanotechnology Reviews, vol. 2, no. 2, p. 229, 2013.
    doi: 10.1515/ntrev-2012-0052
  2. C. Y. Ryu, P. Fedoroff, and T. Pittman, "Having fun with high school teachers and students making atomic force microscopy," Bulletin of the American Physical Society, vol. 53, 2008.
  3. LEGO® AFM, 2013, [Online].
    Available: http://mcise.uri.edu/park/MNEL/legoafm/index.html
  4. K. W. Lau, T. Heng Kiat, B. T. Erwin, and P. Petrovic, "Creative learning in school with LEGO programmable robotics products," in 29th IEEE Frontiers in Education Conference, 1999, vol. 2, pp. 12D14/26-12D14/31 vol.12.
    doi: 10.1109/FIE.1999.841676
  5. K. B. Wendell, M. Portsmore, C. G. Wright, C. Rogers, L. Jarvin, and A. Kendall, "The impact of engineering-based science instruction on science content understanding," in the 118th American Society for Engineering Education Annual Conference and Exoposition, 2011.
  6. S. Brophy, S. Klein, M. Portsmore, and C. Rogers, "Advancing engineering education in p-12 classrooms," Journal of Engineering Education, vol. 97, no. 3, pp. 369-387, 2008.
    doi: 10.1002/j.2168-9830.2008.tb00985.x
  7. G. Binnig, C. Quate, and C. Gerber, "Atomic force microscope," Physical Review Letters, vol. 56, no. 9, pp. 930-933, 1986.
    doi: 10.1103/PhysRevLett.56.930
  8. Y. Y. Divin, U. Poppe, C. L. Jia, P. M. Shadrin, and K. Urban, "Structural and electrical properties of YBa2Cu3O7 [1 0 0]-tilt grain boundary josephson junctions with large IcRn-products on SrTiO3 bicrystals," Physica C: Superconductivity, vol. 372-376, Part 1, no. 0, pp. 115-118, 2002.
    doi: 10.1016/S0921-4534(02)00859-6
  9. I. Kante, T. Devers, R. Harba, C. Andreazza-Vignolle, and P. Andreazza, "Electrical behaviour of fractal nanosized tin dioxide films prepared by electrodeposition for gas sensing applications," Microelectronics Journal, vol. 36, no. 7, pp. 639-643, 2005.
    doi: 10.1016/j.mejo.2005.04.036
  10. G. Chen and J. H. Horton, "Photochemically induced oxidation and silver deposition on amorphous germanium sulfide films studied using atomic force microscopy and ion beam methods," Thin Solid Films, vol. 347, no. 1–2, pp. 208-213, 1999.
    doi: 10.1016/S0040-6090(99)00008-5
  11. H. H. Strehblow, V. Maurice, and P. Marcus, "Initial and later stages of anodic oxide formation on Cu, chemical aspects, structure and electronic properties," Electrochimica Acta, vol. 46, no. 24, pp. 3755-3766, 2001.
    doi: 10.1016/S0013-4686(01)00657-0
  12. R. S. Ningthoujam and N. S. Gajbhiye, "Magnetic study of single domain -Fe3N nanoparticles synthesized by precursor technique," materials research bulletin, 2007.
  13. B. Harvey, Computer science logo style. Cambridge, Mass.: MIT Press, 1985.
  14. M. Resnick and S. Ocko, LEGO/logo--learning through and about design. Norwood, NJ: Ablex Publishing, 1991.
  15. M. Resnick, F. Martin, R. Sargent, and B. Silverman, "Programmable bricks: Toys to think with," IBM Systems Journal, vol. 35, no. 3.4, pp. 443-452, 1996.
    doi: 10.1147/sj.353.0443
  16. B. Erwin, M. Cyr, and C. Rogers, "LEGO engineer and robolab: Teaching engineering with labview from kindergarten to graduate school," International Journal of Engineering Education, vol. 16, no. 3, pp. 1-12, 2000.
  17. Bricx command center 3.3, 2013, [Online].
    Available: http://bricxcc.sourceforge.net
  18. "Lejos, java for LEGO mindstorms," 2013, [Online].
    Available: http://lejos.sourceforge.net
  19. Philo’s home page, 2013, [Online].
    Available: http://www.philohome.com/


  • There are currently no refbacks.

Copyright © 2011-2018 AUSMT ISSN: 2223-9766