What's the best way (fastest refresh) to make an analogue gauge display?

I've seen some code for a simple circle with tick marks and thin needle. I want something a bit more high-tech looking. I'm more concerned with the bezel and needle shape.

Will overlaying the needle over a gauge image work?

Or just use the bezel from this one and make arduino produce the tick marks

Or will something like this be faster?

Function: tft.drawArc
Lib: ILI9341_due

Video

Hardware: arduino Due, TFT ILI9341 2.2, 2.4" or 2.8"

Thanks for the info. Was looking for a needle type gauge. Also gona be using a hx8357b

You did not say what are you going to use to drive the LCD (Arduino Due?). If you do not have something really fast (like RaspPI) then I think you can only make it fast enough if the area under the needle is in a solid color (at any needle position, so something like [this](http://desktopwalls.net/wp-content/uploads/2014/12/Funny Animal Speed Gauge Desktop Wallpaper-900x506.jpg)). So you can draw your bitmap that has the numbers and ticks at the beginning once and then constantly just redraw the needle in a loop like this: draw needle, draw needle in background color (will erase it), draw needle, draw needle in background color, etc...
The gauge on the last picture you have can be made fast (enough) as well (if you don't use gradients). This is something similar. The point is that the background under the needle/gauge is a solid color so you can erase things fast.

Speed is the key.

My audio-gauge test

Hardware:

  • Arduino Due
  • TFT ILI9341 2.8"
  • Spectrum shield

Sketch, fonts and images

Oops forgot. Using a mega2560 and 3.2 480x320 (still waiting for the display to arrive)

Would this type (3 small gauges including the changing colors) be too much for a mega2560?

The Dial (marks and numbers) it´s posible, but the needle it´s more complicated

ricekikr:
Oops forgot. Using a mega2560 and 3.2 480x320 (still waiting for the display to arrive)

Would this type (3 small gauges including the changing colors) be too much for a mega2560?
http://www.shutterstock.com/video/clip-923287-stock-footage-tachometer-isolated-on-black-hd-loop-fps-d-p.html?src=rel/1188496:2/3p

In my option, it will be slow. If you look at most "arduino tft" videos on youtube, you'll see how "fast" it can draw lines, clear screen, etc. The fastest I've seen on Mega is this. The guy rewrote some routines in assembler to make it fast. You'd obviously have to use his UTFT modified library and a display with SSD1289 controller.
Other than that, you'd probably need to switch from AVR (Uno, Mega,...) to the likes of ARM (Teensy, Due,..). If you go that route, make sure there is a library that can drive the TFT fast enough (if you don't want to write your own).

TFTLCDCyg:
The Dial (marks and numbers) it´s posible, but the needle it´s more complicated

Can the bar be drawn with the body in background color (black) and just the end in some visible color (red) ? Not sure if its just my screen because on the first pic it looks like the body is green with a faint light blue at the end.

Are the tick marks drawn, a font/symbol, or a picture? Which would be fastest?

I think your solution would be the most ideal in my setup.

MarekB:
In my option, it will be slow. If you look at most "arduino tft" videos on youtube, you'll see how "fast" it can draw lines, clear screen, etc. The fastest I've seen on Mega is this. The guy rewrote some routines in assembler to make it fast. You'd obviously have to use his UTFT modified library and a display with SSD1289 controller.
Other than that, you'd probably need to switch from AVR (Uno, Mega,...) to the likes of ARM (Teensy, Due,..). If you go that route, make sure there is a library that can drive the TFT fast enough (if you don't want to write your own).

That's my worry, more so after i add the conditional statements. Will update this thread when the lcd arrives.

Thanks for the info guys.

I have programmed some slider bars using the methodology described by MarekB above i.e. draw the item, copy over with background colour, draw the item in the new position and so on.

It work OK with a Mega but it is definitely not smooth.

You need to realise that we can't use layers with this hardware i.e. have a background picture and overlay the needle on top. To improve the speed, you need to make the 'moving' image as small as possible.

Magicj:
I have programmed some slider bars using the methodology described by MarekB above i.e. draw the item, copy over with background colour, draw the item in the new position and so on.

It work OK with a Mega but it is definitely not smooth.

You need to realise that we can't use layers with this hardware i.e. have a background picture and overlay the needle on top. To improve the speed, you need to make the 'moving' image as small as possible.

Thanks for the info.

I was under the impression we mega can. Like the skull logo under the lines (MarekB link above)

I'll probably just sliders. Would you happen to know if the slider end can be a
different color from its body?

The only operation you have with the majority of LCDs is to set a pixel to a certain color. And that's it. The libraries just help you to draw those pixel, so instead of drawing the pixels for a line yourself you can just call drawLine from the library and the library will take care of drawing it pixel by pixel. Once you draw a line, there is no way you can easily erase the line and reveal what was underneath it before (there is no memory for that). That's why I advised you to have a solid color background underneath the needle. If the needle would overlay some number then you'd have to erase the line (set the line's pixels to the background color) and then redraw the number again. Otherwise you'd be left with a black (or whatever your background color is) line over the number.
Btw. there is no layers in that skull video either. You can clearly see it in the first/slow part of the video. When the skull is drawn it overwrites the lines. Then the lines are drawn again so they appear "on top" of the skull image. Now if you do drawSkull, drawLines, drawSkull, drawLines,... really fast (which is a problem with Arduino) your eye won't notice that the lines were overwritten by the image for a split millisecond so it appears like the skull is drawn underneath the lines (which in reality is not).

