Notifications
Clear all

ESP32 to Nextion HMI Lessons Learned

25 Posts
3 Users
0 Likes
298 Views
huckOhio
(@huckohio)
Member
Joined: 5 years ago
Posts: 180
 

@zander 

I'll look for the reference.  It may be from the ESP32-S3 documentation on declaring serial ports (the extra arguments).  

Just to be sure....This is what is declared up front in the code.  I am assigning myNex to Serial2.

  //define pins for Serial2
  #define RXp2 18
  #define TXp2 17

  EasyNex myNex(Serial2);  
  

This this is setup.  I am initializing Serial2 and then initializing myNex.  

  Serial.begin(9600);

  // Init Serial2
  Serial2.begin(9600, SERIAL_8N1, RXp2, TXp2);

  myNex.begin(9600);

 

I did test using Serial with the Nextion and I believed it worked.  I needed to keep Serial for testing, troubleshooting and messaging while developing and running the code.  That's the reason for using Serial2.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6988
 

@huckohio Ok, I thought you could use Serial2 for anything that you use Serial for but maybe there is something I am overlooking?

As far as @rebeljd goes however, he is only using the baud rate so he could use the library unaltered and his code becomes myNex.begin(9600).

I will republish the library if the maintainer refuses to add the extra parameters to the begin function.

Also, I did find the esp32 docs for the extra serial.begin args, there is;'t an equivalent arduino as they use fixed pins IIRC.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
huckOhio
(@huckohio)
Member
Joined: 5 years ago
Posts: 180
 

@Zander

Posted by: @zander

Now that I more fully understand what is going on I wish I had a display, but they are very confusing. Many are over $100 some even over $500 and the less expensive models under $50 all say they work with old Pi's, no mention of ESP32. Do you have any recommendations?

Sorry Ron, my one and old experience with using HMI displays in the NEXTION.  If you are only using it for testing, then I see some of the smaller units are in the $20 to $30 range on AMAZON.  The Nextion site does have instructions/examples for linking with ESP32 (it also call's out IF with Arduinos).  https://nextion.ca/portfolio-items/nextion-iteadlib-and-esp32-step-by-step/


   
ReplyQuote
huckOhio
(@huckohio)
Member
Joined: 5 years ago
Posts: 180
 

@Zander

Posted by: @zander

I will republish the library if the maintainer refuses to add the extra parameters to the begin function.

I did make that request last year but never heard back.  


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6988
 

@huckohio Upon reflection, I think your strategy to reserve Serial for debugging etc is the right decision so all the more reason to get the Nextion library to work with Serial2.

Can you give me some guidance re purchasing a Nextion display, you have whetted my appetite.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6988
 

@huckohio Sorry, I missed some replies. I think in Canada the low end is closer to $35 to $50. I will jump on the Nextion website to get an idea what they can do. I looked a while ago and I think I was impressed. I wouldn't mind building a weather station using my OpenWeather subscription.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
huckOhio
(@huckohio)
Member
Joined: 5 years ago
Posts: 180
 

@Zander

Posted by: @zander

Can you give me some guidance re purchasing a Nextion display, you have whetted my appetite.

I purchased the NEXTION INTELLIGENT SERIES because it provides more setting/programming options.  I found the Nextion editor a little buggy, but easy t use.  I also found that when reading/writing numbers is helps to add a short delay in the code.  You can download the Editor Guide and Instruction Set documents from the NEXTION website.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6988
 

@huckohio Noted.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@rebeljd)
Member
Joined: 1 year ago
Posts: 16
Topic starter  

@zander 

I bought two genuine Nextion HMI's on Amazon.  The first one I bought was a 3.2" for $40, which I used to do most of the development work.  My final project, which is for a car dash, I bought a 5 inch for about $75.  So far I'm very happy with the quality.  I've had one powered up for about 2 weeks with no issues.

You can order them directly from Nextion but there is shipping costs and about 10 day delivery.

 

 

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6988
 

@rebeljd A 5" here is priced at about $130 so that isn't going to happen. With the super fast processors we have to work with these days, I think I will just stick to a graphics library and do the screens the old fashioned way.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Page 2 / 2