[queued] Engine Monitor - Teensy 4.1 & 3.6

AndyMeyer

Active member
I'm a pilot of an Experimental aircraft and needed a good engine monitor - around 6 or 7 years ago I started with an Arduino and a 2.8" display and a 8 channel thermocouple board... Struggled along, slow screen updates, integer math, etc... Then I found paradise when I ran across the Teensy and Paul's (and all of the contributors) INCREDIBLE work here.

Current version has a Teensy 3.6 mounted near the engine with 23 inputs: 8 K type thermocouple, analog pressures and temperatures (Oil Temp, pressure, manifold pressure, engine timing and RPM, etc... and some spares, along with a spare RS232 input. This board communicates via RS232 to the display module.

The display module has a 3.5" cap touch screen, 8 more inputs (2nd RPM, Fuel flow, airspeed and altitude, temperature, volt and ammeter...) 6 outputs (warning lights, dimmer and spare) and 3 RS232 channels to share information with my GPS for fuel estimation at the destination, etc... It also records data to a uSD card, stores a variety of settings in flash, and monitors for any out of limits conditions.

Boards were designed in Upverter and procured through OshPark, housings designed in OnShape and printed on my Prusa Mk3. I did add a Teensy 3.6 and a 4.1 model in Upverter so that is now available if anyone needs it.

I have an engineering degree, but never did board design or EE design until this project, and it flies! Anyone who questions what they can do - give it a try - you'll learn a ton along the way, have a lot of fun, experience frustration when things don't go right (or you swap an Rx and a Tx line - which the engineers I work with on NASA programs do routinely as well), and get to make cool things work! If you're interested in checking out the Upverter designs, drop me a note and I'll get you access. I'm open to suggestions in making the designs better as well.

PXL_20230306_224958750.jpg
View attachment 30648
PXL_20230319_144703017.jpg
 

Attachments

  • PXL_20230319_144731311.jpg
    PXL_20230319_144731311.jpg
    131.1 KB · Views: 218
Dude, that is some serious high quality work. Impressive UI, board, and packaging. I too started with Arduino for a similar system but ran into the same issues. I moved to Teensy and never looked back.

Well done!
 
Dude, that is some serious high quality work. Impressive UI, board, and packaging. I too started with Arduino for a similar system but ran into the same issues. I moved to Teensy and never looked back.

Well done!

Kris,

Thank you! It's been a long time coming, and I want to do even more with it... Crank velocity measurement, vibration measurement... A lot of folks see it and don't know what to think, I appreciate your remarks.

Probably my biggest hurdle, and I don't think it's a hard one, is if we had a library of exemplar circuits with a little verbiage on how to implement them. Might be something that could exist in the forums or on Paul's page. A starter list might include:
  • Voltage divider with Zener protection.
  • RS232 implementation
  • Open Collector frequency input
  • 12V to Teensy power supply
  • 120V to Teensy power supply
  • Multi LED Driver
  • Servo Control
  • Temperature sensing - thermocouple, RTD's and other common sensors
  • Ethernet Interfacing
I think this would ease a lot of fears of how to jump in and really do cool things with Teensy. The library would grow as a few moderators watched the project lists, etc... Then, many projects become building blocks instead of research projects. I probably spent half my time and 2/3rd of my mistakes could have been solved with exemplar circuits of the above. We have great code libraries, why not matching circuit libraries?
 
...
Probably my biggest hurdle, and I don't think it's a hard one, is if we had a library of exemplar circuits with a little verbiage on how to implement them. Might be something that could exist in the forums or on Paul's page. A starter list might include:
...

There is this Wiki: github.com/TeensyUser/doc/wiki

Perhaps it could be home to such a collection. Not sure if any are covered, there is an 'Electronics' area - but didn't see such topics there now.
 
Hi there, I have a diesel that runs the air cart on my drill and this is more or less exactly what I was looking to do to monitor it. Currently there is nothing other than a RPM reading for the fan that it runs on the implement monitor. Any chance you would share the files? Only other thing I would have to add is a PWM controller to run the throttle
 
Hi there, I have a diesel that runs the air cart on my drill and this is more or less exactly what I was looking to do to monitor it. Currently there is nothing other than a RPM reading for the fan that it runs on the implement monitor. Any chance you would share the files? Only other thing I would have to add is a PWM controller to run the throttle

Yes, send me an email to meyerkc135... I'm a gmail user...
I can share both the boards and software... Will need some tweaks depending on the sensor types, etc...

Does anyone have a good suggestion on a sunlight readable 3.5 to 4.3" display that isn't a pain to connect to a teensy? I'm even wondering if it'd be smarter buying a display with a couple of FPC cables on it and putting the driver on my PCB. Right now, I'm using a DFRobotics Fermion 3.5" cap touch display, but at 350cd/m2, it's not bright enough for my liking... Thoughts?

Andy
 
My goto display board for Microcontrollers are the EVE3 or EVE4 intelligent display IC's from Bridgetek, you can get them built into a nice sunlight display module from the likes of Riverdi, MatrixOrbital etc. SPI interface, high brightness, plenty of space for graphics, with or without touch support. I've used them in custom race car dash boards for years with great results. Display sizes are from 3.5" to 10". Display driver available from https://github.com/RudolphRiedel/FT800-FT813. IMHO these modules are not cheap, but for a few custom items the price of the hardware is not really an issue.
 
Turby,
I got one of these in hand (I got the NewHaven 4.3" 800x480 w/ CapTouch.) It looks like this will be an AWESOME match for upgrading this display.
Struggling to understand the FT81x library - I can't seem to find some great documentation that can get me running quickly - maybe I got spoiled by the simplicity of the ILI9xxx_t3 and Adafruit GFX libraries...
Any pointers to some documentation that can get me started - maybe I'm just struggling to get my head around the FT81x library...
Thanks!
Andy
 
Try this: GDSTx library
NHD43.jpg
NHD 4.3" FT813 + Teensy 4.1

Allows you to use the teensy 4.1 SDIO reader to handle jpg, avi, assets, cells, and audio files; using the latest SdFat library. It is a modification of the arduino 23X library, which allows you to use the SDIO reader from teensy 4.1, it is 98% aligned to the gameduino 2 cook book, so it can be used as a programming guide

I have a 5" Riverdi BT817 screen installed on the PC on a teensy 4.1 board, to monitor several NTC sensors at different points of the liquid refrigeration. It also allows me to turn the PC on and off from the TFT
Wyyak8Ym.png
OCISbXNl.jpg cPZKADMl.jpg

Sorry for the mess but I'm finishing the tests with a 4 relay board to control some PWM fans with the teensy 4.1 and the BT817 TFT
 
Last edited:
SOrry for late reply, EVE libary can be found here https://github.com/RudolphRiedel/FT800-FT813, library is actively maintained and expanded with plenty of examples. Note that the EVE displays are intelligent, you don't manipulate pixels in a frame buffer directly, but rather use primitives such as draw line, rectangle, circle, text etc.
 
SOrry for late reply, EVE libary can be found here https://github.com/RudolphRiedel/FT800-FT813, library is actively maintained and expanded with plenty of examples. Note that the EVE displays are intelligent, you don't manipulate pixels in a frame buffer directly, but rather use primitives such as draw line, rectangle, circle, text etc.

Turby,
Thanks! I'm looking into it now - totally different mentality than the Adafruit GLX and ILI libraries. Working to get my head around it... It does look a lot more capable however so I'm looking forward to that.
 
Alright... I've got the 800x480 display - absolutely brilliant. Great touch performance, very bright, high resolution. I'm totally happy, but...

I only have it working with a dinosaur arduino, and NewHaven's arduino shield. not with the Teensy 4.1...

NewHaven NHD-4.3-800480FT-CSXP-CTP

Current connections are: Connecting to the 2x10 connector...
· GND to Pins 2 and 19
· Vin (~4.8V) (USB power) to Pins 17 and 18.
· 3V3 Teensy to NHD 1 - 3v3 power.
· Teensy 13 to NHD 3 - SCLK
· Teensy 12 to NHD 4 - MISO
· Teensy 11 to NHD 5 - MOSI
· Teensy 10 to NHD 6 - CS
· Teensy 9 to NHD 7 - INT -----I assume that this is not needed.
· Teensy 8 to NHD 8 - PD (Pulled low by the teensy. - tried pulling high...)

Thoughts?
 
EVE2 is an very old version of the controller... even so it should still work. I have used EVE2 on a LPC4088 MBED years ago, but have moved to EVE4 / Teensy 4.1 / 7" display more recently.

Connections look good, though I also have EVE pin 20 (backlight ground) to ground. Also I have tied PD to a pin on the MCU as well.

I think the biggest issue you have is the speed different between T4 and Arduino, you will need to add in quite a few delays to get the display to work, especially during startup, also initial SPI speed has to be reduced during config (I use 10 MHz).

Code:
SPI.begin(); /* sets up the SPI to run in Mode 0 and 8 MHz */
SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));

