Initialize EEPROM Then
Set Up Profiles
  and WiFi On
    Nextion Displays

Initialize the EEPROM:   Follow these instructions to iniatilize the EEPROM on the Nextion Display.
Setup Profiles:  Follow these instructions to setup the Profiles feature on the Nextion Didplay.
Setup WiFi:  Follow these instructions to setup the WiFi feature on the Nextion Display.

Instructions:  Read through these instructions carefully. It is a bit complicated, but with a little practice, up to 10 WiFi's can be scanned, and then the desired WiFi can be selected and then connected using only the Nextion Display.
HTML Templates

Welcome to the Set Up Profiles and WiFi On Nextion Display Page

************************* Set Up Profiles and WiFi: *************************

Nextion Screen Updates August 2019

(This version of the Nextion screen requires the latest
Nextion Driver version 1.14 or higher)

First, the EEPROM must be Initialized!
  Initialization is required for the Profiles Page and
  the WiFi Page to function correctly.

1.   If you have just loaded this new version you will need to clear out the EEPROM
      as your first step. This step will initialize the EEPROM for first use. Initialization
      is required to prepare the EEPROM for use with the WiFi page on the Nextion Display.
      Before doing this, you should take screen shots of your profiles, or write them down,
      so you can easily replace them. THEY WILL ALL BE ERASED when you
      initialize the EEPROM.

      a.   After backing up your profile information unlock the screen by clicking on the
      small lock icon. It will change from a locked Padlock to an Unlocked Padlock.
      b.   Next type the number 543212345 into the top profile name field, just below
      the small lock icon. This number, (543212345), acts as a password to initialize
      the EEPROM. This "Password" will prevent accidental initialization or accidental
      erasure of the EEPROM.

      c.   Click on the Save button and the Profile name should change to CLR EEPROM.

      d.   Now click on the Links button and return to the mmdvm page O (zero) by
        clicking on the Home button.
      e.   When the mmdvm page O (zero) screen is displayed the EEPROM will be
        initialized to the new memory map to support the new features.
        When the Nextion Display changes to the idle Page, Page O (zero), or the
        MMDVM Page as it is also called, code is executed to see if the initialization
        password (543212345) has been saved to the EEPROM. If the idle page
        code finds the saved password, then it proceeds to initialize the EEPROM.
        Obviously if the idle page does not find the password (543212345) nothing
        happens. This may seem complicated, well, it is. But a time or two setting
        it up and it will make sense.

SetUp The Profiles Next...

      f.     Now you can return to the Profiles page and reenter your profile information.
       Initialization is necessary to support the new features of this screen and the new
        Wi-Fi screen. Remember to install the Nextion Driver v. 1.14.
      g.   Now on the Profile screen if you page through the profiles using the left
        or right arrow keys the profiles will be cleared out and the names will be changed
        to a default setting. The default names are Profile 1, Profile 2, Profile 3 etc...
        up to Profile 6.

