[Virtual Presenter] Welcome to our training video on the importance of serial connection in wired communication for Machine-to-Machine Communication. We will be discussing the key role of serial connection and how Python, along with the pyserial library, can help integrate it on various platforms and devices. This is the first slide of our presentation where we will cover the benefits of using Python for M2M serial communication. In our previous IoT course, we experimented with serial connection on Visual Studio, but we have found that Python is the most suitable option due to its compatibility with all platforms and devices, thanks to being an open-source language. Let's now take a quick look at how Python and Arduino interact through serial wired communication. For a more in-depth understanding, please refer to our recorded discussion video in LF2F. The first step in this process is to install a library called pyserial, which enables communication. This library is not automatically included in most Python versions and needs to be installed separately. The link to the pyserial library documentation can be found on this slide. To install it, you will need to use the command prompt as shown in the screenshot. You can also watch the step-by-step video guide in BBL. Thank you for watching our first slide. Our next slide will cover the benefits of using Python and pyserial for M2M communication, so stay tuned for more valuable information..
[Audio] This second slide of our presentation will cover the code listing for establishing wired communication between Python and Arduino, an important aspect of Machine-to-Machine communication. The code example was built using Python 3.9, but it is also compatible with newer versions. We have imported the 'serial' and 'time' modules to enable wired communication. We have instantiated a serial object and set the port to 'COM5', where our Arduino is connected. It's important to check the Device Manager for the correct port, as it may vary. A brief pause is included for proper serial processing. The 'write' function is used to send bytes to the Arduino, one at a time, to prevent buffer overload. The 'readLine' function allows the serial object to receive messages from the Arduino. The decoded byte will be printed and a condition checks for the message "weeee". Depending on the condition, different lines are printed. The 'flushInput' function is used to clear the buffer before 'readLine'. In summary, Python and the pyserial library are crucial for integration in a wired communication system for efficient Machine-to-Machine communication. Stay tuned for our next slide..
[Audio] This slide discusses the use of Python and the pyserial library to integrate serial communication on various platforms and devices. The demonstration uses pin 13 as an output pin for an LED and pin 3 as an input pin to check for incoming bytes. The Arduino checks for 'H' and 'L' from Python and turns the LED on or off accordingly. This allows for easy control of the LED through Python. The communication continues with Python running an endless while loop to continuously send 'H' and 'L', while the Arduino checks for incoming bytes and monitors the input on pin 3. If a HIGH input is detected, the Arduino prints "weee" which is then received by Python through serial communication. This basic circuit effectively demonstrates the importance of serial connection in Machine-to-Machine Communication. In the next slide, more advanced techniques for serial communication will be discussed..
[Audio] We have now reached the final slide of our presentation, discussing the significance of serial connection in establishing wired communication for Machine-to-Machine Communication. As we have learned, Python and the pyserial library are essential tools for integrating wired communication on different platforms and devices. During our demonstration, we used a wire as the input for pin 3, but this may not always be the optimal choice. It is worth noting that a button with a pull-up or a toggle switch can also serve as the input, allowing for more flexibility by providing either GND or +V. Additionally, we discussed how Arduino waits for 'H' and 'L' signals to be sent, while Python sends 'H' and 'L' bytes continuously in a loop. This enables the ability to turn on or off an LED through serial communication. Furthermore, Arduino can send a customized message, such as "weee," when pin 3 is set to HIGH, which can be received by Python and then printed based on the value. In conclusion, serial connection plays a crucial role in establishing wired communication in the world of M2M communication. By utilizing Python and the pyserial library, it is possible to integrate wired communication on a variety of platforms and devices. Thank you for watching our presentation and we hope you now have a better understanding of the importance of serial connection in the world of M2M communication..