Are you setting up the backlight correctly using REG_PW_DUTY?

Are you using Rudolphs software interface ?
 
As I see that they do not answer something concise, I sign up to answer you. As I told you before, you can use the library for gameduino 23X, some modified or modify it to your liking.

In this case I suggest GDSTx, I've been fine-tuning it for a while and I think it can help you very well.

First let's go to the wiring.

wiringT36_NHD43.jpg T36NHD43_0.jpg

I added pullup resistors on the MOSI, MISO and SCK lines to stabilize the signal from the capacitive touch panel. It is activated by the nus SPI and sometimes it is activated only randomly. With these resistors I have not seen that behavior anymore.

I have the same 4.3" capacitive TFT NHD. Since yesterday, I've had the task of connecting it to a teensy 3.6 and being able to share the connection, and of course you can see what it really is. This is how it has been installed.

T36NHD43_1.jpg

Finally: some functional tests on the first try...

T36NHD43_4.jpg T36NHD43_6.jpg

I think you will like this example, it is the base of the GPS that I am building, the complete example of loading JPG maps with GPS positioning is in the library. All you have to do is add the GPS device so that it loads the maps in real time during the journey.

T36NHD43_7.jpg

As soon as I have time I'll take it for a drive in the car to take a video and share it.
 
@TFTLCDCyg Cool! What's the plan with the GPS? Your prototyping is gorgeous! Maybe I need to adopt some of your methods!
47k pullups or 10k pullups on MISO and MOSI? The display has a 47k pullup on CS and PD, but not on MISO and MOSI. I will give that a try!

