Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN Data

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN Data

Post by Raymond_B »

Figured I'd make a new thread rather than bumping the original. http://www.msextra.com/forums/viewtopic ... 67&t=60367

Configuring the Nextion (https://www.itead.cc/display/nextion.html) and displaying data on it was easier than I thought... The real challenge will be the artwork type items I think. The Nextion editor is pretty cool, but it has a way to go, especially compared to 4D systems stuff. Things like changing gauge needles and other graphical type items simply are not there. They also need to add more documentation around the different command sets to manipulate data. Having said that, for $13.00 it's a d*** nice touch LCD screen. Displaying CAN data from a Megasquirt or Microsquirt should be easy (that's already worked out in other threads), but I'd like to work in some other items like flashing a gauge with different colors if it's out of bounds or automatically switching data pages under certain conditions.

Also I think one question would be, why do this and not just use TunerStudio? TS is awesome, and the gauge designer is fantastic, but it requires a device in the vehicle with a full blown OS. And that means boot time, drivers, patching, etc. This stuff is all instant when you turn the key on without a full blown operating system overhead. And, it's just fun to do :)

Here's some simulated data being displayed, yes my UX skills need work, but that's another discussion.

https://youtu.be/xwzE4Q0uz74
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

OK, I've got CAN data streaming to the display. It took a bit to figure out how to set the display's baud rate to anything higher than 9600. But once that was done I am now connecting to it at 115200. Now to work on some of the graphics.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Zaphod
Master MS/Extra'er
Posts: 390
Joined: Thu Aug 14, 2008 11:38 pm
Location: Germany

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Zaphod »

Such a nice work! Keep us informed!!!
--------------------------------
fun is not a straight line

Image

Sven
http://www.mx-5club-sachsen.de
http://miata.cardomain.com/id/svenmx5
NB-1998-1,6-Garrett T25 HGP Turbo Stage I
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Zaphod wrote:Such a nice work! Keep us informed!!!
Thank you! Got the display setup and I am now sending CAN data to it via the Teensy. It's pretty simple to send serial commands to it to configure/reconfigure things, so I was goofing around with changing gauge colors based on thresholds. Stuff like if RPM>5000 go yellow, if it goes past 6000 go red, etc.

Here's the display with a basic monochrome display, this is just using the "text" components of the Nextion. I'd like to try working with some higher graphic images for gauges, but I will have to brush up my Photoshop skills. Plus I am not sure how flashy I want it, I kind of like a solid color display. In the vid I go through some of the data pages I made (they don't house anything at the moment) to show the touch screen part. It'd be interesting to try some different combinations, like clicking on air/fuel and go to a page that has all the fueling components, or spark, or trans, etc.

https://youtu.be/zZF2HQYcchc
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Built this dashboard to look kind of like a Racepack LCD panel. Also added some pages for specific areas of data, fuel, spark, idle, trans, settings page with "Brightness", etc. Nothing set up on those yet, just playing with background images. I also built a Check Engine button, just below the RPM label, but forgot to illustrate it in the video. The idea is that if you get a CEL you can press the button to see related data.

https://youtu.be/m3MqVyxWRAY
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

This is much easier it looks like than the other one. Is it much easier to wire. And your just using the gauge and Ms can right? More info on setup please again lol love how u can change screens
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

matthunter1448 wrote:This is much easier it looks like than the other one. Is it much easier to wire. And your just using the gauge and Ms can right? More info on setup please again lol love how u can change screens
Parts needed are the display itself, a Mega/Microsquirt with CAN, a CAN transceiver, and Arduino compatible micro-controller.

My setup was;

Microsquirt V3
Nextion 3.2" TFT Display http://wiki.iteadstudio.com/Nextion_HMI_Solution
Waveshare CAN transceiver http://www.amazon.com/WaveShare-SN65HVD ... B00KM6XMXO
Teensy 3.2 Arduino compatible micro-controller http://www.pjrc.com/store/teensy32.html
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

Got it
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Also meant to say, yes it's very easy to wire. 5v and Gnd to display and micro controller , CANH and CANL, and then Tx and Rx to serial connector of the display
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

Sweet how's the programming?
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Let's put it like this, until a month or so ago I had never messed with micro-controllers :) Arduino makes it easy! The Nextion editor is kinda odd, but it's more of a configuration utility rather than programming. Attached is the Arduino code, super basic and easy. Change the file extension to .ino.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

Cool I'll look into it I have all the teensy and can controller just need a screen. I'll look into this and see if I like it better than. The two small screens
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

so started working with trying to build the gauge i want how do u set it for what incoming data it is reading ?
like rpm channel and so on?
you got your gauge file possibly that would be quite helpful
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

That part is all done via the Teensy code. You're doing serial writes the the Nextion id. Check out the file I posted
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

I did but. After I built a number. One the gaugee How does the gauge know which number is what thing. I understand enough on the file just trying to understand how it knows how to send that data and where I guess .
Sorry you've been really helpful I just don't know understand it all

Thanks matt
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

So I read through it again and I see serial 2 is what the nextion is reading and u set that up as in like it would read say my rpm text number box is t5 so
For example
Serial2.print("t5.txt=");
Serial2.print(RPM / 100);
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);
Am I onto a start?
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Yes, that's it. The id (button, text, progress bar, etc) of the item is basically the location for the data you're sending.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

So is the write(0xff) always the same if I'm just doing numbers. And does it matter if it's a number or text box? Also where do the wires go to the teensy. I know the can module goes to TX and Rx but what about the screen which pins. Thanks again
matthunter1448
Helpful MS/Extra'er
Posts: 140
Joined: Fri Jun 06, 2008 11:15 pm
Location: Spanaway, Wa

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by matthunter1448 »

Ok I think I understand. It more. The teensy Its pins 1,2 for the screen or 9,10. Not sure which is considered serial2 . Also. What is serial2.write (0x22). And last question do u know the ID for number like n0.num?
Raymond_B
Super MS/Extra'er
Posts: 1394
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Nextion 3.2" LCD Display + Teensy 3.2 + Megasquirt CAN D

Post by Raymond_B »

Give me a bit and I'll make a basic schematic, but if you look at the PJRC site there's a pinout for the Teensy, you'll notice that it has *I think* 3 serial interfaces. Serial is just your PC's USB connection and Serial 2 was the other set of pins. I am sure through the software you can name and initialize however you want, but I just kept it simple and default.

You'll also want to go through the ITEAD/Nextion docs, especially the Arduino specific info. Every write to the Nextion must be followed by 0xff 3 times, so something like;

Serial2.write data
0xff
0xff
0xff

and so on

The item you write your data to is defined in the Nextion designer software. Let's say you make a button, the software gives it an id like button.0, that's what you use in the Arduino code. You can change the name to anything you want, when I get serious I will name these items appropriately like rpm.0 or whatever.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Post Reply