September 2024 - Version 2.0.0 Available! see below
Virtual Panel is a UI toolbox for experiment control and display. It is a combination of a Windows application and two small Arduino libraries.
Writing only Arduino code, it is easy to set up control over experiments and display results on the panel application on your PC.
The panel allows to select controls from an existing set of displays, LEDs, buttons, sliders and more.
A button click or slider change causes an event in the Arduino code.
This way you can set up control and output with a minimum of easy understandable extra code.
ExperimentThe first intended purpose of the panel is to support experiments, making it quick to setup control and display output. Either as text or as graph.
PrototypeThe second purpose is to support prototyping. The panel lets you figure out quickly what controls you need and how they should work. Making the step to a hardware implementation easier. I find, however, that in many cases the VirtualPanel Implementation "will do" and is convenient enough to serve it's purpose.
New Version(s)After the initial publication of this project several new versions have been created. These add a number of new features including reading and writing files from the Arduino on the PC, Graph inputs, PanelColor and a lot of smaller inprovements. In the latest version (V2.0.0) VirtualPanel was adapted to be used with Arduino Zero, Arduino Uno R4 and Arduino Nano ESP32, The ArduinoPort protocol enhanced to beter detect faults and a large number of fixes wer made. For a complete list see: ReleaseNotes. For a complete list see: ReleaseNotes. To get a quick overview if all functions supported see the Quick Reference Guide. There is quite a lot there, but don't be intimidated. VirtualPanel requires just a few lines of code (see Minimal code) to start working. Most experiments require only little more code than this.
WalktroughWalkthroug based on version 1.0.3 and before. See New Version(s) for newer features.
FeaturesGeneric functions: (Unix)Time, Beep, Reset, File-IO
The VirtualPanel application features 5 panels with different functions:
- Main Panel
Basic set of Buttons, Displays, Led's and Sliders. This panel is always visible.
- Monitor Panel
Additional display space (for instance for debugging) and a scroll box for logging.
- Graph Panel
Graph and draw functionality.
- Info-Panel
Informational text on your experiment. Including possibility to link to documentation web pages.
- Message Log Panel
Messages log of communication between Arduino and VirtualPanel.
- File Controls
From the Arduino you can read an write files.
The Main Panel and Graph Panel feature a predefined set of controls that can be selected from the Arduino. The Monitor- and Info Panel have a defined appearance where the Arduino controls only the content. The Message Log Panel simply log all messages.
TutorialIn the VirtualPanel examples you find a sequence of examples show how to use the different features.
These examples can easily be adapted or combined to meet your requirements.
In addition you find a set of showcases(only for AVR/Uno, Nano, Mega) turning your Arduino into an oscilloscope, logic analyzer, frequency counter and more.
Programming VirtualPanelA code example from the tutorial set. This example sets up a panel with just a button a led and a display.
#include "VirtualPanel.h"
bool Power = false; // Power status
int Value = 0; // Integer variabel
void setup()
{
Panel.begin(); // init port and protocol
}
void loop()
{
Panel.receive(); // handle panel events form the panel (must be in the loop)
if (Power) Value = random(1,100); else Value = 0; // my own proces
Panel.sendf(Display_1,"%d",Value); // Show Value on display_1
delay(250); // delay
}
void PanelCallback(vp_channel event)
{
switch (event)
{
case PanelConnected: // receive panel connected event
Panel.send(ApplicationName,"Minimal"); // set the application name
Panel.send(Led_1,"$OFF"); // Turn Led_1 off (black)
Panel.send(Button_3,"on/off"); // Button_3 visible and set text "on/off"
break;
case Button_3: // Catch button pressed
Power = !Power;
if (Power)
Panel.send(Led_1,"$RED"); // Turn Led_1 on (red)
else
Panel.send(Led_1,"$OFF"); // Turn Led_1 off (black)
break;
}
}
Auto ConnectOn startup the panel automatically looks for a Virtual Panel enabled Arduino board and connects to it when found.
Tested OnThe panel library has been tested on UNO, NANO, MEGA, MEGA2560, DUE, Micro, Leonardo, ESP8266 and ESP32.
Download / DocumentationIn the VirtualPanel Library - examples you find a set of tutorial sketches.
Download: https://github.com/JaapDanielse/VirtualPanel/releases
Documentation: https://github.com/JaapDanielse/VirtualPanel/wiki
Comments