EMF Hapkit and EMF Sandbox

Team name: Tactile EMF Sandbox

Names: Patrick Ignoto, David Abraham, Dirk Dubois

Contact: patrick.ignoto@mail.mcgill.ca, david.abraham@mail.mcgill.ca, dirk.dubois@mail.mcgill.ca


For many STEM students, their first interaction with electromagnetic fields is via electrostatics, analyzing a variety of point-charge distributions. Visualization tools exist to give these students a better sense of how electrostatic fields behave, but these representations tend to be abstract and don’t provide a means of self-exploration for students to understand forces, fields, and the underlying nature of electromagnetism (EM) in general. Furthermore, existing lab technologies, such as dry field maps or electroscope flasks, can be prohibitively expensive for schools and require specialized setups and equipment [1, 2].

Since electrostatic fields exert forces on particles within their domains, haptic force-feedback devices are an excellent vehicle for teaching the core concepts of EM. Notions such as inverse-square forces, fields created and experienced by static point charges and currents, voltage, or even equipotentials can be more intuitively understood through the tactile sense. Previous researchers have examined the use of haptic force feedback for better understanding forces and have found it had a positive effect on student achievement [3].

This document describes two products developed by our team for the 2017 World Haptics Convention Student Innovation Challenge, which use the provided force-feedback devices as a tool to teach electrostatics. The first product, called the EMF Hapkit, uses the Hapkit, a one degree of freedom (DOF) force feedback device developed by researchers at Stanford University [4]. Our product helps students understand and derive various force-distance relationships using the one degree of freedom available.

The second product, called the EMF Sandbox, uses the Haply, a two DOF device developed by researchers at McGill University [5]. Our product explores two dimensional electrostatics problems. By feeling the forces generated by charges in a preset or custom configuration, students can explore the nature of electrostatics. These two products encourage active learning of electrostatic concepts that students starting a post-secondary degree in science, technology, engineering, and mathematics (STEM) will likely encounter and have difficulty understanding intuitively. The following sections discuss the learning environment, system details, and hardware and software descriptions for both the EMF Hapkit and the EMF Sandbox.

EMF Hapkit

Learning Description

The EMF Hapkit allows students to experience electrostatic forces first hand. One of the central concepts of electrostatics is the notion of an inverse-square force, where magnitude varies inversely proportional to distance. Despite being common knowledge to most students — as well as ubiquitous in physics, since gravitation is also inverse-square — this type of force relationship remains unintuitive. What does the force feel like, and how does it shape electromagnetic interactions? Moreover, other complex charge configurations exist where the resultant forces are proportional to other powers of distance. How do these feel? How do they compare to the inverse-square force, or other forces we could experience? The EMF Hapkit aims to address these questions, allowing students to actually feel the answers for themselves.

Video Demonstrating Features of the EMF Hapkit as a tool for active learning

Students interact with the EMF Hapkit via the main handle, which simulates the movement of a test point charge through space. This distance is then converted into force feedback, depending on the problem selected by the user. By switching between the various simulations, the student can experience and compare the differences in the various force-distance relationships which exist in electrostatics. Currently, the Hapkit supports four problems which can be fully explored: Hooke’s Law, the Infinite Line Charge Field, Coulomb’s Law, and the Dipole Field. These are briefly described below.

Hooke’s Law:

The classical spring problem in which the force is directly proportional to the displacement. This is easily the most intuitive of the available problems. This problem is meant to act as a baseline to compare against the remaining electrostatic problems.

Infinite Line Charge Field:

This charge configuration consists of an infinitely thin and long line of charge, with a linear charge density given in C/m. The force produced by such a configuration interacting with a test charge is inversely proportional to distance.

Coulomb’s Law:

The most famous electrostatic example is that of the attraction or repulsion of two point charges, of magnitudes Q1 and Q2. The resulting force is inversely proportional to the square of the distance between them.

Dipole Field:

Two equal and opposite point charges form an electric dipole with dipole moment p= qd. The resulting force is inversely proportional to the cubed of the distance between the dipole and the test charge.

We have a sample handout students could use as an outline for a laboratory assignment with the EMF Hapkit. It can be found by clicking here.

System Description

The EMF Hapkit is built upon the standard Hapkit device from Stanford University. The student interacts directly with the main handle of the device, which generates a force varying with distance according to the selected problem and parameters. This allows the student to compare and contrast the effects of different force-distance relationships, as detailed above.

The device also includes a Liquid Crystal Display (LCD) which displays simulation output variables such as force and distance. As a result, the student can not only qualitatively experience the differences between the force-distance relationships but can also quantitatively take note of the force and distance and reconstruct their mathematical behaviour as well.

The LCD circuit board also includes a number of buttons which serve as inputs for the user to select the problem of interest from the above, as well as modify problem parameters such as spring constant, charge magnitude, and charge sign. Thus they also have the opportunity to experience how these variables affect the force produced.

A user’s guide for the EMF Hapkit can be found by clicking here.

User Guide for the EMF Hapkit

Software Description

The software used by the EMF Hapkit uses full custom software to create the force-feedback environment. Custom routines were written to perform distance tracking (inverse kinematics) using the Hapkit’s magneto-resistive sensor, generating the required force, and for reading keypresses from the user. Lastly, the standard Arduino LCD library was used, to facilitate communication with the chosen screen.

Program flow of the EMF Hapkit

Based on the user’s movement of the handle, the entered parameters on screen, and the chosen problem, the simulation environment exerts a force on the handle, which can be felt by the user. Due to the cable drive system of the Hapkit, it was important to not overtax the motors when the handle was at the end points of the device. A dead zone was programmed, where the motors shut off once the handle is pushed past a threshold in either direction. This helps protect the device from damage.

The full source code for the EMF Hapkit is available by clicking here.

Hardware Description

The standard Hapkit setup was used, with the exception of the addition of an LCD module, which includes six buttons on the front panel. The entire device has been mounted to a wooden base, with an LCD screen holder affixed to the front.

EMF Sandbox

Learning Description

The EMF Sandbox is designed for students to explore the fields generated by electrostatic particles in configurations of their choosing. By coupling visualizations with force feedback, students can begin to have an intuitive understanding of what the visualizations mean and how the electrostatic fields affect a test charge in such an environment. The sandbox nature of the application is excellent for promoting active and experiential learning in students. It facilitates curious exploration of different configurations and allows them to achieve a better understanding of forces and vectors in electrostatic problems.

Video Demonstrating Features of the EMF Sandbox as a tool for active learning

With this system, students can start by learning Coulomb’s Law. They will be able to feel the attractive or repellent forces from charges of different polarities and experience the inverse-square relationship that force and distance share. They can then learn the additive nature of forces generated by Coulomb’s Law, by exploring more complex configurations like the dipole and quadrupole. This will properly tool them for exploring configurations of their choosing and actively exploring electrostatics.

The coupling of visualizations with force feedback allow a more intuitive understanding of the visuals.

We have a sample handout students could use as an outline for a laboratory assignment with the EMF Sandbox. It can be found by clicking here.

System Description

The EMF Sandbox is a virtual environment that models the behaviour of a test charge when placed in an electrostatic environment with fixed point charges. The attached Haply device allows the user to control the position of this test charge in two dimensions, and in turn feel the forces being applied to the test charge as its position changes.

Using the graphical user interface (GUI) on the computer, the user can create their own custom charge configuration, or choose from several presets. The selected problem is then fully customizable. For example, a user can select the Electric Dipole preset and adjust the magnitude and polarity of the dipoles charges. Furthermore, the magnitude and polarity of the test charge can also be adjusted.

The EMF Sandbox environment is split into three regions, the main sandbox area, the charge control area on the right, and the menu area on the bottom. The main sandbox area is where students can add up to seven charges in a configuration of their choice. The charge control area allows students to change the charge magnitude and polarity of any charges they add via sliders. The menu area allows students to add preset problems that are common in electrostatics, such as the dipole or quadrupole. As well, they can turn on field line and equipotential line visualizations and there is a graph showing the force magnitude acting on the test charge.

GUI environment of EMF Sandbox with labels

The software provides visualizations of the electric field and equipotential lines. The visualizations for the field lines are arrows drawn based on the theoretical field generated by the individual charges, and follows the standard convention (arrows pointing away from positive charges, pointing towards negative charges). The equipotential lines are drawn based on the fields as well, showing contour lines where electric potential is constant. Both visualizations can be drawn and updated at the same time. The following video demonstrates these visualization functionalities:

Video demonstrating the visualizations of EMF Sandbox

A quick start guide for using the EMF Sandbox can be found by clicking here.

Hardware Description

