Using a Customizable Interface Development Tool with Arduino

Development tools that let you create drag-and-drop interface tools for Arduino and Raspberry Pi projects are quite popular. I got my hands on one to use in a unique chemistry project—here's how it went.

A few months ago I was confronted with an interesting challenge. I teach at a STEM-oriented after-school club and a student explained that he was making bismuth crystals and needed help with a somewhat unique problem.

If you don't remember from chemistry class (I didn't), bismuth is an element, atomic number 83. It is a silver-colored, soft metal which is solid but brittle at room temperature. If you melt it down and then let it cool, it will form crystals. Due to oxidation, the crystals will take on some surprising colors, from pink to green to blue. My student was making the crystals and selling them, but wanted a way to monitor and record the temperature of the metal as it heated and cooled. This way, if he got a crystal he liked, he could attempt to replicate it.

Some time later, we had a couple of Python scripts that would monitor the temperature, displaying it as a line graph on the computer screen and recording it to a CSV file for future reference. It wasn't pretty, but it worked. Since then, I've gone back and replaced all of our messy code with a single program: MegunoLink.

What Does It Do?

MegunoLink is a pretty cool program that allows you to create an on-screen interface for your project. It's compatible with just about any board that has a serial connection to the computer, including most Arduino boards and the Raspberry Pi. It can connect over USB, UDP network connections, and the XBee Series 2.
In my case, I am simply using an Arduino Uno, along with a photoresistor I had lying around.

My photoresistor setup

MegunoLink is, in essence, a smarter version of the serial monitor in the Arduino IDE. It reads all communications coming from the board and can send messages back. With MegunoLink, however, you preface each line of information with a special tag which tells the computer what the numbers and text in that line mean.
You create a quick drag-and-drop layout on screen, made up of various "panels". You can use anything from simple serial monitors to a few different kinds of graphs, or even maps if your board is passing GPS coordinates.
MegunoLink then takes that information and, based on the tag, sends it to the correct "panel" on screen. Sound complicated? No stress. If you're using Arduino, they have a library with a bunch of pre-made functions to make the process quick and easy.


A program set up for MegunoLink is pretty much the same as what you might use for any other project. Note that I created a "TimePlot" object and that, instead of printing to Serial, I used the functions from the MegunoLink library.

                    #include "MegunoLink.h"

int tmpsns = A1;

TimePlot tempPlot("tmp");

void setup() {
  pinMode(tmpsns, INPUT);
  Serial.begin(115200);                   //pick your favorite baud rate!

void loop() {
  int tempRead = analogRead(tmpsns);      //read sensor
  tempPlot.SendData("Temp", tempRead);    //send data to plot

Reading Outputs from a Project

Upload your code, launch MegunoLink, then drag and drop a few panels to get things how you want them. To get some data that would be worth looking at, I just waved my hand around above the sensor a bit.
Among our panels for this project, we have a basic serial monitor. Note the way that the data is tagged.

If you wanted to forgo the provided library, or if you were using a different device, you would just use a normal serial print statement to send these messages (where the number at the end of each line is the actual reading from the sensor and the rest of the line is the tags for MegunoLink).
From that data, MegunoLink constructs a simple time plot. I left most of the settings at their defaults, but virtually everything about this plot is customizable, from the labels and limits on the axes to the colors of the plot and the shapes of the points. You can zoom and pan or even export the data to a CSV file with one of the buttons at the top.
If you need, you can even handle more than one graph at a time, whether you want them in separate panels or overlaid in the same panel. You can also use the tags on the data to direct the information to a table, to a specific serial monitor, or to a standard x,y plot (you would, of course, need to supply the value for both axes).

Providing Input to a Project

You can also do some cool stuff using MegunoLink as an input for your project. You can add an interface panel, drag buttons, sliders, drop boxes, checkboxes, labels, text boxes, progress bars—you name it. You can then specify what each control does by defining a string for it to send over serial.
For example, I created a panel with three buttons.

Each button sends a simple message—for example, "red", "blue" and "green"—and my Arduino is programmed to listen for those messages on the serial line. When one is received, it completes a specific action. In this case, these messages toggle an LED of the appropriate color. I had a lot of fun with this one, including hooking up a robot arm with buttons and sliders to control each of its joints. The are loads of possibilities.

Of course, the program isn't suited for every application. If you're just blinking a light, MegunoLink may be more complexity than your project needs. It's also only compatible with Windows and does require a bit of installation, but it does its job well. If you're looking for an easier way to read data from or send input to your Arduino or Raspberry Pi project, MegunoLink could be a good fit for you.

MegunoLink has a free trial if you'd like to try it on one of your projects. Do you have a favorite interface development tool for Arduino or Raspberry Pi, especially one that works on Mac or Linux? Let us know in the comments!

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Share this

Related Posts

Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.