Message Boards Message Boards

The periodic table - powered by Wolfram Language

Recently, I've been working on a project called Mandy, an interactive periodic table that displays different element trends depending on what the user says to her. The Raspberry Pi/Mathematica duo has played a very strong role in all aspects of the project design and implementation.

I'm not allowed to provide too many details about the project (not because it's secret, but because I am moving in a month and my wife has ordered that all of my toys and hobbies get packed or I risk them being left behind). Therefore, I created a teaser trailer showcasing the design with a promise to provide more details when I get settled in my new location.

enter image description here

enter image description here

That said, I wanted to highlight a couple of areas where Mathematica played a pivotal role in the the project. My goal was to create a periodic table display (approximately 24x18") that has a RGB LED for each element. The color of the element would then be based on a given periodic trend (atomic radius, weight, ionization energy, etc.). Controlling 118 3-color LEDs turns out to be very easy when the LEDs are Neopixels and the controller is an Arduino. Because I envisioned a wall display, I wanted the user to interact with the piece in some fashion other than a mouse or keyboard. I have started working on a voice recognition system based on pocketsphinx which I call Simplified Command and Control - SCAC but since it is a C/Python project, I'll leave that component for another forum. In summary, the final project requires that SCAC (a python script) interact with Mathematica (data manipulation) that then speaks to an Arduino via a serial connection. But Mathematica played a big role prior to the implementation as well:


  • With access to ElementData, I was able to very quickly create an image that could be sent to a laser cutter for carving the birch-wood frame and the acrylic element pieces.

    o = Table[
       Map[ElementData[i, #] &, {"AtomicNumber", "Symbol", "Period", 
         "Group"}], {i, 118}];
    (* Need to massage the f-block elements,giving them fake groups and \
    periods.Making their periods 9 and 10 with their groups 3 through 16 \
    works nicely *)
    o[[57 ;; 70]] = Module[{i = 1, rep = Range[3, 16], tmp},
       tmp = Select[o, 57 <= #[[1]] <= 70 &] /. {6 -> 9};
       tmp /. {Missing["NotApplicable"] :> rep[[i++]]}];
    o[[89 ;; 102]] = Module[{i = 1, rep = Range[3, 16], tmp},
       tmp = Select[o, 89 <= #[[1]] <= 102 &] /. {7 -> 10};
       tmp /. {Missing["NotApplicable"] :> rep[[i++]]}];
    o = o /. {"Uut" -> "Nh", "Uup" -> "Mc", "Uus" -> "Ts", "Uuo" -> "Og"};
    piece = Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}];
    box[array_] := Module[{x, y, m = 10},
      {x, y} = array[[{4, 3}]];
      {FaceForm[None], EdgeForm[Thin],
       Rectangle[{m x, m (10 - y)}, {m (x + 1), m (11 - y)}]
       (*Inset[Style[array[[2]],10,Bold],{m (x+0.5),m(10.7-y)}],
    makePiece[pt_] := GeometricTransformation[
       GeometricTransformation[piece, {pt[[1]], 10 - pt[[2]]}*{1.2, 1.2}],
       ScalingTransform[{10, 10}]];
    ptpuzzle = 
      Graphics[{EdgeForm[Thin], FaceForm[None], 
        makePiece /@ o[[All, {4, 3}]]}];
    letters2[array_] := Module[{x, y, m = 10},
      {x, y} = array[[{4, 3}]];
      {FaceForm[None], EdgeForm[Thin],
       (*Rectangle[{m x,m(10-y)},{m(x+1),m(11-y)}]*)
       Inset[Style[array[[2]], 8, Bold, 
         FontFamily -> "Cambria Math"], {m (x + 0.45), 
          m (10.55 - y)}*{1.2, 1.2}],
       Inset[Style[array[[1]], 6, 
         FontFamily -> "Cambria Math"], {m (x + 0.45), m (10.2 - y)}*{1.2,
    ptpuzzlelt = letters2 /@ o // Graphics;
    Show[ptpuzzlelt, ptpuzzle, ImageSize -> 600]

enter image description here

There are easier ways to create a periodic table, but the above method allowed me to create SVG images suitable for tweaking in vector graphics software and cut with the laser cutter.


Naturally, ElementData can provide the physical and chemical properties of the elements that I want to display on Mandy. There's nothing inspiring about this code (grabbing the data, rescaling it and converting values to a corresponding color scheme). Mathematica provided a useful platform for sandboxing what the trends would look like:

enter image description here


Since speech recognition (SCAC) is written in Python, I needed to control a Mathematica Kernel from within Python. I've played with this idea before which results in a functioning platform that is error-intolerant (READ: not ready for prime time). Communication with the Arduino is done through a "Serial" device instead of the "Arduino" device because I started this project before the latter was working. That said, it was pretty straightforward to create a Mathematica Package that (a) opens serial communication with the Arduino, (b) Reads in the element-LED data (c) sends a command to the Arduino to light the LEDs.

I plan to post more details about the project, including code and design pictures, in due time. See my website for updates. RIght now, it sounds like I've used up my daily allocation of blogging time and have to go pack some boxes.

2 Replies
Posted 2 months ago

This can only be the world's second most awesome invention (and I mean that in every way.)

The first being the periodic table itself.

An interactive periodic table is the only thing you actually need to understand basically well over 50% of fundamental chemical concepts. You've got the vasic octet rule for 13 year olds who need the periodic table to actually be predictively useful (,and that's their first experience of doing real science). You've got bond polarity andvyouncan explain why water has a boiling point that's insanely in excess off any other small molecule. You've got thr formulae of binaryn ionics. You've got so much that can be explained by the force of attraction between positive and negative charges and a little bit of teachable thinking SKILLS AND THEN CHEMISTRY MAKES SENSE TO KIDS AND MANY OF THEK RETAIN THAT CONFIDENCE FOR EVER.



It would be an absolute game changer.


POSTED BY: matthew rapley

enter image description here - Congratulations! This post is now a Staff Pick as distinguished on your profile! Thank you, keep it coming!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract