Introduction: Nextion Touchscreen Outlook Calendar Meeting Reminder
The reason I started this project was because often times I missed meetings and figured I need a better reminder system. Even though we use Microsoft Outlook Calendar but I spent most of my time on Linux/UNIX on the same computer. While working with Linux the PC Outlook Calendar popup reminder is hidden behind LInux VNC or behind another app on my Windows.
I came up with an idea of displaying a meeting reminder above my computer monitors so it is more visible. The plan was to have a touchscreen system to retrieve my next meeting from Outlook Calendar, and a button to press to dismiss a meeting.
1. Nextion touchscreen (from $22)
2. Arduino Nano (from $4) or other Arduino board. I picked Nano because of small formfactor to fit into small case.
3. Mini USB cable
Optional: Find a 3D printer or 3D printer service to print the casing.
I designed and 3D printed the case to fit my monitors and it may not fit other monitors. You may need to design the case.
Watch the video below to show when it is less than 60 seconds, the time is ticking down reminds me to start running to a meeting.
Step 1: Setting Up Nextion Touchscreen
- To learn about Nextion there are a number of tutorials including from this Instructible website, search for "Nextion".
- You can get any Nextion touchscreen from an online store such as Amazon.com (see the picture)
- Download my Nextion file for this project from the following link. You can modify it as desired. https://github.com/suriono/python/blob/master/outlook_calendar_nextion/Appointment.HMI
- Open the file using the Nextion Editor. The Nextion Editor can be downloaded from: https://nextion.tech/nextion-editor/
- Using Nextion Editor, upload the file into the Nextion.
Step 2: Setting Up Arduino
- Like Nextion, instead of going through a lengthy instruction of how to use Arduino, you can search for tutorials of how to use Arduino including this Instructible website.
- In order to fit the entire system into a smaller casing, my choice was Arduino Nano. It's relatively smaller and ability to connect to directly to my PC USB. Alternatively you can can use any Arduino board.
- You can get Arduino Nano from an online store such as Amazon.com as shown in the picture, for less than $4 each.
- Download Nextion Arduino library: https://github.com/itead/ITEADLIB_Arduino_Nextion and include it into Arduino Sketch library.
- By default the Nextion Arduino library assume the numbers are in integer. This poses a problem for Arduino Nano (or any ATmega based boards such as Arduino UNO), where integer is 16-bit which goes from -32768 to 32768. If you use 32-bit Arduino board such as Arduino Due, Mega, or SAMD based boards (MKR1000 and Zero), there is no need to modify the Nextion Arduino library. The following instruction show how to modify from integer to "long" 32-bit numerical type which goes from -2147483,648 to 2147483647. The 32-bit is needed because the time to check the meeting is in seconds. For a meeting in 24 hours it is 86400 seconds which is beyond the 16-bit integer.
Modify the Nextion Arduino library to change the number from integer to long:
- Again, the following steps do not apply to 32-bit Arduino board.
- Go to the Arduino Library folder.
- Go to ITEADLIB_Arduino_Nextion-master folder
- Edit the "NexNumber.h" file:
- Change the line:"bool setValue(uint32_t number)"; to "bool setValue(long number)";
- Edit "NexNumber.cpp" file:
- Change the line: "bool NexNumber::setValue(uint32_t number)" to "bool NexNumber::setValue(long number)"
Change the line: "itoa(number, buf, 10);" to "ltoa(number, buf, 10);"
- Edit the "NexNumber.h" file:
Upload my Arduino code into Arduino Nano: https://github.com/suriono/python/blob/master/out...
Step 3: Setting Up Python
I use Python code to retrieve Microsoft Outlook Calendar appointments/meetings and send it to the Nextion touchscreen via USB Serial port. In the past I used VB.Net but Python is simpler to code, does not require a license, and can be used in any operating system.
There are plenty of tutorials on how to install and programming in Python. Once you have Python installed, the next thing is to install Serial communication by typing: "pip install pyserial" in a command line.
Download my Python code from the following link: https://github.com/suriono/python/blob/master/outlook_calendar_nextion/calendar_nextion.py
Inside the Python code, you need to modify the USB Serial port to match the port used by your computer. To find out the port number, connect the Arduino board then go to the Device Manager. In my case it is "COM12" (see the picture.
Python line to modify for my example:
myserial = MySerial("COM12")
Note: I plan to continually improve the Python code, including adding GUI (Graphical User Interface) such as a pull-down menu to select serial COM number. Then a button to start and stop retrieving/sending calendar meeting to the touchscreen. I would recommend to follow this instructible to get the latest update.
Step 4: Wiring
The following is the diagram of the wiring:
5V ------> VCC
TX ------> pin 10
RX ------> pin 11
GND ------> GND
Connect the Arduino to your computer.
Step 5: Running Tests
After wiring the Nextion to the Arduino and connect the Arduino to a computer USB port, then it is ready for a test.
When you install Python, if you check a box to add Python to the Environment Variables, you can simply click my Python file: "calendar_nextion.py" mentioned in an earlier step. There is pop-up window (see the picture). If not, you can manually add the path of the Python to your Environment Variables first. Another option is to use the Windows Command, go to the folder where you download the "calendar_nextion.py" file from my GitHub then type "python calendar_nextion.py".
The program will retrieve your Outlook Calendar meeting every minute. It will show the remaining minutes or seconds before the next meeting. When it is less than 1 minute, it will start counting down every second before the start of the next meeting. This is the part where you are supposed to be running to the meeting :).
If you press the "DISMISS" button, it will skip the current next meeting reminder and jump to the next subsequent meeting.
Step 6: Optional: to Run the Python Code Automatically With Docking Station
See my instructible of how to run a program, in this case the python code, automatically when you dock your laptop into a docking station.