IoT Contest Conclusion

I am delighted to present my final submission for the IoT contest. Throughout this journey, I have worked diligently to develop a reaction trainer prototype rivalling existing commercial solutions such as Blaze Pods. By leveraging the capabilities of the CH32V208W microcontroller, I have designed a custom PCB that incorporates a calibrated RF-fronted specifically engineered to support Bluetooth Low Energy (BLE) functionality. This achievement marks a significant milestone in developing a high-performance reaction trainer.

One of the notable outcomes of this project is the successful integration of WCH’s TMOS-based BLE stack into the RT-Thread operating system. This integration is crucial to enabling seamless communication and interaction between the sensor and various devices. While a final pull request for this integration is still pending, initial testing and implementation have showcased promising results, affirming the potential of this combined technology stack.

You can see the solution in action in the following Video.

Reaction Trainer in Action

Sources

The hardware design was discussed in my previous post here.

The following tools were used during the development process.

The Journey

The development was supported by listening to various contemporary Chinese Pop, KPop, JPop, City Pop, and classic rock songs. 🙂

I digress, please see the description of technical tooling used during the development below.

Firmware Development Process

Using Clion for RT-Thread Development
Using Clion for RT-Thread Development

Throughout the development process, I utilized JetBrains CLion as the primary tool for firmware development. Its comprehensive features and user-friendly interface provided an efficient and streamlined workflow. With CLion, I was able to write, compile, and debug the firmware code seamlessly, ensuring smooth progress throughout the project.

While the RT-Thread IDE showed promise, it lacked Linux support. Furthermore, it poses a challenge in integrating the BSP directly within the IDE. As a result, I had difficulty getting the BSP working within the RT-Thread IDE. However, I quickly adapted to the situation and decided to utilize command-line tools for development instead. This allowed me to overcome the limitations and continue working effectively on the project.

The entire application, including the firmware and RT-Thread configuration, was built using scons, a powerful build system. By leveraging scons –menuconfig, I was able to configure the RT-Thread operating system to suit the specific requirements of the project. This ensured optimal performance and seamless integration of the components.

To index the toolchain and build sources within JetBrains CLion, I made use of the compile_db feature. By incorporating the compile_db, I could effectively navigate and analyze the project’s source code, enhancing the development experience and facilitating efficient debugging. It was obtained using bear in Ubuntu.

Because of the challenges of getting the CH32V208 BSP setup in the RT-Thread IDE, I throughout the duration of the contest, took an active role in providing ample support and assistance to fellow contestants in setting up the BSP for the CH32V platform. By sharing my knowledge and expertise, I aimed to create a collaborative and supportive environment, fostering growth and success for all participants in the contest.

Hardware

Reaction Trainer Design in Kicad
Reaction Trainer Design in Kicad

The hardware design phase of the project was conducted using Kicad, an open-source electronic design automation (EDA) software. Despite the lack of vendor support for Kicad, I was able to overcome this challenge by referring to the provided reference sources in Altium Designer. To create the necessary footprints for the CH32V208 microcontroller, I utilized a sad electronics template as a foundation, customizing it to meet the specific requirements of my design. The Altium-based reference design was manually ported to Kicad, ensuring compatibility and tailored adjustments for my project’s needs. For more in-depth explanations of the various components and design details, please refer to my previous post.

Smart Phone Application (Android)

Android Application Development in JetBrains IntelliJ
Android Application Development in JetBrains IntelliJ

Developing the Android app for this project presented several challenges and learning opportunities. It had been almost a decade since I last worked on mobile development, and this marked my first experience with Bluetooth Low Energy (BLE) integration into a mobile application. The learning curve was steep as I had to familiarize myself with the GATT (Generic Attribute Profile) profile and device management within the Android platform.

To tackle the development process, I utilized JetBrains IntelliJ as my primary development environment. The IntelliJ IDE provided a robust and feature-rich toolkit for Android app development, facilitating a smooth workflow.

Considering the project timeline, the functionality of the Android app was kept relatively simplistic by modern standards. Given more time, I would have dedicated efforts towards refining and enhancing the user experience, incorporating additional features and optimizations.

Overall, the Android app development journey was a valuable learning experience, allowing me to reacquaint myself with mobile development practices while overcoming the challenges associated with BLE integration and GATT profile management.

The only platform the application was tested on was my phone, a Samsung Galaxy S20+.

Conclusion

One of the standout aspects of this project has been the impressive ease of use offered by the RT-Thread operating system. Its user-friendly interface and intuitive design have greatly contributed to the development process. It is truly remarkable to witness a POSIX-like operating system with such a small footprint perform exceptionally well, surpassing expectations in terms of efficiency and functionality.

The power and capabilities of the WCH CH32V-series have left a lasting impression. Despite their affordability, these microcontrollers pack a remarkable punch, offering impressive performance and versatility.

Looking ahead, I am excited to expand the application of this technology by producing more units for testing in martial arts practice at the club. The potential to incorporate these devices into real-world training scenarios holds great promise, and I am eager to witness the impact they can make in enhancing performance and skill development.

While there were a few aspects that didn’t go as planned, such as the initial intention to include an audio frontend that had to be omitted due to space constraints in the low-cost PCB manufacturing process, and the inability to bypass VBUS detection on the CH32V208, limiting the ability to redirect the RT-Thread console to USB-VCP, I was able to adapt and find alternative solutions. The CH32V208 BSP for RT-Thread also presented some challenges, particularly in integrating it with the RT-Thread Studio.

Based on the positive experience and successful outcomes of this project, I am seriously considering utilizing RT-Thread, which is permissible under the Apache 2.0 license, for other commercial applications. The reliability, flexibility, and potential for further innovation offered by RT-Thread make it an enticing choice for future ventures. Its robust performance and expansive capabilities make it a compelling option for a wide range of commercial projects.

This entry was posted in Coding, Contest, Embedded, Linux, Martial Arts, RISCV, RT-Thread, WCH. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *