It can be a tricky task to debug and visualize realtime data on the Arduino board. You are usually stuck with the standard serial output, as the complexity of your Arduino code grows this makes it impossible to comprehend what is actually going on inside the board. To solve this I have created a little library that will enable you to create your own custom GUI for your Arduino projects. Watch this video to get a demonstration of a basic hello world with a potmeter and a diode:
As of now, the program has the following possibilities and features:
Custom design your interface from the Arduino board
You define which sliders, graphs and buttons you need for your interface. You do this in your Arduino sketch which means that the gui program acts as a slave to the sketch. All information is stored in your board.
Visualize and manipulate realtime data
Whether you are making an RGB light controller or a robot arm, getting a graphical feedback is crucial to understand what is going on inside the board. This enables you to understand whether it is your hardware or the code that is causing problem. Further the sliders and buttons enables you to tweak the individual parameters in realtime. This way you can see what effect different thresholds have on the interaction.
Save the parameters in the boards memory
When you have tweaked the parameters you can save them to the EEProm of the board. The parameters will be auto loaded next time you power on the board, even if the computer is not connected.
Use the same app for all your Arduino projects
I have made tons of small apps for different projects. My problem is always to find them again a year later. Because we save everything in the Arduino I only need to keep one app around the Arduino will automatically configure the app for the current project.
Prototype the interface before you turn on the soldering iron
Because you can design the gui as you like it (within reasonable limits), you can prototype the interface before you have made a physical interface. This also enables you to divide the tasks between multiple people e.g. one person is working on the hardware and another person is working on the code. When you have made the physical interface the Guino will integrate seamlessly.
Use it as a fullscreen dashboard
You can use it as a fullscreen dashboard by pressing F and pressing T toggles the visibility of the settings panel. You hereby only present your custom interface for the world around you.
Control the background color
The background color can be controlled from the Arduino this enables you to create different colors for different sketches. It can also bes used to make alerts when something is wrong. It can be green when everything is ok and red when something is wrong.
Fast and Slim
I have taken great care in making the footprint on the Arduino as small as possible - It only stores a minimum amount of data in the memory (concretely a pointer list of 100 items). This setting can be changed to lower or higher depending on the amount of gui items you intend to have in your interface. Further the system relies on the EasyTransfer library which transfers the information in binary form. Each package consists of a byte for command, a byte for item # and an integer for the value. Ideally, all your data should be normalized to a 16 bit signed integer range. This means optimal usage of the serial port when working with integers (technically we use a little extra space for a checksum).
Good for Instructables
The GUI enables you to make Instructables that only requires the core components. Extra components like potmeters etc. can be made virtually via the gui.
Limitations and future plans
Right now the app has been compiled to the Mac OSX and Windows platform. It is written in Openframeworks so It should be able to run on other platforms as well. Since the app is using the serial port you will not be able to connect other programs to the Arduino. This will be solved in a future release which will include a Open Sound Control and a Midi bridge.
Credits:
Programming and idea by: Mads Hobye
Easytransfer library by: Bill Porter
GUI library by: Reza Ali
Step 1: Getting started
- Download and unzip the GUINO package.
- Download Arduino
- Copy the libraries folder to your Arduino libraries folder (how to here)
- Restart Arduino.
- Open one of the examples within Arduino. (Menu: Files -> Examples -> Guino -> pick one)
- If you use the simple example then make a circuit as illustrated above.
- Upload the example.
- Run the Guino app.
- Choose the serial port (Usually the last one)
- Press connect.
Step 2: How to modify the code
gInit() this is where you define your layout
This method defines the layout by adding components sequentially. Components that can be changed (slider, buttons etc.) have a variable attached to it. The & in front of the variable means that we do not want to pass the value in the variable, but we want to pass a reference (pointer) to the variable. This way the Guino system automatically updates them when changes happens in the GUI.
void gInit()
{
gAddLabel("SLIDERS",1);
gAddSpacer(1);
gAddSlider(3,200,"WIDTH",&width);
gAddSlider(3,200,"HEIGHT",&height);
gAddSlider(0,255,"LED BRIGHTNESS",&ledLight);
// The rotary sliders
gAddLabel("ROTARY SLIDERS",1);
gAddSpacer(1);
[.............]
gAddColumn();
// Add more stuff here.
gSetColor(r,g,b); // Set the color of the gui interface.
}
GButtonPressed(int id) this is called whenever a button has been pressed
Generally variables can be updated automatically, but in the case of a button it needs to be an event you take care of. In this example we set the height variable to 100 when somebody presses the button.
void gButtonPressed(int id)
{
if(buttonId == id)
{
height= 100;
gUpdateValue(&height);
}
}
gItemUpdated(int id) This is called whenever and item has been updated
It is usually not necessary to use this since the system will update the variables automatically. If you want to react to a change you can use it as such. In this case we are updating the background color whenever one of the 3 rotary sliders has been changed.
void gItemUpdated(int id)
{
if(rotaryRID = id || rotaryGID == id || rotaryBID == id)
{
gSetColor(r,g,b);
}
}
Step 3: A few quick tips
You cannot have the Guino running while uploading a new sketch to the Arduino board, because they use the same serial connection. This requires you to disconnect every time you upload a new sketch. If you (and you will) try to upload while having the Guino connected, the board can go into some strange state where it is kind of running, but not quite. At this point your only option is to reset the board by pressing the reset button or by disconnecting and reconnecting the usb cable.
Known bugs
As of now the system is working and stable. The following are bugs one should be aware of:
- setMin does not work on a movingGraph (there seems to be a bug in GUI library that needs to be fixed). So minimum stays on zero.
- The serial list is loaded when starting the program. The Arduino has to be plugged in before starting the program. Refreshing the serial list while running cause a bad event. It has yet to be solved.
- Fiddling with the serial list - sometimes makes the program crash (same gui event as refresh - have to find the source)
- Toggle buttons background becomes black depending on initialization. I need to set the background manually.
- On some windows platforms the com port does not show up. Might be a ftdi driver issue.










































