Skip to content

Arduino HowTo (Windows)

venice1200 edited this page Feb 10, 2022 · 60 revisions

HowTo Build the tty2oled Arduino Program under Windows

Note: ๐Ÿ’ฅThe Updater released at the 2021-11-26 is able to upload the firmware onto your tty2oled device.๐Ÿ’ฅ

If you know how to use the Arduino IDE and how to add Boards and Libraries you can jump directly to Arduino IDE Settings.

I think the HowTo can be used, slightly adjusted, for Linux as well.

Some Infos/Conventions:

Sketch = Arduino Code/Programm
Used OS: Windows 10 20H2
User's Desktop folder: C:\Users\testuser\Desktop

On Windows

Create the Project Directories.
Project Base folder: C:\Users\testuser\Desktop\tty2oled
Project Sketch folder: C:\Users\testuser\Desktop\tty2oled\sketch
Project Sketch Library folder: C:\Users\testuser\Desktop\tty2oled\sketch\libraries
All folder Names, except "libraries", are just examples.
And "libraries" must be a Subfolder of your "Sketch" folder.

Download the Arduino IDE from https://www.arduino.cc/en/software.
Actual is v1.8.16 (09/2021). I use the ZIPed Version.
Direct link: https://downloads.arduino.cc/arduino-1.8.16-windows.zip

Unzip all including the arduino-1.8.16 folder to the Project Base folder C:\Users\testuser\Desktop\tty2oled

Project Folders

Start Arduino

Start "arduino.exe" from C:\Users\testuser\Desktop\tty2oled\arduino-1.8.16

Acknowledge the Windows Firewall Request if it appears.

Set the Arduino Preferences

Open Arduino-IDE Menu "File->Preferences"
The default Sketchbook Folder is C:\Users\testuser\Documents\Arduino for my "testuser".
Change it to the Project Sketch folder C:\Users\testuser\Desktop\tty2oled\sketch.

Add https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
to "Additional Boards Manager URL's".
If you use an ESP8266 (NodeMCU), add https://arduino.esp8266.com/stable/package_esp8266com_index.json
to "Additional Boards Manager URL's".

Enable at "Show verbose output during:" the options "compilation" and "upload".
Enable "Display Line Numbers"

Click "OK".

Preferences

Just to be safe, Restart Arduino and check the settings again.

Adding Board and Library

Adding the ESP32 Board to Arduino
Open Arduino-IDE Menu "Tools -> Board -> Boards Manager...".

Board Menu

Type "ESP32" into the search field and after a while you should see the package to install.
Choose latest Version (1.0.6 in 05/2021) and click "Install".

Board ESP32

Wait until the board installation is finished and "Close" the Window.
The "Board-Package" is installed into C:\Users\testuser\AppData\Local\Arduino15.
โ— If the Board is not listed check the "Arduino Preferences".

Display Libraries for the NEW Greyscale Program Version

The U8G2 Library is only needed if you want to run the Old Monochrome Version.
If you like to use the New Greyscale Version you need to add a few additional Libraries.

  1. You need to add the Adafruit GFX Library from Adafruit to your Arduino System.
    Use the Arduino IDE Library Manager (Sketch > Include Library > Manage Libraries) and search for GFX.
  2. You need to add the U8G2 for Adafruit GFX Library to your Arduino System.
    Use the Arduino IDE Library Manager (Sketch > Include Library > Manage Libraries) and search for U8G2 for Adafruit GFX.
  3. You need to add the bounce2 Library to your Arduino System.
    Use the Arduino IDE Library Manager (Sketch > Include Library > Manage Libraries) and search for bounce2.
  4. You need to add manually the low level Library for the SSD1322 Controller.
    Use the Link https://github.com/venice1200/SSD1322_for_Adafruit_GFX/releases and Download the latest "Release".
    Unpack the ZIP content to your Arduino Library folder at C:\Users\testuser\Desktop\tty2oled\sketch\libraries.
  5. If you use the TTGO-T8 or d.ti Board you need to add manually the Library for the MIC184 Temperature Sensor.
    Use the Link https://github.com/venice1200/MIC184_Temperature_Sensor/releases and Download the latest "Release".
    Unpack the ZIP content to your Arduino Library folder at C:\Users\testuser\Desktop\tty2oled\sketch\libraries.
  6. If you use the TTGO-T8 or d.ti Board you need to add the FastLED Library to your Arduino System.
    Use the Arduino IDE Library Manager (Sketch > Include Library > Manage Libraries) and search for FastLed.