The EMF Sandbox uses the standard Haply hardware kit without any modification. As we envisioned the EMF Sandbox as a software product that uses the Haply as an input and force feedback device, there was no need for further modification. A computer is necessary to run the software to use EMF Sandbox.

Software Description

The EMF Sandbox’s software can be split into two parts; the GUI programmed using Processing and running on a personal computer and the firmware running on the Haply which communicates through the serial port. Our application uses the provided hAPI to interact with the Haply, which provides the position of the handle and a means of applying a force to the handle. The Haply firmware outputs rotary encoder data and the hAPI uses forward kinematics to convert this information to a rendered position on screen. Similarly, our simulation environment computes forces in the x and y direction, which are sent through the hAPI and converted to torques using backward kinematics.

The haptic loop, shown below, uses a timer (from the CountdownTimer library) to synchronize the Haply and the GUI at a rate of 1kHz.

Haptic loop for the EMF Sandbox

The EMF Sandbox’s Simulation environment determines the force acting on the test charge represented by the Haply handle based on its current position. This is performed by adding both x and y components of the force generated by each individual static charge in the sandbox. Since the system can be unstable and have spurious oscillations when close to a single charge, a damping factor is used to dampen the force when the test charge is within a certain radius of a static charge.

In order to have a full featured GUI, additional Processing libraries were used in the software application to improve the functionality and look of the software. G4P allowed the addition of GUI elements in Processing. We wanted the EMF Sandbox to be fairly intuitive and have familiar GUI elements to control things like charge magnitude. The G4P library allowed us to add such elements to our environment. These include the charge control sliders, the preset selection radio buttons, and the visualization checkboxes. Furthermore, Grafica allowed the addition of 2-dimensional plots in Processing. This was used to give visual feedback about how much force is being applied to the test charge a student would control.

The entirety of the Processing software developed for the EMF Sandbox, as well as the Haply’s firmware, can be found by clicking here.



During the development of both products, the EMF Hapkit and the EMF Sandbox, we encountered various challenges. For the EMF Hapkit, a primary obstacle was ensuring the program could keep track of the handles position. Qualification of the magnetoresistive sensor, through the collection of measured data, allowed us to condition the signal and have a robust setup.

The EMF Sandbox had it’s own unique issues. Although the physical setup was excellent and accurately determining the handle’s position was less of a challenge compared to the EMF Hapkit, conditioning the output force signal was tricky. Due to the physics modelling and the nature of the problem being simulated, when two opposite charges are brought close together, we experienced high amounts of jitter and shaking. In order to avoid this jitter, the output force generated by the physics model was examined, and various filtering techniques were studied to stabilize the Haply. In the end, adding an exponential damping factor allowed stabilization of the handle when being held by a user. A primary concern was ensuring that the feedback provided to the user still accurately reflected the physics of the environment while also ensuring the continued operation of the device.

Future Work

In future work, we plan to expand the capabilities of both devices, as well as investigate its applications in a learning environment. Given our current products, we want to run tests with students to gather feedback on the devices’ operation, there ability to effectively teach the concepts, and gauge what features could be added. Furthermore, additional learning activities, such as magnetostatics, are planned for the EMF Sandbox. Finally, a deeper analysis of the output forces and input position signals would help provide insight into how signal conditioning can better improve the user’s experience.


[1] Fisher Scientific, “EISCO Dry Field Mapping Kit — Education, Apparatus.” [Online]. Available: https://goo.gl/XMWRRg. [Accessed: 04-Jun-2017].

[2] Fisher Scientific, “Science First Electrostatics Demonstration Kit — Education, Equipment and Instruments for Education.” [Online]. Available: https://goo.gl/BfwcG1. [Accessed: 04-Jun-2017].

[3] L. Santos and C. V. Carvalho, “Improving experiential learning with haptic experimentation,” International Journal of Online Engineering(iJOE), vol. 9, no. 8, pp. 7–9, 2013.

[4] T. K. Morimoto, P. Blikstein, and A. M. Okamura, “Hapkit: An open-hardware haptic device for online education,” in Haptics Symposium (HAPTICS), 2014 IEEE, 2014, pp. 1–1.

[5] C. Gallacher, A. Mohtat, S. Ding, and J. Kövecses, “Toward open-source portable haptic displays with visual-force-tactile feedback colocation,” in 2016 IEEE Haptics Symposium (HAPTICS), 2016, pp. 65–71.