This is gonna be a long update.
Its been a while since i've said anything about the project, so here's a little update! I have managed to integrate a LLM (Large Language Model, basically what powers ChatGPT, Co-pilot and others) into a Raspberry Pi and managed to send the prompt to an Arduino Uno.
When I started the project, I first started with the Bluetooth part, but I ran into a problem. My smart cube wasnt connecting to my Raspberry Pi, no matter what I did. So, i skipped the bluetooth part and decided to go for the AI. Now, this part of the project, at least for me, was the hardest part of the project. I have never seen anyone actually do it, but ive managed to make it work. Here's how.
When I started working on the AI coach, I tried using ChatGPT's API. Most people usually use ChatGPT for these projects. But unfortunately, due to corporate greed, you had to pay some money to make it work, so I needed an alternative. Thankfully, ive found some alternatives like Google Gemini's API (yes you can use it in a Python project), but I didnt use it. Most of the API's either required money to operate, or werent supported by the Raspberry Pi 5.
But ive found a workaround. I used Ollama for this project. If you havent heard already, Ollama is basically a library for LLM's, meaning I am not limited to using just one LLM by one company. You can run it on Windows, Linux, or Mac. You can find LLMs from Microsoft, Google, Meta, even Ali Baba, which meant I had a variety of LLM's to choose from. After a lot of consideration, I chose Phi-3 by Microsoft. It was probably the most efficient out of the bunch, with a fast typing speed and efficient responses. But then I ran into a problem.
Most websites that used the Raspberry Pi to run Ollama used the Linux terminal to run their LLM's. After some digging, i found out that Ollama had an official Python library for integrating Ollama into Python. This was great news. I made a program where you had to insert a question, and the AI would answer it. All I needed to do now was add some code to the program that would send the AI's answer via serial communication to the Arduino to be shown on the OLED screen module (the small ones).
I've ran into a number of errors in my code because the prompt wasnt being delivered in string for some reason, then i rewrote the code. It worked from there. The OLED screen got short-circuited (i dont even know how that happened), so I wasnt able to use it, but after some tests, I found out that the Raspberry Pi was indeed sending what the AI was saying to the Arduino. It worked.
But here's why i'm writing this update. I am not moving forward with this project, at least for now. I am about to enter High School in the following weeks so I wont have time to work on the project. But, thats not saying it cant be done. Someday I might be able to make the project into a reality someday, but time will tell.