I've made a ton of progress with Rudolf's library. Just need to figure out how to get a PNG or bitmap loaded into the displays memory with Rudolf's library and displayed (I need two - one is a logo, the other is a triangle pointer for the bars - can't find another way to do a triangle in the EVE library.)

So cool to see people doing neat things with displays. I was intimidated at first, but this stuff isn't hard! Any chance you share your pinouts or schematic and the basic hello world, along with which library to help others (and me) who are trying to get started? Any other tricks? Maybe we need a new thread for hardware setup...
 
I hope it is useful and thanks for the comments, they are greatly appreciated. What do you think that to contribute a grain to your great project, allow me to continue answering in this thread, since the hardware you want to use is similar to the one I have on my desk at the moment.

Regarding your teensy 4.1 and the teensy 3.6; there is no difference in SPI and the 3.3V and GND lines are identical on both boards. The connection diagram between the teensy and the TFT NHD-43 is in the first image, I used some 10K SMD resistors to build the pull-up arrays. The wiring on the back of the 2 x 10-pin header follows the orientation of the TFT header, as it would look when assembled on the front face of the PCB.

T36NHD43_8.jpg

I applied that fix on MISO, MOSI and SCK, because capacitive touchpad is connected on them too and sometimes it causes weird errors on touch inputs. Unlike the other library, in GDSTx higher frequencies can be used in SPI when booting the EVE chip.