MarekB:
The only operation you have with the majority of LCDs is to set a pixel to a certain color. And that's it. The libraries just help you to draw those pixel, so instead of drawing the pixels for a line yourself you can just call drawLine from the library and the library will take care of drawing it pixel by pixel. Once you draw a line, there is no way you can easily erase the line and reveal what was underneath it before (there is no memory for that). That's why I advised you to have a solid color background underneath the needle. If the needle would overlay some number then you'd have to erase the line (set the line's pixels to the background color) and then redraw the number again. Otherwise you'd be left with a black (or whatever your background color is) line over the number.
Btw. there is no layers in that skull video either. You can clearly see it in the first/slow part of the video. When the skull is drawn it overwrites the lines. Then the lines are drawn again so they appear "on top" of the skull image. Now if you do drawSkull, drawLines, drawSkull, drawLines,... really fast (which is a problem with Arduino) your eye won't notice that the lines were overwritten by the image for a split millisecond so it appears like the skull is drawn underneath the lines (which in reality is not).

Thanks got it.

Will probably just make a bezel with 3 circles (to simulate some sort of fade) and use a bar graph.

Is there an arduino simulator with a tft diplay? All i find are two line lcd emulators. Wanna try some some code and just copy it over when the display arrives.

Check FT800 EVE chip from FTDI. They have good library for arduino, it is cheap, and doesn't require any processing power from arduino. Arduino just send commands over SPI and FT800 takes the whole display magic for you. It also have gauge widget, so it is very easy to implement. They also have PC emulator. It isn't fully functional, but at least for basic stuff it works. And it is free :smiley:

Regards,
Jakob

JUGmobile:
Check FT800 EVE chip from FTDI. They have good library for arduino, it is cheap, and doesn't require any processing power from arduino. Arduino just send commands over SPI and FT800 takes the whole display magic for you. It also have gauge widget, so it is very easy to implement. They also have PC emulator. It isn't fully functional, but at least for basic stuff it works. And it is free :smiley:

Regards,
Jakob

I just checked out their youtube gauge vid. Refresh looked perfect.

Unfortunately i already bought a display.

Will running in spi mode without using the ft800 gpu make it run any faster than normal mode?

I don't know that, but with this driver, you can easily get 60fps even on intense task and on the + side, arduino microcontroller can do different task at the same time. Check out new thread I started: FTDI EVE - FT800 easy display development

Regards,
Jakob