Visit Our Store »
Go Pro Today »




Is it fine to use this function for the string to change while running the guino(while we are changing the touch configuration) without disconnecting and again connecting it ?
Here is what I did...
made 2 labels
timeLabel1 = gAddLabel("TIME: ",1);
gAddSpacer(1);
dateLabel1 = gAddLabel("DATE: ",1);
gAddSpacer(5);
and in the code somewhere made a function to call each second. You can use ds1307 and 1hz interrupt of just check if seconds and different.
// used to trigger something every second
int currSec = second();
if(currSec != prevSec)
{
// Clock ticked over another second
PrintTime();
// Update the display
prevSec = currSec;
}
void PrintTime() {
String stringOne = "TIME: ";
stringOne.concat(hour());
stringOne.concat(":");
if(minute()<=9) stringOne.concat("0");
stringOne.concat(minute());
stringOne.concat(":");
if(second()<=9) stringOne.concat("0");
stringOne.concat(second());
stringOne.toCharArray(charBuftime, sizeof(charBuftime));
String stringTwo = " ";
stringTwo.concat(Day[weekday()]);
stringTwo.concat(", ");
stringTwo.concat(Month[month()]);
stringTwo.concat(" ");
stringTwo.concat(day());
stringTwo.concat(", ");
stringTwo.concat(year());
stringTwo.toCharArray(charBufdate, sizeof(charBufdate));
gUpdateLabel(timeLabel1, charBuftime);
gUpdateLabel(dateLabel1, charBufdate);
// the following has nothing to do with time just blinks a LED each second
// if the LED is off turn it on and vice-versa:
if (ledState == LOW){
ledState = HIGH;
ledLight = 1;
}
else {
ledState = LOW;
ledLight = 0;
}
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
digitalWrite(13, ledState);
}
works great... but had to put time and date on two lines since the font is not like courier but variable width and I did not like the seconds bouncing all around since a '1' is not as wide as a '8'.
I used an array to print out the date like: Monday, March 8, 2013.
If you need that part let me know.
Not sure what you mean by data logging. If you can explain that part better I will look at it. Mental block here I guess.
Also did get it to work with Mega BUT had to use Serial 3 port. That way I can upload and use GUI at same time. But my program is bigger than yours probably. Had to raise 100 item limit to 150. I had too many items to display. I guess each label or graph is an item. Mine is 5 columns wide as I am using it for automation control display.
Let me know...guy
Yes .. See my image of what I have done.
If you can not see clearly send me an email at regular email and I will send you a bigger image. Also some code. You should be able to get my email name in my personal data info. If not let me know and I will send one here for you to use.
I have made several labels and update the temps every minute and also have labels where I update events that happen with time/date stamp when they happened.
Basically you use a gLabel and then control what you want done to it in the code by calling a function with the name you set up for the label. I also am using a 2560 since my code for Guino is now at 80K.
int B_E1=0;
void setup() {
gBegin(12345);
pinMode(E1, OUTPUT);
}
void gInit() {
gAddToggle("E1",&B_E1);
}
void loop() {
guino_update();
if (B_E1)
digitalWrite(E1, HIGH);
else
digitalWrite(E1, LOW);
}
Thanks a lot
Great work on the GUI. I'm having trouble understanding how the toggle is supposed to work. The variable starts as false (as I initialized it). When the button is pressed, it goes to true. Then when pressed again, it just stays at true. I want it to go to false when pressed again.
http://arduino-info.wikispaces.com/Arduino-Libraries
Thanx for this awesome GUI for Arduino.
I am getting one problem......the moving label is not getting updated in real time.....I have to disconnect and then connect the GUINO for the change in the Label. Can you please assist me in this problem as soon as possible.
I am also getting the problem in changing the size of label.....only 2 and 1 can be used. I want to increase the size more than that.....
#include <Time.h>
int flexLabelId =0;
void setup(){
gBegin(34236);
setTime(19,3,0,22,3,13); // set time to noon Jan 1 2011
}
void loop(){
// **** Main update call for the guino
guino_update();
// digitalClockDisplay();
gUpdateLabel(flexLabelId, digitalClockDisplay());
delay(1000);
}
void gInit()
{
gAddSpacer(1);
flexLabelId = gAddLabel("",0);
gAddSpacer(1);
}
void digitalClockDisplay(){
// digital clock display of the time
printDigits(day());
Serial.print(".");
printDigits(month());
Serial.print(".");
Serial.print(year());
Serial.print(" ");
printDigits(hour());
Serial.print(":");
printDigits(minute());
Serial.print(":");
printDigits(second());
Serial.println();
}
void printDigits(int digits){
// utility function for clock display: prints preceding colon and leading 0
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
void gButtonPressed(int id)
{
}
void gItemUpdated(int id)
{
}
About the rest. It sounds like valid improvements. You should dig into the source and start extending the framework.
float a
int b
b = round(a*10)
thanks
Else you might have the serial monitor running in the backgrond.
Make OpenSource for OpenHardware!!!
https://github.com/madshobye/guino
OF: OF_LOG_NOTICE: ofSerial: listing devices (0 total)
OF: OF_LOG_WARNING: OFXUIDROPDOWNLIST: DON'T USE THIS CONSTRUCTOR. THIS WILL BE
REMOVED ON FUTURE RELEASES.
size♦
Arduino sees my USb serial port just fine (COM4).
Is there anything I can do to make it work?
Cheers,
E.
I have had problems with one windows machine running it as well. I have not been able to pin point the cause. Maybe reinstall the ftdi drivers?
I am not sure what you mean by two devices...