AWind: GUI library for Arduino - TFT and OLED Displays

Introduction: AWind - Arduino window library https://github.com/AndreiDegtiarev/AWind. Provides simple way of creating GUI for TFT-touch and OLED displays. Chart windows, labels, buttons, editable text boxes, tab controls help to develop complex user interface for Arduino applications

Features: [u]Consistent window layout handling:[/u] it is possible to create dynamic multi-window GUI [u]Events routing:[/u] framework forward events like touch action or sensor events to target window avoiding cumbersome construction with many “ifs” [u]Sensors:[/u] Sensors are treated as special type of events generator objects and they are integrated seamlessly via slim wrappers into AWind framework [u]Hardware:[/u] UTFT and Adafruit GFX compatible displays. Arduiono Mega and DUE boards. ESPxx boards are comming soon

Examples: TFT [u]Simple text:[/u] demonstrates how text can be edited by use of virtual keyboard [u]Gauges:[/u] demonstrates how to use gauge and button controls [u]Charts:[/u] simple chart is created and dynamically updated [u]Dialogs:[/u] demonstrates how handle nested dialogs in AWind library [u]Oscilloscope:[/u] more complex example where signal is measured on analog pin and plotted on chart window. The parameters of signal acquisition (sample ratio and length) and parameters of chart (Y-Axis scaling) can be adjusted at runtime. [u]Vacuum pump:[/u] This advance example demonstrates how to work with tab controls, timer, how interact with stepper motor, relay and etc. [u]SensorsMonitor:[/u] example is based on my own application to truck temperature, humidity and air pressure from different sources. Results of measurements can be presented in text or in chart from. Sensors in example are working in Demo mode so that real wiring isn’t needed OLED [u]OLED DHT:[/u] demonstrates how visualize DHT sensor data on OLED display [u]OLED Oscilloscope:[/u] demonstrates how visualize analog signal in form of chart [u]OLED Smart charger:[/u] smart charger for AA NiMH batteries

Installation TFT via UTFT library UTFT: http://www.rinkydinkelectronics.com/library.php?id=51 UTouch: http://www.rinkydinkelectronics.com/library.php?id=55 OLED via Adafruit-GFX-Library Adafruit-GFX-Library: https://github.com/adafruit/Adafruit-GFX-Library Adafruit driver for your display. In my case it is SSD1306 display. AWind libraries AFrame, ASensor and AWind libraries can be installed from awind_full.zip: https://github.com/AndreiDegtiarev/AWind/releases You need uncompress the content of awind_full.zip into arduinosketchfolder/libraries/ folder. Restart the IDE

Any feedback appreciated

some screen shots would be appreciated !

HazardsMind: It sounds similar to my library, but you included charts, oscilloscopes and sensor monitors.

My library is here TFT_Extension

Here in Germany answer would sound like „Jein“: mixutre from „Ja“ and “Nein” :-) I would say our libraries target different groups of applications. In your case it is more or less simple fancy GUIs that easy to use for beginners in c++. AWind library is more focused on events routing between different GUI-elements, GUI-elements updating depending on application needs (not each time complete display), handling of hidden/visible status and so on. This together results, of course, in longer learning curve, on the other hand allows more complex GUIs. Just small point about oscilloscope and sensor monitor you mentioned: they are not core features but just examples how AWind library can be used

robtillaart: some screen shots would be appreciated !

it was kind of challenge to link pictures hosted on github, but nevertheless somehow it works now with screenshots 8)

Like, also where did you obtain the Bezel? Cheers Peter

Randcook: Like, also where did you obtain the Bezel? Cheers Peter

The bezel I found here http://www.exp-tech.de/Zubehoer/Gehaeuse/LCD-Bezel-3-2-Weiss.html from 4DSystems http://www.4dsystems.com.au/product/Bezel

it is not 100 % fit to my display, but it is still better as nothing

Examples were extended with gauges example (see first message in this topic)

Nowadays everything is “flat” but nevertheless some 3D-ness is introduced (see example screenshots)

Hi Andrei,

This is a really well written set of libraries - great job! I have a small sensor network set up using RF24 modules that send the data to a 'base station'. I am wondering if you have any examples on how to use the NRF24Transceiver sensor?

I never noticed this Thread until now.

I didn't know you do that stuff with a Mega. I'm tempted to buy one of those screens just so I can play with it.

...R

Hello AndreiDegtiarev,