Display Library for the OLD Monochrome Program Version

Adding the U8g2 Library to Arduino (tty2oled Monochrome Version)
Open Arduino-IDE Menu "Sketch -> Include Library -> Manage Libraries...".

Lib Menu

Type "U8g2" into the search field and after a while you should see the Library to install.
Maybe you need to scroll down a bit.
Choose latest Version (Version 2.28.10 in 05/2021) and click "Install".

Lib U8g2

Wait until the library installation is finished and "Close" the Window.
The Library is installed into C:\Users\testuser\Desktop\tty2oled\sketch\libraries.

Download tty2oled Code

Download the tty2oled content from Github ๐Ÿ˜‰
Use the direct Link: https://github.com/venice1200/MiSTer_tty2oled/archive/refs/heads/main.zip .
Open the ZIP and the Folder "MiSTer_tty2oled-main" within the ZIP. Extract your preferred Sketch folder to C:\Users\testuser\Desktop\tty2oled\sketch.

Extract Sketch

Start or Restart Arduino again.

โ„น๏ธ Starting with the OTA-USB-Version we add code for Over The Air (Wireless) Update.
Means, you can update the Program on the ESP32 via Wireless Network from the Arduino IDE.
To use this new feature you need to modify the file "cred.h" within the Arduino Code Folder with valid Wireless Credentials.
The OTA Procedure will we described here.

Uncomment Board settings in Sketch (no longer needed)

โ„น๏ธ Starting with the USB-Version of 2021-05-27 you only need to choose the correct Target Device/Board in the Arduino IDE.
The Arduino IDE and the Sketch should detect the chosen Board and enable the needed settings automatically.
Functionality tested with Arduino IDE 1.8.13/1.8.15, ESP32 Package 1.0.5/1.0.6 and ESP8266 Package 3.0.0/3.0.1.

Choose Target Device/Board in Arduino

Open Arduino-IDE Menu "Tools -> Board -> ESP32 and choose ESP32 Dev Module" if you use an TTGO T8.

Choose ESP

Choose another Entry from the List if you use a different Device.
โ„น๏ธ At the bottom of the Arduino Window you should see which device was selected.

ESP Selected

Open Arduino-IDE Menu "Tools" and double check the Device and the Device "Capabilities".
Example: My TTGO-T8 has 16MB Flash so I change "Flash Size" from 4MB to 16MB.

ESP check

โ„น๏ธ As I use an Lolin32 ESP32 for this HowTo I switched to "Wemos Lolin 32".

Verify Sketch

Click on "Verify".

Verify

You should see "Compiling Sketch" and a lot output below.

Compiling

If you see "Done compiling" you are ready for the Upload.

Compiled

โ— If there are Errors double check the HowTo โ—

Upload Sketch

If Verify was successful you can connect your ESP.
After the ESP is connected your Windows Device Manager should show an COM Device named "Silicon Labs CP210x USB to UART Bridge"
with the COM Port No. in Brackets, here (COM15).

Windows Device

โ— If the ESP is not correctly identified go to https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers.
Under "Downloads" download the CP210x Universal Windows Driver (v10.1.10) ZIP file.
Direct Link: https://www.silabs.com/documents/public/software/CP210x_Universal_Windows_Driver.zip .

Download Driver

Install the drivers for the Device (not explained here).

Open Arduino-IDE Menu "Tools -> Port" and select the Device's serial Port, here COM15.

Arduino Port

โ„น๏ธ The selected Port should be shown now at the bottom of the Arduino Window.

Arduino Port selected

Click on "Upload"

Upload Button

You should see "Compiling Sketch" with a lot output...
After "Compiling..." you should see "Uploading...",

Uploading Sketch

and hopefully "Done uploading".

Sketch uploaded

If your Display shows "MiSTer FPGA by Sorgelig" with an SD or USB Icon in the right/upper corner Congratulations.
You can open now the Serial Monitor and test your Display.

Serial Monitor Button

โ— If your Display shows nothing, check all the cables and check Electrical as well for 4SPI โ—