Start a new topic

I must be a complete moron!!!

Let me start by explaining what I am trying to do (endgame wise). I did not like the controls on my Sawtooth Pellet Smoker, so I have ripped them out and have been using an Arduino Uno, a relay shield and an Adafruit LCD display, along with a thermocouple amp and thermocouple probe to measure the temperature in my smoker. I have a setpoint that I would like to keep the smoker at, and I have a special startup mode for when the smoker is cold (Right now it just reads the thermocouple and if it is <150 degrees, goes into Startup mode).


So I have a Nextion NX4832T035 display. I have successfully hooked it to my Arduino Uno and have been able to upload (via SD card) my layouts. I have a total of 3 pages right now:

  • Page0 is called main
  • Page1 is called setpoint
  • Page2 is called shutdown
There are 3 buttons on the main page:
  • Startup will be for future use (not concerned with that right now).
  • Setpoint is used to change the setpoint of the smoker, in degrees F.
  • Power will shutdown everything but the fan (lets the fan run for 15 min).
The thing I cannot seem to figure out is the Setpoint page. If you press the button, you go to Page1 (setpoint) and all I have on that page is an Up arrow (button with a Touch Release Event & Send Component ID checked), a Down arrow (Same as above) and between the two I have a text field called tempDisplay(with the same choices as above). There is also a Home icon in the bottom right corner that takes you back to Page0 (main).

My intent is to push the Up Arrow to make the setpoint go up in 5 degree increments or press the Down Arrow to make the setpoint go down in 5 degree increments. I can see button presses when I run Debug, but I cannot get the tempDisplay to change to reflect the button push! I have literally been working on this for 12 hours now!!!

I am attaching both my .hmi file along with images and fonts in a .zip file and my Arduino code.

Somebody please help a brother out!!

Thanks!

ino
zip
(247 KB)

Jay,


Attached is a modified version of your HMI.

When you start your project, temp is 0 as it hasn't been set

To get started your Arduino should send the following with the actual temperature when you have it

  • main.va0.val=45    // where 45 represents an actual temp value
  • cov main.va0.val,t0.txt,0


Modifications

  • In page main, va0 was added as .vscope global and .sta Number to hold your temperature value
  • In main PostInitialize Event the line cov,va0.val,t0.txt,0 was added
  • in setpoint PostInitialize Event the line cov main.va0.val,tempDisplay.txt,0 was added
  • in dnArrow TouchRelease Event two lines main.va0.val=main.va0.val-5 and cov main.va0.val,tempDisplay.txt,0 were added
  • in upArrow TouchRelease Event two lines main.va0.val=main.va0.val+5 and cov main.va0.val,tempDisplay.txt,0 were added
  • in home icon TouchRelease Event added cov tempDisplay.txt,main.va0.val,0 before page 0
  • unchecked upArrow Send Component ID
  • unchecked dnArrow Send Component ID
  • unchecked main.b1 Send Component ID for "Setpoint"

In your code, you can now listen for the Nextion response code and (respond to the new temp value)
0x65 0x01 0x01 0x00 0xFF 0xFF 0xFF
which tells you
  • 0x65 touch information follows
  • 0x01 on page 1 (your setpoint page)
  • 0x01 component 1 (your home picture)
  • 0x00 release event occurred
  • 0xFF 0xFF 0xFF (Data termination, end of data)
So this event is set to after you have entered your temp settings and are returning to the home page when  you are most likely satisfied with your choice (with each +/-5 change is being skipped over).

Hope this is of some help
HMI

1 person likes this

I forgot to mention


Sending get main.va0.val from your arduino will allow you to retrieve the temperature value once set.

Do this when the 0x65 0x01 0x01 0x00 0xFF 0xFF 0xFF nextion response code has been received.


1 person likes this

Patrick,

  Thank you SO MUCH for this help and the explanation! I am downloading the new HMI file now and will try it out in a little bit. Again, thank you!

Login or Signup to post a comment