thank you for your AWind Library. Im Trying to get your example to Work but cant:(

Hoepfully someone can help me.

I have a Due and 3.2 TFT as ITDB32S, the Utouch and UTFT examples all work great.

I get the following error when compiling your example "TEXT"

Arduino: 1.6.0 (Windows 8), Platine: "Arduino Due (Programming Port)"

In file included from C:\Arduino\libraries\AWind/Window.h:27:0,

from C:\Arduino\libraries\AWind/WindowsManager.h:23,

from Text.pde:24:

C:\Arduino\libraries\AWind/DC.h: In member function 'void DC::DrawNumber(float, int, int, int)':

C:\Arduino\libraries\AWind/DC.h:130:31: error: 'dtostrf' was not declared in this scope

dtostrf(number,0,dec,_buffer);

^

In file included from C:\Arduino\libraries\AWind/WindowsManager.h:24:0,

from Text.pde:24:

C:\Arduino\libraries\AWind/KeyboardWindow.h: In member function 'void KeyboardWindow::Initialize(float, int)':

C:\Arduino\libraries\AWind/KeyboardWindow.h:76:40: error: 'dtostrf' was not declared in this scope

dtostrf(value,0,precision,_editBuffer);

^

Hopefully someone can help.

Thanks,

eychei

In order to be able to use this library with the Arduino Due I had to do two things:

Replace instances of "HardwareSerial.h" with "Arduino.h" (e.g. in "log.h" under AFrame)

The Arduino Due does not have a dtostrf() function so I had to add this:

char *dtostrf(double val, signed char width, unsigned char prec, char *sout) { char fmt[20]; sprintf(fmt, "%%%d.%df", width, prec); sprintf(sout, fmt, val); return sout; }

to the files that require it (compile errors will tell you which ones - one is KeyboardWindow.h and another is DC.h (both in Awind) - there may be more, I haven't tried every demo yet.

Hope this helps!

Chris

You could ask for include these libraries inside official IDE's "Library Manager" (you should create an issue in Arduino's github asking for it)

For my new project I needed to add dust and air quality sensors (ASensor library is updated). I have used this opportunity to update all AWinds libraries to the new Arduino IDE version (arduino-1.6.5-r5). Actually everything works good except small changes. @eychei and cbrandin: I don’t have Arduino Duo, but I have managed to compiled my examples with new UTFT library without any error messages.

Regards

Andrei

AndreiDegtiarev:
I have used this opportunity to update all AWinds libraries to the new Arduino IDE version (arduino-1.6.5-r5).

Do you know if your latest version will work with the older versions of the IDE?

Unfortunately the Arduino folks don’t seem to bother with backwards compatibility and there are quite a few Threads on the Forum where people have problems using well established libraries with the newer IDE.

I have not found any reason to progress past 1.5.6

…R

Hi Robin,

I was not aware of that problem with compatibility between different arduino versions, thank you for point me that. I tested AWind libraries on arduino-1.5.6-r2 release and I can compile them without any problem but only in Arduino IDE. Usually I compile all my projects in Visual Studio with Visual Micro add-on (see ABuild git-hub repository) and in the case of Arduino 1.5 version I get strange error: “core.a(new.cpp.o)*:In function `__cxa_pure_virtual'”. By the way I forgot to mentioned that I had to change the RF24_config.h in RF24 library because of new Aduino version (see installation instructions for ASensor library)

Regards

Andrei

Hi Andrei

I found your AWind library when looking for a "mobile keyboard" for a Arduino 3.2" TFT touch screen. Since your library only has a "keypad", I have extended your library with a mobile keyboard based on your keypad, which I will use in a Arduino Mega 2560 program.

I like your implementation of a windows manager and would like to use it, but I am having difficulty on figuring out how to use it exactly. Is there any detailed documentation for your AWind library on how to implement multiple windows?

I have a main window that displays 3 buttons. When I click on one of the buttons, I want it to open another full screen window that contains information. This information can then be edited using the mobile keyboard I created. My problem is, I can't get the information window to display. Must the information window be implemented as a dialog or is it another window that is opened somehow over the main window using the windows manager?

In total, I will have about 7 windows that need to be displayed, which will be opened by clicking one of the 3 buttons on the main window.

Can you please advise on how to do this or provide some detailed documentation or examples. The examples you have only have one window containing buttons, text, charts, gauges etc.


In a separate issue, I tried to open either your keypad window or my mobile keyboard window depending on what button I clicked. But it always only opened the same keyboard window, depending on which keyboard window was first registered in the MainWindow constructor. I thought there might be a problem on how the window manager finds the window in the "FindDialog" function, but no matter what I tried, I couldn't get both keyboard windows to open.

MainWindow(int width,int height):Window(F("Main"),0,0,width,height), _keyboardWindow(3,100), _mobKBWindow(2,100)
    {
        _keyboardWindow.RegisterEndDialogEventReceiver(this);
        _modalWindow=NULL;
        RegisterDialog(F("Keyboard"),&_keyboardWindow);


        _mobKBWindow.RegisterEndDialogEventReceiver(this);
        _modalWindow=NULL;
        RegisterDialog(F("MobileKybrd"),&_mobKBWindow);

    }

Regards Lumox

Hi Lumox,

thank you for interesting in AWind library!

There is doxygen documentation: http://andreidegtiarev.github.io/AWind. It is not completed yet, but for the start it’s better as nothing. I am going to work on documentation further. Concerning your other questions: let’s make it step by step: if I understood right your are asking for kind of window selector functionality. As selector for windows you can take a look at example “Window Selector” I created in AWind library. This example demonstrated how visibility of windows can be controlled via buttons. Is this solution you are looking for or you need something different? About separate issue I need more explanation to understand what the functionality you are asking for, but let us speak about that, after we clarify “first issue”.

Regards,

Andrei

Thanks for the reply Andrei. I tried your WindowsSelector example and understand how it works. But it's not exactly what I want.

I have a main window with three buttons. What I want is when I click button1, it opens a new window - w1- that completely covers the main window. Clicking a button on window1 will then open a new window - w2- that will completely cover w1. On both w1 and w2, there will be a back button that when clicked, will close/hide that window and the previous window will be shown.

Click back button on window2, window1 shown. Click back button on window1, main window shown.

I don't want w1 being a window shown in the main window.

I have tried making w1 and w2 children of the main window, then hiding the main window when w1 is shown, but then I lose the touch ability on w1. If I don't hide the main window, then w1 and the main window are drawn over each other.

Any ideas?

I see now what do you want, Lumox. I found a bug in AWind find dialog function. The strcmp_P function didn’t work as expected for PROGMEM strings – I write my own. You need update AFrame and AWind libraries. There is one limitation still: only one nesting of dialogs is implemented at this moments. It means you can call dialog from window, but not dialog from dialog. I will try remove this limitation. If I don’t managed to do that in case of your special application I can imagine another solution, but as more general approach I would prefer dialogs. I’ll get back with solution.

Regards,

Andrei