Week no.16

  • Interface and Application Programming

Assigments :
  • Write an application that interfaces with an input &/or output device that you made, comparing as many tool options as possible.
Display Output Interface
Images

For the output device I choose to plug a Oled Display to my hello board

The model is a Nextion 2.4´ Serial Display (320x240 pixels). It has a resistive touchscreen and 4mb of storage for a nice graphical interface. So the idea is make a HMI to control the temperature of the printer heatbed.

Programing Interface
Images

The Display has it´s own development software : Nextion Editor, with is a object oriented programming interface (much like Visual C++).

Uploading Program to Nextion Display

So I create a single page application with two buttons (Up and Down), the temperature Gauge and a background picture (jpg, 320x240 pix).

Images

I followed a Elsie Zhou Tutorial for a Fish Tank interface, there was everythign I needed to know for my project.

The display has a SD-card input to upload files, you can save your project to the card and boot the display with it and it automatically updates the files. But I choose to make it form the serial port, it is slower than the SD, but you can debug and test the serial signals in/out.

And you need a FTDI USB cable converter to TTL-232R-5V, mine has this pinout diagram:

Images

Connection for uploading to Nextion display (USB--TTL):

VCC-------5V (RED)

GND------GND (BLACK)

TX-------RX (YELLOW)

RX-------TX (BLUE)

Interface Objects

It works in a very simple way; it has two buttons mapped that on click increment/decrement the setup temperature variable and it send trough serial the id each time I is pressed. Also displays the setup temperature variable on screen.

  • Name:page0, OBJ:Page, ID:0 ---- Home Page
  • Name:bmais, OBJ:Button, ID:1---- Button UP
  • Name:bmenos, OBJ:Button, ID:2---- Button Down
  • Name:gauge, OBJ:Number, ID:3---- Temperature Display