Imp with a nextion display


Just curious if anyone has attempted to use an imp with a nextion display? I am working on an AC controller which will have a temp sensor, the imp and a display. I was able to read from the temp sensor (I2C) very easily, but I am struggling to send commands to the display. Right now all I want to do is update a number on the LCD which requires something like “temp.val=70” to be sent using serial. The quirk with this display is that you need to send your command and then three bytes of 0xFF to signal the end of the command. Knowing this I also tried writing “temp.val=70ÿÿÿ” which still does not work.

I read that using uartXX.write sends a minimum of 20 bytes which I think might be the issue. Is there a way to send a single byte of data? Right now this portion of my code only consits of two lines.

`hardware.uart57.configure(57600, 8, PARITY_NONE, 1, 4);

I can talk to the display fine with an arduino using the following code.

Any suggestions would be appreciated.

I’ve never heard of this 20 byte minimum before. Can you show where that is mentioned?

hardware.uartXX.write() supports strings, blobs and integer values

You could try:

`hardware.uart57.configure(57600, 8, PARITY_NONE, 1, 4);

I have tried that with no luck.

In the uart.write documentation page it says:
"By default, the transmit FIFO is set at 80 bytes is size. However, under impOS Release 32 and up, the size of the FIFO may be altered using settxfifosize()."

If you then go to the settxfifosize page it says:
"This method allows you to change the size of the output FIFO stack on the target UART serial bus. The default size is 80 bytes, but this can be changed to any size of 20 bytes or greater. "

The default is 80 bytes. The buffer size only falls to 20 if you explicitly set it so.

To send a single byte, do (for example)


Writing to UART adds the blob bytes, string bytes or integer values to the buffer. When the buffer fills, it’s transmitted. flush() forces the buffer to be sent no matter how many bytes it has provided it’s not empty.


This doesn’t sound right to me.

uart.flush() is simply a blocking method. the uart tx buffer will empty of its own accord as soon as you load data with uart.write(). The tx buffer size is adjusted to avoid any unhelpful blocking while the uart transmit shift register is slowly shifting bits onto the wire.


Are there any flow control lines on the display that need to be adjusted before sending data to the LCD?

Yes, @coverdriven you’re right; serial behaves as it always has. When the number of bytes in the fifo transitions from zero to one, the transmission is started. You configure a bigger FIFO if you want to more data in there at once; I’m not aware of any reason you’d want a smaller FIFO aside from for saving memory.

uart.flush() blocks until the fifo has totally emptied and the last byte has exited the UART hardware (as I remember).