Another point that must be considered in the design is to implement a microUSB to USB-C adapter; given that the teensy's PCB connector is very fragile, USB-C is more robust. I have a couple of teensy 4.1 boards that fail a lot in the connector and only with certain microUSB cables they still work. I opted for this measure as security to preserve the useful life of the connector

T36NHD43_9.jpg

Since you've gotten fully involved with the FTDI-type library, and you already know how it should be used; let me show you the example for "Hello world", using GDSTx

Code:
#include <GDSTx.h>

void setup()
{
  GD.begin();
}

void loop()
{
  GD.ClearColorRGB(0x100020);
  GD.Clear();
    GD.cmd_text(GD.w / 2, GD.h / 2, 31, OPT_CENTER, "Hello world");
  GD.swap();
}

T36NHD43_12.jpg

To load the image named tree.jpg stored on the microSD, this is the code:

Code:
#include <GDSTx.h>

void setup()
{
  GD.begin();
   GD.cmd_loadimage(0, 0);
   GD.load("tree.jpg");
}
void loop()
{
   GD.Clear();
   
   GD.SaveContext();
    GD.Begin(BITMAPS);
    GD.Vertex2f(0*16, 0*16);
   GD.RestoreContext();

   GD.swap();
}

tree.jpg T36NHD43_11.jpg

Regarding the handling of images or multimedia files, the version of the library you are using can work with images compressed in a flash memory, but its implementation is somewhat tedious and you must be a very advanced expert in C. The EVE family of chips has a limit on the number of instructions per displayed screen: 2046, when you exceed that limit the screen is corrupted. They may be less depending on the complexity of the instructions or widgets.

On the other hand, when you want to load images you are limited to only 16, as long as you do not exceed the limit of graphics memory. These limits can be resolved by using vertical images in a square cell array for icon handling.

T36NHD43_10.jpg
Code: View attachment Icons21.zip

To get around the limits of images that can be used, the GDSTx library is able to use the SDIO reader from the teensy 4.1/3.6 board; Taking advantage of the capabilities of Greiman's most recent SdFat library, we can use exFat-type microSD memories of more than 256 Gb.

Upload the images you want to place on the TFT to see how we can process them. The triangular indicators could be png images, to take advantage of transparency and reduce drawing code.

PD: I moved the TFT rotation 180 degrees to take better care of the TFT flex connector, that's another capability of the screen, you can rotate the content 0, 90, 180 and 270 degrees.
 
Last edited:
It's alive!
Turns out I think I had a bad jumper wire - of all the things it could have been!
This 800x480 4.3" cap touch display is gorgeous and rocks with the Teensy pushing it. The DPI is fantastically high and the cap touch works really well. NewHaven display
And I can still fit the same display in the panel space I have in the aircraft.

TFTLCDCyg, Thank you for the insight. That cookbook is a lot of good info - even if not using the GD library. It looks like most of these libraries are really close. And, I love that it appears to have been written with LaTeX!
 
Hey! I was inspired by this thread to put together a project of my own, this time as an audio vectorscope for displaying oscilloscope art. I'm using a teensy 4.0 and a Riverdi RVT70HSBNWN00, the 7" EVE4 TFT display without touch screen. I am having issues though... When using your GDSTx Library @TFTLCDCyg, the display backlight is turning on and a line is drawn across the center of the screen for a fraction of a second before clearing itself. The backlight remains on, and sometimes will repeatedly power cycle itself depending on the example sketch I am using. Once I got the helloworld_border sketch to flash upwards across the screen but I haven't been able to reproduce it since.

I went through and added the correct register values according to the datasheet, but there is some other information that I am missing, such as REG_OUTBITS, REG_PWM_DUTY, or LOW_FREQ_BOUND. How did you determine these values when testing displays yourself?

Do you have any idea what's happening here? I believe everything is hooked up correctly.

Any help would be greatly appreciated!
 
Last edited:
It's good to know that you chose this type of screen, you really went to the top of this type of TFT's: 7" is really quite a challenge.

