If you want to integrate a nice graphical interface with a microcontroller or single-board computer for a useful piece of custom equipment, how will you go about it? MyOpenLab is a platform that makes it easy to design virtual interfaces your electronic builds. If you want controls and readouts for Arduino, Raspberry Pi, Android, or anything with a serial port, this is worth a try.
MyOpenLab reminds me of LabView. Not so much modern LabView with all of its add-ons and extras, but LabView back when it did just a few things but did them really well. The open source MyOpenLab project has been around for a while. The website and documentation are not in English, which may have kept some people from giving it a try, but the software itself is available in German, English, and Spanish. I took the plunge and found the language barrier didn’t cause me trouble.
As an example of what you can do, image you want to build a custom bench tool. You build virtual device (they call it a “VirtualMachine”) that uses your computer as the control panel and readout, and your electronic project as the physical interface. In myOpenLab your device will consist of two parts: a diagram and a front panel. Some things only live on the diagram, like a timer or a connection to an Arduino. But some things live on both like switches, LEDs, graphs, and so on. You can connect all the little boxes together to build up applications. They can stand alone, but the power comes in being able to connect to an Arduino or Raspberry Pi (or a few other options) for I/O.
A Quick Project
You can see the front panel here. The Jolly Wrencher is just a graphic added for decoration along the other items and labels that make the front panel look nice but don’t show up in the working diagram. The diagram is where you specify connections between your virtual front panel and actual hardware you want to control. You also have the power to add logic to existing hardware inputs.
The Firmata block (Firmata is a protocol for communicating with microcontroller boards) is used to represent the hardware interface of your project and has a few interesting properties. First, you really need your board hooked up and working before you put the block down as it reads things even before you run your virtual machine. You can set the serial port to use and the refresh interval for inputs (apparently in milliseconds).
I wired two buttons connecting an Arduino’s pins 7 and 8 to ground, each with a 10K pull-up resistor. This biases the pin values so that MyOpenLab can read a 1 on those input pins when the buttons idle and a 0 when the buttons are pressed. I use this to illustrate the cool logic abilities of MyOpenLab. On the right side of the firmata block I invert the buttons since they are active low and then feed the result to an RS flip flop. A virtual LED on the front panel shows the state of the flip flop.
To the left of the firmata block, I have a slow timer and a virtual switch. This goes through an OR gate and an inverter to drive pin 13 of my Arduino (the LED built into the board). The net effect is the LED will blink unless you turn the virtual switch on the MyOpenLab front panel on. It is MyOpenLab that times the blinking.
You can also right-click on a wire and set a testpoint. During operation, you can open a window from the Window menu and display the test points easily. You can also open a little oscilloscope display that will show you all your digital or analog signals.
Pretty simple and while this is a silly example, you can see from the components you could put together a pretty significant system. There are quite a few examples in the VirtualMachines folder if you want to look at some meatier examples.
Now lets get into the details of working with MyOpenLab.
Working with the User Interface
The user interface is not bad at all. On a high-DPI monitor I found it is a bit small and there wasn’t a clear way to zoom it (but I’ll tell you how I fixed that later). Things work about how you’d expect. You pick components of the horizontal palette above the workspace then click on the workspace to place them. Note the palette changes if you are on the diagram (circuit panel) or the front panel.
Once in a while, you’ll see something that didn’t get localized for the English version of the software (the contadores de tiempo folder has timers in it). I also ran into a few components that insisted on throwing Java errors pretty much nonstop related to painting. They seemed to work, they just threw some Java exception. I did work out some Java fixes under Linux which I’ll detail later on.
Drawing interconnecting lines was a bit difficult. You have to start from the source, click, and then move to the destination and click again. The green lines were hard to see on my monitor and there was no way I could see to change the colors. You can only connect one output to one input. If you right click on a wire, though, you can add a node which will allow you to make another connection to that node. You can also pick the splitter component from the extras folder.
If you click on an object, there some help text that shows up on the right (often missing) and a property inspector on the left. Some of these require a little detective work on your part. For example, in the timer component, the high-level property sets the time in output is high and low-level sets the time the output is low. Both times appear to be in milliseconds.
What was interesting to me was the number of backends available as I/O devices. You can talk to an Arduino using Firmata but several others are also available. You can talk to a Raspberry Pi, Modbus, Processing, several commercial I/O interfaces, and the RS232 port. I wished there was a backend for Sigrok or USBTMC.
Then again, this is open source, so I guess I should add it instead of complaining. The project is hosted on SourceForge. Don’t get confused by the code you’ll get using the download button there (that’s an old version). If you look on the “code” tab you’ll find the subversion details to check out the most recent code:
svn checkout https://svn.code.sf.net/p/myopenlab3/code/ myopenlab3-code
Getting things to work was a little challenging. Many Java programs don’t pick up my big screen correctly — I probably need to update my JVM. After I got tired of squinting, I ran Xephyr and passed it a fake DPI:
Xephyr -dpi 100 :3 -screen 1800×1200 -dpi 100 ; DISPLAY=:3 twm ; DISPLAY=:3 ./start_
Xephyr is like Xnest. It creates a virtual X Windows display in a window on your desktop. That made the mouse cursor a little funny which didn’t help with the wiring, but it was workable. Sure would be nice if the interface could zoom in and out, but as far as I could tell it doesn’t.
However, I had an even bigger problem. The program depends on the RXTX library to talk to the serial port. At first, it could not find my installation. I knew it should work because the Arduino IDE uses the same library and that was fine.
But that wasn’t the end of the problem. The Arduino enumerates as /dev/ttyACM0 or perhaps some other number depending on what else is connected. The program would find ports that show up as /dev/ttyUSB* and /dev/ttyS* but didn’t want to show any ports with ACM in them. In a Kobayashi Maru maneuver, I issued the following command:
ln -s /dev/ttyACM0 /dev/ttyUSB99
Then MyOpenLab found /dev/ttyUSB99 and I was in business. I don’t like to lose.
There’s a lot more to explore with this tool. There are dozens of components ranging from simple gates to PID controllers. However, this should get you started. If you speak Spanish, you are set. If you don’t, don’t forget that your browser probably has a translate button or you can use an online translator — you may have to hunt to translate the whole manual (or borrow my copy). Of course, the translations leave something to be desired. There is a forum that has a good bit of English. There’s also a YouTube channel, that has some English and was updated recently.
One thing to note about the YouTube videos. At least some of them have some English subtitles. For example, check out the introduction video below and turn on closed captioning in the YouTube viewer. Unfortunately, the translation stops when you get to the good stuff, but you can still follow what’s happening pretty well.
Read more: hackaday.com