Touch GUI for the official Pyboard display

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Touch GUI for the official Pyboard display

Post by pythoncoder » Sun Feb 19, 2017 6:40 pm

This is targeted at applications in machine control and for the display of realtime data. Controls are rendered using graphics primitives rather than icons: this ensures that the controls are readily scalable. It uses uasyncio for scheduling and provides an event based API based on callbacks.

It's best described as an alpha release; it needs further testing but there's an issue with the display's touch detection which is yet to be resolved (https://github.com/micropython/micropython/issues/2879). This means that the detection of long button presses is unreliable.

Image Image Image

There are further images in the GitHub repository. Don't judge the display by my dodgy photography. It looks great in reality.

GitHub repo:
https://github.com/peterhinch/micropyth ... cr-gui.git

Official display documentation:
http://docs.micropython.org/en/latest/p ... r.LCD160CR

Now includes a module enabling the display of simple graphs using polar or Cartesian coordinates:
Image Image
Last edited by pythoncoder on Tue Feb 21, 2017 8:01 am, edited 1 time in total.
Peter Hinch
Index to my micropython libraries.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Touch GUI for the official Pyboard display

Post by fpp » Mon Feb 20, 2017 7:39 pm

Hey, that looks fantastic !

How many buttons (keypad-style) do you think could fit in there, and still be usable (with nimble fingers :-) ) ?

BTW, the link to the documentation doesn't seem to work (yet ?)...

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Touch GUI for the official Pyboard display

Post by Roberthh » Tue Feb 21, 2017 6:31 am

Hello Pete, that looks very impressive. And reading though the github issues, it looks as if you are a hard user of that lcd library, really exploring it.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Touch GUI for the official Pyboard display

Post by pythoncoder » Tue Feb 21, 2017 8:14 am

@fpp Thanks for the report - broken link now fixed.

I'll be posting an update soon to enable the use of the device's internal fonts in addition to ones converted from ttf and otf files. External fonts are great at larger sizes but I'd expect the internal ones to work best if you want to create small controls. A 16 button hex keypad would be easy even with external fonts. If you want more it's largely down to eyesight and finger size (a stylus helps for precise touches). There are also bigger displays ;)

Robert - yes, I have been giving it some grief ;)
Peter Hinch
Index to my micropython libraries.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Touch GUI for the official Pyboard display

Post by fpp » Tue Feb 21, 2017 2:17 pm

Great, 16 buttons would be more than enough, thanks :-)

It's just too bad that micropython hardware is so expensive compared to the Arduino/Pi ecosystems...

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: Touch GUI for the official Pyboard display

Post by torwag » Tue Feb 21, 2017 3:44 pm

fpp wrote:It's just too bad that micropython hardware is so expensive compared to the Arduino/Pi ecosystems...
Well, that is not true:

1. This is about comparing apple with pears...
A 32bit uC at > 100 MHz is more expensive compared to a 8bit uC at 16 MHz... but they both serve a different purpose.

2. The ESP8266 is one of the cheapest uC units you can get and it is supported by MP.

Thus, I don't think it is more expensive. You need to see it more between a Arduino and a RPi and if you check, the price is between these.

As for skin boards, yes they are more expensive. However, that is mainly due to lower production amounts. I see it from this side. Whenever, you order some official MP-hardware, you spend half for the hardware and the other half you donate to further improve MP itself. This makes the hardware actually rather cheap ;)

User avatar
kamikaze
Posts: 154
Joined: Tue Aug 16, 2016 10:10 am
Location: Latvia
Contact:

Re: Touch GUI for the official Pyboard display

Post by kamikaze » Tue Mar 07, 2017 2:51 am

fpp wrote:Great, 16 buttons would be more than enough, thanks :-)

It's just too bad that micropython hardware is so expensive compared to the Arduino/Pi ecosystems...
Just take measurements from PyBoard/screen, learn basic FreeCAD stuff, model your own case, order a production. Then tell us how much have you spent including time. It's not a hard task, but still someone pays it's effort. Then learn electronics, learn KiCAD, make your board, order its production too. I'm not sure that it's a big price for existing solutions. I would rather say: "it's just too sad that there is no Teensy 3.6 support or faster PyBoard 2" :roll:

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Touch GUI for the official Pyboard display

Post by fpp » Tue Mar 07, 2017 6:42 pm

Torwag & Kamikaze :

I'm sorry if my remark came across as too harsh, it was not the point.

I'm fully aware that the additional costs are due in part to the power needed by a python interpreter (compared to compiled C code), in part to sustaining the project (which is good), and in part to small batch runs for addon boards (which is unavoidable).

It still remains that compared to the dominant Arduino ecosystem (which has the exact opposite advantages), the joy of coding in python instead of C comes at quite a price.

Also, the "coding in python" part is somewhat relative: it's python syntax, yes, but the way you need to use it to get around the microcontroller quirks makes it a very different experience. Even for an experienced desktop programmer, the learning curve is not negligible.

Last year I did the exact same project twice :

Once with an Arduino, as a total newbie to the platform, by reusing relevant C code I'd found on the Web.
Adapting it to my needs was painful (I hadn't touched C for many years), but all in all it was a day's work.

Then I redid it on a Pyboard, and was surprised at how hard it felt. If it hadn't been for this forum I would probably have failed.

One area where the Pyboard shines, though, is the USB mass storage mode: being able to change code and/or data anywhere, any time with a simple text editor (even Notepad :-) ) is really invaluable.

(and yes, I would buy a faster pyboard2 instead of yet another pi Zero :-) )
Last edited by fpp on Fri Mar 10, 2017 6:08 pm, edited 1 time in total.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Touch GUI for the official Pyboard display

Post by pythoncoder » Fri Mar 10, 2017 10:11 am

Programming a microcontroller requires different skills compared to desktop programming. That fact is independent of the language in use, and the skills are transferable between languages. To make effective use of a uC you need a basic grasp of electronics. Being able to read hardware datasheets is handy. Knowledge of realtime programming is necessary to make effective use of interrupts and familiarity with asynchronous programming (e.g. asyncio) is useful. I don't think anyone said it was easy...

That's what makes it more interesting than commercial database programming ;)
Peter Hinch
Index to my micropython libraries.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Touch GUI for the official Pyboard display

Post by fpp » Fri Mar 10, 2017 6:11 pm

Indeed, that was a large part of the culture shock...

I had bypassed that with my first Arduino experience by following tutorials (a dime a dozen, the hard part is finding the right one) and copy/pasting code that already did what I wanted...

But it's harder to escape in the micropython world at this time :-)

Post Reply