The BT817 chip should work without problems, it seems to me that the times between the 5" BT817 with which I did the tests and the 7" BT817 should be identical, but let me do a little research in the meantime.

I suggest you connect the backlight (which accepts 5V) of the screen to the teensy's power supply in parallel, but using a USB type C cable, as I indicated in previous messages.

In the file config.h, for the teensy it should have these parameters:

Code:
#ifdef TEENSYDUINO
 
    #define SizeEVE             54  // NHD: 7-7",  5-5", 43-4.3", 35-3.5", Riverdi: 51-5", 71-7", MO: 38-3.8"FT813, MO: 52-5"BT815, MO: 53-5"FT813, Riverdi: 54-5"  BT817, 0 Riverdi FT801/FT800 4.3", Riverdi: 100-10" BT817
                                     // 431-EVE3x-43 MO
    #define ORIENTACION          0   // 0, 1, 2, 3, FT81X/BT81X   0 normal
    #define ROTACION             0   // 0,1         FT80x

    #define CS                     10   // general
    #define SetSPISpeed   36000000   // general
    #define NHDTouch              1   // 1 cargar rutinas panel táctil    0 NHD normal aparentemente no lo requiere?¿
    #define GameduinoX           0   // 1 gameduinox shield instalado  0 otros como NHD43 o FT843
     
#endif

This line

Code:
#define SizeEVE              54

It calls all the necessary parameters: appropriate TFT timing table, and all the necessary parameters for the BT817 chip to start correctly. Remember that it uses the most recent SDFat library, in an alternate version, I will adapt GDSTx to use the SD library that comes with teensyduino, they should only be minimal adjustments.

FT813 7" on teensy 4.1

FT813 7 vs 5.jpg
 
Last edited:
If you are using the 7" screen from Riverdi, you may have found that the pixels are not square. on the BT817, you can set horizontal resolution to 1076 to get things nice and square again, only really noticeable if you draw circles...

Code:
#define EVE_HSIZE   (1076L)
#define EVE_HSF (1024L)
 
@Turby: The BT817 chip in 7" screens corrects the problem of non-square pixels.

This is the timmimg table, left: 7", right: 5"
Riverdi timmins table 7 vs 5.jpg

GDSTx updated!
Code:
#define SizeEVE              74

Share us some pictures of your TFT (by the way: my next BT817!, yeah!)
 
From the 817/8 data sheet - "BT817/8 supports Horizontal Scanout Filter (HSF) operation. The HSF applies a high-quality filter to output pixels, correcting for LCD panels with non-square pixels (the physical size of the LCD pixel is not square). HSF is enabled and disabled with CMD_HSF. Note that HSF and 2X are not supported together."

I'm using "RVT70HSBFWN00" as my panel, which has "Pixel Pitch (W x H) 0.1506 x 0.1432", hence setting HSF. I believe that all other size panels from Riverdi have square pixels.

Next time I spark my test bed up and take some pictures of a circle at 1024x600 and at 1076x600 to show you the effect of setting HSIZE and HSF.
 
Last edited:
Great, THX.

I checked the additions in GDSTx for the BT817-7" screen, using the 5" BT817 screen and to my surprise it works very well, even though the dimensions of the screen in theory are 800x480, internally the BT817 chip easily supports the resolution of 1024x600 px!!!, I know this because some buttons are configured considering the limits of the screen and do not appear in the test; In addition, the testcard() function responds to the dimensions established in the 7" TFT time table.

BT817-5.jpg
BT817-setup7.jpg


Some pixels are not showing in place, possibly because I am forcing the test on an 800x480 px TFT. It seems that they have done the task very well with this BT817Q chip. I waiting then for the 7" TFT with a resolution of 1024x600 px!
 
You're a godsend @TFTLCDCyg. Thank you for updating the library so quickly! I have connected the screen in parallel with a 5V supply as you suggested, but I'm getting a strange output when trying to run the hello world example. Just a grey screen with a couple of lines on the right side of the image. Have any of you ever come across something like this in your testing?
IMG_7139.jpg
 
Back
Top