2.   Once you have initialized the EEPROM you can start using the new screens.
    To use the Profile Screen, do the following:

    a.   To make any changes you must remember to UNLOCK the screen by
        clicking on the small lock icon on the top left of the screen.
        Each time you click on the lock it should change from the locked state
        to the unlocked state.
    b.   You move between the different profiles by clicking on the small left or
        right arrows near the bottom of the screen. There are six profiles so click
        on the arrows until the profile you want to change appears.
        You can also look on the bottom of the screen in the center to see
        the Profile number 1 - 6.
    c.   To change the profile name just click in the top field just below the small
        lock icon. When you click on this field an Alpha Numeric keyboard should
        open. You can type the new name of the profile into this keyboard screen.
        Use the DEL Key on the popup Keyboard to delete the default name in
        the box. Press the DEL Key repeatedly. Each press of the DEL Key will
        backspace and delete one character.

    d.   The screen is divided into two areas, the left side of the screen is used
        for setting a specific RX Offset, TX Offset, RX Frequency, TX Frequency.
        and Mode. To change the Mode, click on the button labeled SEL Mode.
    e.   If the Offset is negative make sure to include a minus sign before the number.
        Be careful what you enter, an incorrect number or an extra zero may make your
        hotspot not hear your radio. Below is an example of numeric keyboard for
        fields that do not need Alpha characters.

    f.   Once you have entered all of the correct data for one profile make sure the
        lock icon is unlocked and then click on the Save button. Do this for each
        profile you want to save.
    g.   The right half of the screen is used to store network server information.
        This can be any DMR Master, TGIF, BM, DMR-MARC, DMR+ or any
        of the other experimental DMR networks.
    h.   The IP address of the server can be found several ways. Here are a couple
        of examples:
        i.     Look in the mmdvmhost file in the Expert mode of Pi-Star.
        ii.   If you know the DNS name type nslookup and the name of the server.
          Example:   Type:  nslookup   into the command line
                  on a PC or a Linux machine.
        iii.   You can also ssh into your Pi and look in the host file for DMR Hosts
          file located in /usr/local/etc/DMR_Hosts.txt Be careful not to accidently
          change this file.
        iv.   The DMR Host file will also give you the Password and the Port used
          by the server.

    i.   Once you have the correct information added make sure the lock is
        unlocked and then click on the Save button.
    j.   The Master will only be changed when you click on the Change Master
        button. The Change Master function is separate from the Apply Profile
        function. This allows you to store up to six Master servers, separate
        from your radio profiles.
    k.   To change Profile all you need to do is open the Profiles screen and
        click on the arrows to find the correct profile and then click on
        Apply Profile.

NOTE: When you Apply Profile, It does not Change the Master.

    l.   To change the Master all you need to do is open the Profiles screen
        and click on the arrows to find the correct Master and then click on
        Change Master.

NOTE: When you Change Master, It does not Apply Profile.

Next, SetUp WiFi...

1.   The new Wi-Fi Selection Screen also has two different functions.

2.   Section one will store three Wi-Fi profiles you can recall and change to
    the selected WiFi anytime you wish.
    a.   Because of the limited EEPROM space we can only store three
        Wi-Fi profiles and we are limited to a length of 20 for the ESSID
        name. If necessary, you can change the ESSID of the Wi-Fi device
        being selected to make it fit this requirement.
    b.   The password is also limited. The WPA standard requires the
        password to be at least 8 characters long and we can only store a
        maximum of 20 characters in the EEPROM. If necessary, reduce
        the length to 20 if you are going to store this information.
    c.   To change to a different Wi-Fi profile, select one of three
        Wi-Fi profiles and then click on the Connect button. This will create
        a new WPA supplicant file using the stored information. Once the
        Connect processes is run, power down the hotspot gracefully
        using the Shutdown button on the Links or MMDVM pages.
        Remove the power and once the hotspot has been off for a minute
        then reapply power to the unit and let it boot up.
    d.   When the hotspot reboots it will read the wpa_supplicant file in the
        /boot folder and then move it to the correct location. The Linux OS
        will then re-boot and apply the changes and connect to the specified
        Wi-Fi access point.
    e.   If the Wi-Fi cannot connect using the new WPA Supplicant file the
        WPA Client will try and connect to the last successful Wi-Fi Access
        Point. If that access point is not available it will fail to connect.
        Sometimes rebooting the hotspot, a couple of times is necessary.
    f.   This uses the same process as if you ran the Pi-Star Wi-Fi builder tool
        and manually placed the file in the /boot folder. The WPA Supplicant
        file method is not fool proof, it works most of the time but many users
        have had trouble connecting to an Access Point using this method.
        The notes section below will list several ways to connect to an
        obstinate Hotspot.
3.   The bottom section of the screen (below the arrow keys) allows you to scan
    your local Wi-Fi environment and see the top 10 Wi-Fi signals. Networks
    that hide the ESSID will be listed as a hidden network.
    a.   To use this feature, press the Scan Wi-Fi button and the button will
        change to green. When the process completes the button will return
        to the original color.

    b.   Once the scan is run you should be able to look through the Wi-Fi networks
        by clicking on the text box to the right of the "ESSID to Select:" field label,
        shown circled in white below:

    c.   Look through the list and find the network you want to connect to.
        Once you find the network type in the Passphrase that corresponds
        to your selection.
    d.   Now press the Connect button and when it completes you will need
        to gracefully shut down the hot spot by using the shutdown button
        on the Links or MMDVM pages.
    e.   Once the unit is shutdown remove power and after a minute or two,
        reapply power and the unit should boot up and connect to the selected
        Wi-Fi network.

Notes:   If you are using USB for the Nextion screen then there is no reason to
wait for the LAN or WLAN. This is only required if you are using a TTL port
on the MMDVM Hat board for your Nextion screen, because data is sent to the
MMDVM Hat via the network using UDP over the /dev/tty/AMA0 port mixed in
with normal mmdvm digital voice data and is tagged as transparent so the mmdvm
modem will ignore it and pass it on to the Nextion screen. Please add this setting
to the /etc/mmdvmhost file. After adding the setting, it should appear in the
Pi-Star Expert Editor under mmdvmhost in the NextionDriver section.

If you add this feature it will allow you to see when the PI-Star hotspot fails to connect to
a Wi-Fi access point (after two minutes) and it puts itself into Access Point Mode. When
Auto AP mode has turned on the OLED or Nextion Screen, it should show wlan0_ap: in the IP Address field at the bottom of the screen. If you see this
you can use a cell phone and connect to the Pi-Star-Setup Access Point. Once connected
to the PI-Star Access Point you can enter into your browser and connect
to the Pi-Star dashboard and do the required setup.

Other Methods of getting a Pi-Star Hotspot on the Network


If you are troubleshooting connecting your Pi to Wi-Fi you have several choices
on how to proceed.

    1.   If your Raspberry Pi has an Ethernet connector, just use an Ethernet cable and
        connect one end to your Raspberry Pi and the other end to your router
        (if it has an unused, active Ethernet port) or you can connect an Ethernet switch
        to the router and connect several Ethernet cables to the switch.
        Using the five Port Gigabyte Ethernet Switch shown below, after connecting one
        Ethernet cable to your router you will have four free ports to connect any Ethernet
        device you wish. You can purchase Ethernet switches with as many ports as you need.

    2.   The easiest way to work on a Pi that does not have an Ethernet port is to use a
        very inexpensive USB to Ethernet adapter. These range from $10.00 – $30.00.
        On a Pi-Zero you will also need a male Micro USB to Female USB adapter. Just
        do a search for a USB to Ethernet Dongle and you will find all you could ever need.

USB to Ethernet                         USB to micro USB used on Pi-Zero

Ethernet to USB with three USB ports (can be used for keyboard and mouse on a Pi-Zero)

USB to USB Hub with three USB ports

A search for USB to Ethernet dongle will turn up hundreds of choices.

Once your Pi is connected to the Ethernet it should get an IP address from your router. If your Hotspot has a display it should show you the IP address that was assigned by DHCP on your router. If your Hotspot does not have a display you can login to your router and see what IP was given to your hotspot. If you have more than one hotspot connected and you have not changed the host name of your Pi you may see more than one device called pi-star so make sure you get the IP of the correct hotspots. If you are not sure you can temporally unplug the other hot spots. Once you know the IP address you can enter it into your browser and you will get the pi-star configuration screen. You can also use one of the many free network scanners like Netscan or Advanced IP Scanner. Once you have the IP address you can open your browser and type: http:// and the IP address of your hotspot. With most home routers this IP will normally be in the form of something like 192.168.1.XXX or 192.168.0.XXX where the XXX is a number from 1-254. If your hotspot does not have Ethernet and you do not want to purchase a USB to Ethernet adapter you can do the following: HDMI port and Keyboard If you have a computer monitor or TV that has an HDMI input port you can connect your HDMI monitor to your Raspberry Pi. Once connected you will need to re-boot the Pi to see anything on the HDMI screen. Make sure the TV or monitor is set to use the HDMI input port. If you also connect a keyboard you will be able to use the computer console and login as the pi-star user. Once logged in you can type: ifconfig and it will show you the IP address the Pi is using. Do not expect to see a GUI desktop on your monitor all you will see is the command line prompt like you see when you SSH into a PI. The pi-star image uses a version of Linux without a GUI or Desktop. If you have never done this it is well work the effort to set this up just to see how the Linux OS loads and runs on a Pi. This is a great way to gain full access to a PI even when it is not connected to a network.