Programming - Windows
This section explains the step-by-step process for programming and testing the Tech-Box.io LED Word Clock
Table of Contents - LED Word Clock Instruction Guide
Programming Preface
The following instructions will guide you through the processes of preparing your Windows PC with the correct Arduino IDE configuration (the computer program used to upload a program to your Nano Board (Part C)) and through programming the Nano Board (Part C) microcontroller and DS3231 Real Time Clock (Part D).
(Note: To update the time that is displayed on the screen or to adjust the time for Daylight Saving Time [DST], you will need to complete this programming process. If you have already completed this process and installed the Arduino IDE and required libraries previously, you may skip to Step 10 below)
Before starting the programming process, select your desired clock face (Part B-1 or B-2). The Tech-Box.io LED Word Clock is supplied with two face styles known as “FiveThirty” (Part B-1) and “HalfTo” (Part B-2), shown in the image below. The “FiveThirty” face (Part B-1) illustrates time in the style: “Five : Thirty”, “Twelve : Forty”, and “Eight : Even”. The “HalfTo” face (Part B-2) illustrates time in the style: “Five To Twelve”, “Half To Three”, and “Twenty Of Six”.
Programming
Now that you have selected your favorite clock face, follow the steps below to complete the programming of your kit’s Nano Board microcontroller (Part C) and DS3231 Real Time Clock (Part D):
-
Begin by connecting the Mini USB Cable (Part H) to the Nano Board (Part C) and then plug it into your PC or your PC’s USB hub (Note: Not all USB hubs work correctly with the Arduino IDE, so if you have issues while using a USB hub, connect the cable directly to your PC, if possible).
(Note: Parts other than the Nano Board (Part C) and Mini USB Cable (Part H) have been removed from the image above for clarity)
When you upload code to the pre-programmed Nano Board (Part C), the existing program on the board will be erased and overwritten. The Nano Board (Part C) can be programmed an unlimited number of times, and each upload will overwrite the prior program, so you can always customize or alter the code in the future to fit or change your style.
-
If you have not already downloaded and installed the Arduino IDE version 1.8.X previously for another Arduino related project, you can follow this guide (linked here) for the step-by-step installation process. Once it is installed, you can continue with this step.
Download the Arduino Code file for this project, by clicking the link below and accepting the download if prompted. This download will appear where your downloads are typically stored. Your location may be slightly different depending on your PC setup. For example, the downloads folder on our Windows 10 PC was accessed by opening “File Explorer” and clicking on “Downloads” in the options on the left side of the window or by going to the following path “C:\Users\YourUsername\Downloads”. However, your location may be slightly different depending on your PC setup. Be sure to note the folder location, as you will use it in the following steps. (Note: If at any point, you accidentally delete or edit the code in the file and receive error notifications from the Arduino IDE, you can re-download a fresh copy of the file by clicking the link below again.)
- Once the file is downloaded, you will need to unzip it and open it in the Arduino IDE. If you open the code file without unzipping the folder first, you may encounter errors in the following steps. To do this on a Windows 10 PC, you will need to locate the zipped folder downloaded under Step 2 and “Right Click” it. A menu of options will appear, and you will need to select “Extract All…” as shown below. (Note: Your options for extraction may vary based on 3rd party programs that are installed to your PC. If you have any issues or questions, feel free to contact Tech-Box Support by email at Support@Tech-Box.io)
This will display another window where you can choose a destination for the file to be saved at by clicking “Browse…”, or you can leave it as the default, as shown in the image below. For our PC, the default location saved the extracted file to the “Downloads” folder that the zipped folder was previously saved in. Once you have set the destination, click “Extract” to complete the unzipping process.
Once the folder has been unzipped, you can access the Tech-BoxIO_LED_Word_Clock.ino file that is inside of it. To open the code file, you will need to open the Arduino IDE and press “Ctrl+O” on your keyboard to pull up the open file dialog box, this can also be accessed by clicking “File” -> “Open…”. Then navigate to where you previously unzipped the file above, click on the file, and click “Open”, as shown below.
- In order for your PC to communicate with the Nano Board (Part C), it is necessary to install the CH340 Serial driver. The Nano Board uses a small computing chip, the “CH340”, to translate USB data and serial UART messages between your PC and the microcontroller that is located on the Nano Board (Part C). Follow the instructions below for a step-by-step guide on how to install the CH340 Serial driver to your Windows PC.
Sub-step 4A) This driver software has been tested and confirmed to work with Windows 10 and Windows 7 PCs. Begin by downloading the Windows Executable (EXE) file by clicking the link below. (Note: To successfully install the driver software, you may need to obtain administrative privileges from your IT administrator if your computer is controlled on a domain, such as in a workplace or school system).
CH340 Windows Driver (EXE) -- Driver Executable
Sub-step 4B) Locate the file that you just downloaded, typically the default download location is the "Download" folder which is the same location as the previous downloads in this guide. Once you locate the file, double-click it to run the executable, which will open a window like the one shown in the image below. (Note: You may have to give Administrator approval to run the file. If so, select "Yes" when prompted, and continue with the installation). DO NOT click either the Install or Uninstall button until continuing with Sub-step 4C below!
Sub-step 4C) Begin by clicking the "Uninstall" button, as shown in the image above. This uninstalls any existing CH340 driver installation that may conflict with this driver version. Once the uninstall operation is complete, a message box will appear and state that the CH340 driver has been uninstalled (if it was previously installed), as shown on the right side of the image below. If no driver was previously installed, the notification will instead state that no device was found, as shown on the left side of the image below.
Sub-step 4D) Click the "Install" button, as shown in the image under Sub-step 4B above. This will install the tested CH340 driver. Once the installation is complete, a notification will appear stating that the driver has been successfully installed, similar to the image shown below.
Sub-step 4E) Verify the driver installation using the Arduino IDE and Nano Board (Part C) by selecting the "Tools" menu on your Arduino IDE with the Nano Board (Part C) disconnected from your PC, as shown in the image below. The "Port" selection should be greyed out, as highlighted by the arrow below. Now, deselect the menu by clicking anywhere else on the Arduino IDE.
Sub-step 4F) Connect the Nano Board (Part C) to your PC using the Mini-USB cable (Part H). Then select Tools -> Ports and you should see that a COM "#" port has appeared, as highlighted by the arrow in the image below. The COM "#" ports are labeled by number and the values will vary by PC, but typically range from COM3 to COM9. Our Nano Board (Part C) appeared as COM5, but your board may appear as any COM "#" value. To download to the Nano Board (Part C), click and select the new COM "#" port that appeared in this menu. (Note: The COM "#" should not change when unplugging and reconnecting the board.) If you are unsure which COM# port your Nano Board (Part C) is connected to and multiple COM# ports are appearing, you can unplug your Nano Board (Part C) and then check the menu again to see which COM port is no longer present. Then, reconnect your Nano Board (Part C) and select the correct port once it reappears. Once the new COM "#" port is selected, proceed with Step 5 below.
Troubleshooting for step 4:
COM Port Does Not Appear in Port Menu
If no COM port appears under the “Port:” option with the Nano Board (Part C) connected, there may be a component or wire placed incorrectly. In this event, first attempt to connect to different USB ports on your computer and check if a COM port appears under the "Port:" menu. If no ports appear, then remove the Nano Board (Part C) from the Breadboard (Part F) and attempt to select a COM port again. If the issue persists, disconnect and then reconnect the Nano Board (Part C) from/to the Mini USB cable (Part H) to power cycle the Nano Board (Part C) and attempt the COM port selection again. If the COM port selection now works, check all of your wiring and component placements to make sure that they are in the correct locations. If you have any issues with the selection, please contact Support@Tech-Box.io
COM Port is Not Showing Up as CH340
There have been a few reports on Windows 10 where the CH340 driver will install automatically and the board will appear under a new COM port as USB-Serial CH340, but with a different device name. The board cannot be accessed on the Arduino IDE, however, so the board cannot be downloaded to. Other issues with Windows 10 installations have included the installation hanging.
Based on community experience, this is very isolated and specific to the PC manufacturer. Makers usually are able to get the board recognized by a combination of giving the computer time to finish the installation (sometimes in excess of 20 minutes), by plugging the board back in multiple times, uninstalling and reinstalling drivers, and/or restarting the computer multiple times (repeating all steps). Again, this issue appears to be very isolated. If you have any issues with the installation, please contact Support@Tech-Box.io
COM Port Not Available
If you installed the drivers for the CH340 and are having issues connecting via the serial terminal or uploading code using the Arduino IDE, there may be an issue with your user settings or permissions that is preventing your machine from accessing the CH340.
Check to make sure that your configuration settings are correct and that the drivers are installed (and installed with administrator privileges). If the issue persists, we recommend uninstalling and reinstalling the drivers for your operating system. If you have any issues with the installation, please contact Support@Tech-Box.io
USB Cable
Some third-party USB cables are meant for power only and may not have data wires included. These cables will not allow for your microcontroller to communicate with your computer. Therefore, we recommend using ONLY the provided USB cables from our guided kits as all Tech-Box.io USB cables are configured with integrated data lines. If you have any issues with the installation, please contact Support@Tech-Box.io
End Troubleshooting for Step 4
- Once the project file is opened in the Arduino IDE, select the correct board settings in your Arduino IDE to complete the upload. To do this, in your Arduino IDE, select Tools -> Board -> Arduino AVR Board -> Arduino Nano (or Tools -> Board -> Arduino Nano on some installations) as shown in the image below.
Then, ensure that the processor selection that appears below the "Board" options (and highlighted by the yellow rectangle in the image below), is set to "ATmega328P" and NOT "ATmega328P (Old Bootloader)". (Note: The processor selection will only appear once the Arduino Nano Board has been selected). Once these selections are made, click the “Checkmark” in the upper left-hand corner of the Arduino IDE, as highlighted by the red square in the image below, to verify and compile the code. This selection allows the compiler to prepare the code to be uploaded to the correct microcontroller. After a short time, your compile will complete successfully.
The Arduino code file for this project has been completely commented with each variable, line, and code block’s function explained. Feel free to read through the code to learn what each section is doing and check your understanding!
Troubleshooting for step 5:
If there are errors when attempting to compile the code in the Arduino IDE, complete the following troubleshooting steps:
1) If the error persists, restart your computer, then open the Arduino IDE and project code and attempt to compile again.
2) If the compile still fails, please open a support ticket with Tech-Box.io Customer Support by sending an email to Support@Tech-Box.io and include the name of your kit and describe or provide the error code you are encountering in the Arduino IDE (The error information will be in the area that appears orange and black at the bottom of your Arduino IDE). Customer support will get back with you as quickly as possible!
End Troubleshooting for Step 5
-
In the following steps, you will have the option to make some edits to the code file based on your preferences. Before doing so, you will need to make sure that the "Display line numbers" option in your Arduino IDE is toggled "ON" to make navigating the code a little easier. To turn this option on, select "File" -> "Preferences" on your Arduino IDE to display the preferences window, as shown in the image below. Then, click the box next to "Display line numbers", as highlighted by the blue rectangle below, to toggle that function on. Finally, click “OK” to confirm the change and close the preferences window. Now, each line of code should have its own line number displayed on the left side of the Arduino IDE.
-
For HalfTo Clock Face Only (Optional):
Replace the code on line 24 with the line of code shown below:
bool Select_FiveThirtyFace = false;
If you wish to return to the “FiveThirty” Clock Face (Part B-1) at any point, replace the code on line 24 with the following line of code:
bool Select_FiveThirtyFace = true;
-
For Color Customization to another Color Preset (Optional):
The code file is provided with 5 preset color configurations for your Word Clock. These color presets can be changed by replacing the “color_preset#” that appears on lines 226, 239, 320, 333, and 346, with “color_preset1”, “color_preset2”, “color_preset3”, “color_preset4”, or “color_preset5”. The color presets are described below (Note: Only two of the three listed colors are used for the “FiveThirty” clock face (Part B-1)):
color_preset1 --> Red, Gold, and White
color_preset2 --> Gold, Purple, and Silver
color_preset3 --> Orange, Navy, and Silver
color_preset4 --> Green, Red, and Silver
color_preset5 --> Orchid
Alternatively, if you desire for each letter of the time displayed to have a random color, comment out lines 226, 239, 320, 333, and 346 by placing a “//” prior to them, and uncomment lines 229, 242, 323, 336, and 349 by removing the “//” prior to them. An example is shown in the image below with the original preset option selected and shown on the left and the random color preset option selected and shown on the right:
Make sure to click the “Checkmark” in the upper left-hand of the Arduino IDE after making these edits, like you did in Step 5, above. If the edits were made successfully, the compile operation will complete successfully. Otherwise, you may have an error, typo, or other issue that will require you to restart with a fresh download of the code file.
-
For Color Customization altering Color Presets (Optional):
The color presets can be individually customized by altering the RGB (red, green, and blue) color values within each preset.
The code file is provided with 5 color presets described under Step 8, above. Each preset’s colors can be changed by editing the RGB color values where the presets are created. The RGB values must be between 0 and 255, and each preset (except color_preset5) has 3 colors preconfigured. The preset color objects are created on lines 359, 378, 397, 416, and 435 of the code. To customize the colors of each preset, you will need to edit the “CRGB(#,#,#)” values for each object. For example, on line 363, the color preset can be changed from “CRGB(255,0,0)” (Red - Left Image) to “CRGB(0,255,0)” (Green - Right Image), as shown in the image below:
Make sure to click the “Checkmark” in the upper left-hand of the Arduino IDE after making these edits, like you did in Step 5, above. If the edits were made successfully, the compile operation will complete successfully. Otherwise, you may have an error, typo, or other issue that will require you to restart with a fresh download of the code file.
-
With the proper board type and COM port selected, the DS3231 Real Time Clock (Part D) must be be reset to allow its time to be updated. To reset the DS3231 Real Time Clock, update its time, and complete the programming process for the Nano Board (Part C), follow the sub-steps below:
Sub-step 10A) First, REMOVE the DS3231 Real Time Clock (Part D) from the breadboard (Note: Other components and wires are removed for clarity, DO NOT remove any other wires or connections. Leave the Nano Board (Part C) connected to your PC for the entirety of this step).
Sub-step 10B) Once the DS3231 Real Time Clock (Part D) has been removed from the breadboard (Part F), remove the CR2032 Coin Cell Battery (Part G) from the DS3231 Real Time Clock by pressing the metal tab, as highlighted by the blue arrow in the image below. Keep the battery removed for at least 10 seconds. Then place the battery back into the same location you just removed it from, ensuring the metal tab snaps over the battery, holding it in place, as highlighted by the blue arrow in the image below.
Sub-step 10C) Once the CR2032 Coin Cell Battery (Part G) has been placed back into the DS3231 Real Time Clock (Part D), place the DS3231 Real Time Clock back into the breadboard (Part F) with the 32K pin located in pin position A30 and the GND pin in position A25, as shown in the image below.
Sub-step 10D) Finally, return to the Arduino IDE on your PC and click the “Arrow” in the upper left-hand corner of the Arduino IDE to upload the code to the Nano Board (Part C), as highlighted by the arrow in the image below. The Arduino IDE will notify you when the file is “Done Uploading” in the lower left-hand area of the Arduino IDE, as highlighted by the red rectangle below. This Nano Board microcontroller (Part C) can be rewritten/re-uploaded to an unlimited number of times, if desired. Feel free to create your own custom color pattern and re-upload to the Nano Board microcontroller (Part C) as needed!
Note: The code for this project sets the DS3231 Real Time Clock (Part D) to the time the sketch was compiled and uploaded to the Nano Board (Part C). If the time that is displayed is incorrect or "off", you will need complete this entire step again to correct the time. If the time shown is still incorrect, check the system time of your PC to ensure it is accurate to the real time in your area. The word clock advances time in 5-minute increments, so keep in mind that your accuracy will be limited to that resolution.
Troubleshooting for step 10:
If there are any errors when uploading the code to the Nano Board (Part C), complete the following troubleshooting steps:
1) Check the wiring and component placements; including the placement of the Nano Board (Part C) itself. If wires or components are in the wrong locations, it may block the code from being uploaded or prevent the Nano Board (Part C) from appearing in the COM port options. Once you have checked everything, attempt the upload again.
2) If the error persists, remove the Mini-USB cable (Part H) from the Nano Board (Part C) and then remove the Nano Board (Part C) from the breadboard (Part F). Then reconnect the Mini-USB cable (Part H) to the Nano Board (Part C) and attempt to upload the code while it is disconnected from the breadboard (Part F). If the upload is successful now, this may mean that some part of the wiring is incorrect. So check the wiring and component placement again, then reinsert the Nano Board (Part C) into the breadboard (Part F) at the correct pin location shown in the wiring section of this guide.
3) If your program still fails to download, please open a support ticket with Tech-Box.io Customer Support by sending an email to Support@Tech-Box.io and include the name of your kit and specific issue in the email. Customer Support will get back with you as quickly as possible!
End Troubleshooting for Step 10
- With the Nano Board (Part C) programmed and still connected to your PC and with all wiring connections made, you should see that the LED matrix (Part E) is illuminated (with the current time). If no illumination is present, double check your wiring to ensure all components and wires are placed correctly, and then repeat Step 10. If your issue persists, please reach out to Support@tech-box.io and our support team will be happy to assist you!
To verify that the time is displayed correctly, lay your selected clock face (Part B-1 or B-2) over the LED matrix (Part E) as shown in the image below, with the VIN pin of the LED matrix (Part E) located in the upper left-hand corner of the clock face (Part B-1 or B-2). Your current time, approximated to the nearest 5 minutes, should now be displayed. For example, “Nine Fifteen” or “9:15” is displayed in the image below for the “FiveThirty” clock face (Part B-1). If your time is displayed incorrectly, repeat Step 10, above.
Congratulations! You have now successfully programmed and tested your LED Word Clock and are ready to start assembling the LED Word Clock housing (Parts A and B)! Continue to the next page and follow the steps in that section to complete the Tech-Box.io LED Word Clock.