Introduction: VISUINO : NEXTION GPS DISPLAY AND SDCARD LOGGER
This time i came up with new instructable featuring both standalone display as well as logger using arduino mega 2560 and Nextion Lcd display
And for tracking purpose you can also log the NMEA sentences of Gps in sdcardand of course project is done with magical graphical programming software VISUINO.
MANY parameter of information can be displayed on Lcd as per user requirement but i will show you major ones.further any info can be extracted from raw GPS data through Visuino .
log file generated can be further used to track in google map , google earth.
i would like to again thanks toBoian Mitov for assisting me in wiring and writing this instructable.
i have updated the instructable by adding one morevisual lcd interface including all nessary files.
Step 1: COMPONENTS
- One Arduino Mega 2560 board (You will need a board with at least 2 Serial ports, preferably 3 so Mega is one of the best choices)
- One MicroSD Card module (SPI interface)
- One Serial GPS Module
- One Nextion Serial 2.8 inch nx3224t028_011Display (I used but any other Nextion Display should also work)
- SD card of capacity less than 32gb and its adapter to use with the Nextion Display
- Second SD card of capacity less than 32gb
- 4 Female-Female jumper wires to program the Display
- You will also need a 5V USB to TTL Serial Converter Module to program the Display
- Few jumper wires to connect the components together
Step 2: Connect the Nextion Display to the USB Serial Communication Module
- Connect the Nextion Wires Connector to the Display (Picture 1)
- If your USB to Serial Module is configurable, make sure it is set to provide 5V power (Picture 2) (In my case I needed to configure it with a power selection jumper)
- Connect the Ground Wire (Black wire) from the Nextion Display to the Ground pin of the USB to TTL Serial Converter Module (Picture 2)
- Connect the Power (+5V) Wire (Red wire) from the Nextion Display to the Power(VCC/+5V) pin of the USB to TTL Serial Converter Module (Picture 2)
- Connect the RX Wire (Yellow wire) from the Nextion Display to the TX pin of the USB to TTL Serial Converter Module (Picture 2)
- Connect the TX Wire (Blue wire) from the Nextion Display to the RX pin of the USB to TTL Serial Converter Module (Picture 2)
- Connect the USB to TTL Serial Converter Module to the computer with a USB cable
Step 3: Start the Nextion Editor, and Select the Display Type and Orientation
- Start the Nextion Editor
- From the Menu select |File|New|
- In the "Save As" dialog, type project file name, and select a location to save the project
- Click on the "Save" button
- In the "Settings" dialog, select the Display type
- Click on the "DISPLAY" tab on the left to show the Display settings
- Select Horizontal orientation for the display
- Click on the "OK" button to close the dialog
Step 4: In the Nextion Editor: Add and Configure Text Components
- *make sure you have FAT32 formatted sdcard make sure you have generated font otherwise Nextion editor will show error in compiling.
- YOU MUST DOWNLOAD ( images.png) IMAGE ATTACHED HERE CONTAINING GPS INFOMATION PARAMETER.(LATITUDE,LONGITUDE)
NOW FOLLOW THESE STEPS:
- CLICK new project
- name it as visuino
- Switch to the device tab and choose nx3224t028_011 display, 90 horizontal, character encoding ascii, Display area will have a white 320*240 editable screen.
Now we have generate fonts:
- From the menu select |Tools|Font generator|
- follow the wizard and select the generated font.
Next we will add a picture:
- Now in nextion editor add this wallpaper in picture window(left bottom corner window) by clicking on + button.
- In display window white screen will appear,now click on its attribute table(right hand side bottom corner window) click on sta->select image pic->double click->select picture
- this will be used as background of Lcd interface.
Design the Nextion screen:
- Now from toolbox window: click on text component->t0 newtext will appear on the display screen->drag over required area in front of latitude text
- now click on its attribute table sta->crop image picc->double click->choose picture 0 pco->choose black color txt->x
- Similarily repeat the process of adding four more text component t1 , t2.place them one below the other by dragg ing them on screen.Now you should add 4 more text components to display longitude,speed,number of satellites,date and time.
- similarly by repeating the above procedure
Generate and upload the files to the Nextion SDCard:
- Click on compile tab (this will generate tft file)You can also debug or run this in simulator by clicking on debug tab ,a new window will popup. under" instruction input area" window enter-> t0.txt="555" this will cause x->555 on display screen Click on file->open build folder->copy this visuino tft file into fat32 formatted sdcard.
- Insert this sdcard into Nextion lcd and power it on.
- After successful update.power it off then remove the sdcard and power it again.
- NOW YOU WILL SEE YOUR NEXTION EDITOR INTERFACE ON LCD.
- you can directly transfer visuino tft file attached here to sdcard .
- or go in next step to transfer compiled project via ftdi usb module.
Step 5: In the Nextion Editor: Upload the Project to the Nextion Display
- Click on the "Upload" button
- In the "Upload to Nextion Device" dialog, click on the "Go" button to start the upload
- When the upload finishes, click on the "Exit" button to close the dialog.
Step 6: HARDWARE CONNECTIONS
- BETWEEN MEGA AND NEXTION
- WE WILL USE SERIAL PORT1
- PIN18 TX1 OF MEGA TO RX OF NEXTION
- PIN19 RX1 OF MEGA TO TX OF NEXTION
- VCC TO VCC AND GND TO GND
BETWEEN SDCARD AND MEGA
- CS OF SDCARD TO PIN53
- SCK OF SDCARD TO PIN52
- MOSI OF SDCARD TO PIN51
- MISO OF SDACRD TO PIN50
- VCC TO VCC
- GND TO GND
BETWEEN GPS AND MEGA
- TX OF GPS TO RX2 PIN17 OF MEGA
- VCC TO VCC
- GND TO GND
- WE WILL USE SERIAL2
Step 7: Start Visuino, and Select the Arduino Board Type
To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/ .
Make sure that you install 1.6.7 or higher, otherwise this Tutorial will not work!
Step 8: ADDING GPS MODULE AND NEXTION DISPLAY IN VISUINO
- Type "GPS" in the Filter box of the Component Toolbox then select the "Serial GPS" component (Picture 1), and drop it in the design area
- Connect the "Out" pin of the GPS1 component to the to the "In" pin of the "Serial[ 2 ]" of the Arduino MEGA component
- Type "next" in the Filter box of the Component Toolbox then select the "Nextion Display" component, and drop it in the design area
- Connect the "Out" pin of the component to the to the "In" pin of the "Serial[ 1 ]" of the Arduino MEGA component
Step 9: ADDING VISUINO COMPONENTS: MICRO SDCARD CONFIGURATION
First we need to add and connect MicroSD Component in Visuino to control the MicroSD Module:
- Type "sd" in the Filter box of the Component Toolbox then select the "Micro SD Card Module" component (Picture 1), and drop it in the design area
- Connect the "Out" pin of the SDCard1 component to the to the "In" pin of the "SPI" channel of the Arduino component (Picture 2)
- Connect the "ChipSelect" output pin of the SDCard1 component to the "Digital" input pin of the "Digital[ 53 ]" channel of the Arduino Mega 2506 component (Picture 3)
To record the data we need to add File element to the MicroSD component and specify its file name:
- Click on the "Tools" button of the SDCard1 component (Picture 1)
- In the "Elements" editor select the “File” element in the right window, and then click on the "+" button on the left (Picture 2) to add File element
- In the Object Inspector set the value of the "Path Name" property of the File1 Element to "GPSLog.txt6"
Step 10: CONFIGURING NEXTION DISPLAY AND GPS
- Double click on nextion display , elements editor will pop up
- Add "Text" element
- Select the newly added element
- now under properties tab name it as "t0".
- Connect this text components to latitude of the gps module .
Similarly add next text component ,rename it as "t1" and connect it to longitude of gps module.
Similarly add text components for speed, number of satellites,date and time and map it to gps module. Name then "t2", "t3", etc. with incrementing numbers, to match the names of the Nextion components set in the Nextion Editor.
Step 11: Configuring Sdcard and Formatted Text Component
- Type "form" in the Filter box of the Component Toolbox then select the "Formatted Text" component (Picture 1), and drop it in the design area
- Double click on the FormattedText1 component to open the elements editor (Picture 2)
- In the Elements Editor add two "Analog element" elements (Picture 2)
- Connect "Analog Element1" to latitude
- Connect "Analog element2" to longitude
- Connect the "Out" pin of FormattedText1 component to "In" of sdcard1 component (Picture 3)
- Connect the "Out" pin of the SDCard1 component to the "In" pin of the "SDI" channel of the Arduino MEGA component (Picture 4)
Step 12: Upload the Code to Mega Board
- In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
- In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)
Step 13: Live Action
please take the setup in open area to get Gps fix
once you get gps fix all information will be displayed and logged.
take the sdcard out and check if gpstxt6 file was created.