I have been crashing around with my new Clue for a week or so now, and I need to start making progress. It is an awesome little gizmo, and I think we are going to have a lot of fun together.
I have a project to complete, a customer (the most important one, my Mrs) and a deadline, so you guys are my resource. Welcome to the team!
My current problem is specifically in the area of the display and how to drive it. It may be that I cannot do what I want to do with CircuitPython and I need to move to something more industrial, in which case, now is the time to find that out.
My project is to get the CLUE to monitor a thermocouple that is plugged into a pottery kiln.
It should:
- Display the current kiln temperature by looking up a table that maps the thermocouple reading to temperature;
- Display the target temperature hard-coded into the program (one day, it may be adjustable using the buttons - but later);
- Indicate if the kiln temperature is static, going up or going down;
- Sound an alarm and blink the temperature display when the target temp is reached.
Version 207 might communicate to an app via Bluetooth, but at the moment, I am happy to use the CLUE's display. This is therefore, a very basic program. Except for driving the display.
My sketch design has an all-white screen with a large-font number in the top 2/3 of the screen displaying the current kiln temp, (e.g. "1010ºC⬆︎") and under that, a smaller-font number for the target temperature (e.g. "➡︎ 1100ºC".) The 2.0 version might display the actual temp in red if it is increasing and blue if it is falling. The sensor programming and decision-making logic is easy, but the display coding solution is, at this point, a mystery.
There is a sample program in the Clue page that displays temperature and pressure. It is a useful framework but the data display does not do the Clue's beautiful little screen proud. I really want to use the whole screen to display the data, with the actual temp in YUGE print that can be read from the other side of the room, and the target temp in smaller print.
I get the impression I will need something more than a couple of print statements. I suspect some graphics coding may be required, but I haven't found anything that looked appropriate.
I tried using this sort of thing but it only allows one text area at a time on the screen, so it cannot support two lines of text of different sizes.
# Create the text label
text = "1150" + chr(247) + " C"
text_area = label.Label(font, text=text, color=red, background_color=white, scale=6)
text_area.x = 20
text_area.y = 40
display.show(text_area)
Problems with this are:
- scaling makes the fonts pixelated, so I will need to find a larger font (or maybe a scalable font if that even a thing);
- it can't do two lines with different text sizes;
- the background colour attribute only colours the character cells, not the whole screen;
So I need a different approach.
Any hints? I am not looking for a solution - but I could use some direction from more experienced minds.
Thanks for your help!
How do I drive the display?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: How do I drive the display?
You should be able to do everything you need with CircuitPython. And fair warning: dropping back to C++ would take a lot of time and effort, basically re-implementing a lot of the code that already exists for CircuitPython.
Take a look through the existing CLUE tutorials for examples of doing graphics with the screen:
https://learn.adafruit.com/products/4500/guides
Those will point you toward the libraries/modules that do more than basic text.
Take a look through the existing CLUE tutorials for examples of doing graphics with the screen:
https://learn.adafruit.com/products/4500/guides
Those will point you toward the libraries/modules that do more than basic text.
- Russell2Point0
- Posts: 9
- Joined: Sun Jan 03, 2021 12:11 am
Re: How do I drive the display?
Apologies for the absence - I was swamped by a Honey-do list overflow...
I most definitely want to avoid writing in any language with a capital C in its name. I did enough of that last century. CircuitPython it is. What I dream of is the Adafruit Clue Display Programming Reference Manual - CircuitPython Edition. You know - the one that describes everything the display can do and how you can get it to do it. All the other do-dads on the board have simple interfaces, but the display is quite capable, by the look of it, and a single-point reference that tells us everything we can get it to do would be pure gold.
So the implication from the above comment is that there is no centralised, grown-up document that describes all available functions in the Clue’s display classes. Is that correct?
Is it true that the only way to find out what is possible is to minecraft the examples in the hope that one of them does something of value for my project? By implication, the only way to know that I have the ~best~ solution is to examine and understand every project.
Also, it implies that every available function is covered by an example somewhere. Is that the case?
Not trying to be nit-picky - just coming to terms with the new reality of post-modern software documentation. I don’t really miss the 3” ring binders with the pages falling out, but I feel like there is an option in the middle that I have missed.
Thanks for your help,
Russ
I confess I haven’t gone looking for the source to the Clue’s various display classes - it is accessible?
So many questions! My apologies -
I most definitely want to avoid writing in any language with a capital C in its name. I did enough of that last century. CircuitPython it is. What I dream of is the Adafruit Clue Display Programming Reference Manual - CircuitPython Edition. You know - the one that describes everything the display can do and how you can get it to do it. All the other do-dads on the board have simple interfaces, but the display is quite capable, by the look of it, and a single-point reference that tells us everything we can get it to do would be pure gold.
So the implication from the above comment is that there is no centralised, grown-up document that describes all available functions in the Clue’s display classes. Is that correct?
Is it true that the only way to find out what is possible is to minecraft the examples in the hope that one of them does something of value for my project? By implication, the only way to know that I have the ~best~ solution is to examine and understand every project.
Also, it implies that every available function is covered by an example somewhere. Is that the case?
Not trying to be nit-picky - just coming to terms with the new reality of post-modern software documentation. I don’t really miss the 3” ring binders with the pages falling out, but I feel like there is an option in the middle that I have missed.
Thanks for your help,
Russ
I confess I haven’t gone looking for the source to the Clue’s various display classes - it is accessible?
So many questions! My apologies -
Please be positive and constructive with your questions and comments.