Blueprint

✨🤖 GPT On Wheels ⚙️💡

My homemade autonomous AI robot: What happens when you put a pan-tilt camera, speaker & mic, tof distance sensors, environmental sensors, and more on wheels and then let an AI control the body?

Created by Shreemahor Sivakumar Shreemahor Sivakumar

Tier 4

265 views

3 followers

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Mic and Speaker

image

Mic

The mic was just a small usb addon on the usb 3.0 that worked easily. I could go to the input tab on the gui after the 'pavucontrol' command, then going under the input tab, or alternatively just clicking the mic symbol at the top right corner to adjust volume.

Speaker

This was troublesome because when I first connected it it did not work.

Biggest issue: No headphone jack

The pi 5 does not have a headphone jack so it's hard to buy a normal speaker. So this bluetooth one would be best.

Initial Try

I just tried connecting the usb and usb c, I even had a usb c to usb adapter ready, but audio would not play. I tried switching the M button but that just sent to FM mode and static.

Working Method

  1. I navigated to the interface for raspberry pi 5 settings using 'sudo raspi-config' which brought me to the interface
  2. I went into advanced -> audio -> pulseaudio and I chose pulseaudio because that's the correct cli integration
  3. Then I installed some dependencies and started in the terminal
  4. then I needed to start bluetoothct1 the command line tool for audio bluetooth devices using 'power on' then 'agent on' then 'scan on'
  5. Then I needed to find my speaker - it showed up as 'BT Speaker'
  6. After that I needed to connect it by 'pair [address]'

Then I used pavucontrol to adjust audio and ensure its working, I tried other methods also like more raspberry pi configurations and pulsemixer but this route was the best.

Finally using the python library for raspberry pi audio devices, sounddevice, and numpy, I ran a simple script to check programmatically if the audio was working.

image

The pause and next buttons don't work but that's okay.

Next

I still can't really start building because I am still waiting for the batteries to arrive, but I can start experimenting like this.

CAN CAN ⚡🚀 approved ✨🤖 GPT On Wheels ⚙️💡 ago

Tier approved: 4

Grant approved: $52.00

Nice work

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

technical_. technical_. requested changes for ✨🤖 GPT On Wheels ⚙️💡 ago

This is a tier four. Please increase hardware complexity, or decrease your requested grant amount.

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Improving Hardware

image

Making Hardware Improvements using components I already have

Pan-Tilt

The camera can only have one view. This was one of the most annoying parts with the prototype itself because it could only look forward, not look around. Humans can do this by turning their heads, so GPT On Wheels needs something similar. This is what the Pan-Tilt is for. I watched many videos on how the pan-tilt worked with servos but still found it hard to believe until I tested it myself. Because servos can only turn clockwise or anti, how would they make something look around?
image
The x horizontal is simple, it is jut a flat circle. The y vertical direction however is different; the servo is actually mounted facing a different direction, while being connected to the first servo. So the first servo moves in the x then the y servo is the same thing but facing a different direction so it moves y, as illustrated by my picture. X is pan and Y is tilt.

But how do you manually configure this? All of the videos I watched had 3d printed exact parts (which I don't have) and little plastic connectors and screws (which I do have). I did not have the exact 3d parts for servos, but I had some little 3d parts from an old project. I decided to reuse for the pan-tilt frame. I just used tape but I needed some way for the bottom servo to stick to the top servo. This is what the plastic connectors are usually for, but I don't have exact parts for them or know exactly how to configure them, so I just tried.

  1. Only screws just did not work because no turnable-element/tightness/connector with 3d part
  2. Tape too fragile
  3. Cardboard unattachable at end

What finally worked was a foam block. It locked perfectly and its sponginess was exactly what I needed. Along with tape, it worked.

image

But it had one problem: the length of the camera's ribbon cable was very short and it would limit the camera from fully going in one direction.

image
As seen in the picture, the servo tries to pull the camera down, but the cable resists.

Solution: the 30cm cable - it would allow the cable to just extend instead of resisting
Also, setting the pan-tilt test up was annoying because I needed to insert a bunch of more wires on the prototype and put the pan-tilt in an awkward position because the pi was still on the prototype then I needed to remove all of the clutter, making everything worse.

LCD 1602 Display

The RGB LED was to display status, but it cannot display text, that's what this LCD 1602 Display is for.
Also, it would be better to have some sort of screen at the front to make it look better. The Display would display status, maybe sensor information, maybe the AI's thoughts.

image

Environmental Sensors

I will include a photoresistor, thermistor, and DHT11. They are for detecting light, temperature, and humidity.

Photoresistor:

image

Thermistor:

image

DHT11:

image

All of them are powered through the MB102 rail. Even though all of these seem insignificant at first, and they seem like I just added them just for the sake of adding more components, they together are actually useful. It allows GPT On Wheels to get valuable information on its environment. For example, if light increases, temperature changes, and humidity changes then the AI knows its outside or near a door. Or maybe there is a lamp and as the light increases and using the camera, it could tell there is a lamp, the thermistor could work similarly for a place like the kitchen.

Blender 3D visualization

I made a 3D visualization in Blender to better communicate how the final design will look like. It does not have all of the parts in the full design It only has the main ones, and not all of the components look like their 3d version in real life Also, the wheels and circuits I got from the free marketplace because they are too complex and require too much time for me to design myself (that's why they barely look like their counterparts). Blender has a steep learning curve so it was time-consuming and I was searching for the keyboard shortcuts. However after lots of hard work and doing work in blender, I got a basic representation:

image

I'm sure that these changes have improved how well my project actually works in the hardware side and communicated that better.

technical_. technical_. requested changes for ✨🤖 GPT On Wheels ⚙️💡 ago

This is a tier four. Please increase hardware complexity, or decrease your requested grant amount.
In addition, please do not use AI for your Read.ME

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

Tanuki Tanuki ⚡🚀 requested changes for ✨🤖 GPT On Wheels ⚙️💡 ago

  1. Even though u use cardboard, cad should be available.
  2. This seems like a tier 4 project
  3. Include the 6.77 in your BOM

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

Shaurya Bisht Shaurya Bisht requested changes for ✨🤖 GPT On Wheels ⚙️💡 ago

add images of wiring to readme

Recommended tier: 2

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

Iamalive Iamalive 🚀 requested changes for ✨🤖 GPT On Wheels ⚙️💡 ago

In your BOM it says Additional charges of 6.77. What do you mean by this?

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Finished Submitting Design Review

Finished Design

image

The design is done, I have submitted the design! However, I faced many issues before I could finish the design. Unfortunately, I found better ways to solve my issues after I finished dealing with them in not the most efficient way.

Uploading Files

I needed to get all of my code onto github, but all of my code was on the pi. My approaches:

  1. Gmail, but gmail has attachment restrictions, sometimes it says "file too big" in red text at the bottom or it says this. This was how I was getting images through before so I was disappointed. image
  2. Whatsapp, this was the option that worked best. I used the Whatsapp app on my pc, then connected to my phone by scanning the qr code. Then, I just messaged myself the code and video files. image

What I should have done

What I did

Since I needed to get code over to github in the end, I should have created a remote repository on my pi, then pull pushed and synced with github. I instead manually uploaded every file on Whatsapp then manually downloaded each then formed my own replicate directories by have the pi on RealVNC viewer on the other window pulled up. I ended up having to manually go into vs code and and files and folders. But the biggest problem was that I renamed lots of things. I renamed many folders for clarity then had to go in manually to change them. Not only was this annoying, but it decreased the possibilities of my code working. I needed to change every single path manually because I renamed them I wanted to rename MCP_agent.py to agent.py for conciseness, and I did but once I saw that I needed to go back and change everything, I just kept its original name. Pylance did handle it but I had specified folder.file but Pylance specified .file only so it did not handle all of the renaming. This technically did not affect performance since I did not do anything else but rename and add comments but it increases the chances of me going wrong and got me frustrated

Solution

image
Open my repository on my pi. Press . to open dev editor. Then clone the repository. Then get a remote repository so I can make changes directly from the Pi 5. This would have saved me lots of time and decreased the chances of me messing up. I needed to do this on my pc after I got all the files through whatsapp anyways.

Uploading Videos

I had lots of large videos to upload. All my tries:

  1. Drag and Drop - it responded with "Wowza thats a big file" so it did not work
  2. Copy and Paste Dev Editor- I thought that I could bypass it in this vs-code-like editor but it also gave an error box with a red x.
  3. Drag and Drop in the Dev Editor - This gave the same error
  4. Finally after some research I was forced to Git LFS

Git LFS

Github provides a way to put large file in a repository by using Git LFS (Git Large File Storage) to store them and then point to their location. I followed the steps to get Git LFS:

  1. Install from https://git-lfs.com
  2. Run 'git lfs install' on remote repository
  3. Track .pm4 using 'git lfs track ".mp4"'
  4. Commit the .gitattributes file which has this property using 'git add .gitattributes'

But I was not using git lfs before so I had to:

  1. migrate to it using 'git lfs migrate import --include=".mp4"'
  2. then push because of the migration 'git push --force origin main'

Now Git LFS was working, but not the way I wanted. The videos would not appear in the web editor, but they were still downloadable.

What I should have done

What I did

Now, it would allow for downloads but the videos would still not appear, technically people could watch the videos but it was not optimal (I mention more in the README for Outcome).

Solution

In my root directory's README I really needed a video playable on the repository on the web, and I lost faith in Git LFS. So, I tried compressing the video file. I used Veed https://www.veed.io/tools/video-compressor just like I used IloveIMG to compress some large images. I changed the resolution and dimensions to make the video smaller. And it worked! the video now played in the web. I should have done this for all of the video files, but I did not want to overcomplicate the files by removing Git LFS then manually deleting then going back and committing. But, in the future I will just compress videos instead of Git LFS.

I learned a more efficient and better way to commit code - remote workspace on pi - and a better way to commit videos - compressing them - so for the full project I will do this and have better commits

Repository Structure

I added lots of READMEs wherever I needed to say something. I also finally decided to dedicate a file for output, and I decided that a blender render was unnecessary. Overall, I am very pleased with how the repository structure turned out.

image

Most of the rest of the things I did in this log were just taking what I already have, making it better to review (compressing, snipping, commenting, elaborating, explaining), and writing READMEs. Id did spend a significant amount of time writing comments explaining the code though. I used a header that looked like "----------------------" to signify bigger parts, and this made it easier to communicate and get through what the code meant in the complex file with AI code MCP_agent.py. Fort eh other comments I just used the normal #, but I have fully explained all of my code clearly using lots of comments. I have used my keyboard a lot more in these past few devlogs than the ones where I was building the prototype.

Final

I had lots of fun building the prototype and going so far in GPT On Wheels. I can't wait for the components to arrive so I do finally finish my ✨🤖 GPT On Wheels ⚙️💡

Shreemahor Sivakumar Shreemahor Sivakumar submitted ✨🤖 GPT On Wheels ⚙️💡 for ship review ago

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Wiring Diagram and Research

image

Aliexpress

Everything I did here was about the future parts I am going to get, not what I have right now.
I did lots of research on parts in aliexpress. I found that I needed to always only buy the pres-soldered parts as I didn't have a soldering gun.

Voltage Problem

The upgrade from normal wheels to mechanum wheels increased the power demand. Which means the motors need more power, but at the same time not too much. Each of the sensors needed voltage and some needed more than others. The HC-SR04s need 5V, VL53L1Xs need 3V. At the same time the pi needs its power and I need to be versatile just in case I want more components later.
image

Big Battery

I considered just getting one huge 30V battery and then branching off voltage. After doing some research on voltage I realized that I needed a bunch of connectors, and since I don't have a multimeter, it is not my best choice.

All in Series

I had a look at would happen if I put everything in series. Then I did research. This has multiple issues.

  1. Only batteries of same voltage can go in series. Otherwise the bigger battery will try to charge the smaller one and the small battery will explode. This has happened to me before so I will not let it happen again.
  2. Motor Rating. I looked at the detailed specifications of all of the components. this was a part of the research. I found that the motors were rated to max of around 6 6.4 V. If I were to put too much voltage in then they would melt.
  3. 3. Safety In general doing something wrong here is costly and unsafe.

Parallel

I heavily considered this but in the end I decided that it wasn't worth it for the extra 10 dollars it demanded. Connecting the batteries of 7.4V in parallel to the l298ns in parallel would create an efficient power system. Example: if the back motors demand more power, then they will take it, if front needs more, they will take it, no battery dies out first. But in order to do this, something has to wire them in parallel.

  1. Breadboard This gave me safety issues again. I looked to see if it was safe and when it wasn't decided it wasn't worth the risk.
  2. TX60 Y Split Connector I spent so much time looking at this. It is good but the problem is that it's hard to get. It's either at dollar express and requires more items (dollar express requires a combo) or has very bd quality. The non-dollar express one had barely any buys, generic pictures, no quality guarantee from aliexpress. It also had very bad reviews and multiple people saying that the cable came wrong and it being a waste of money - AWG 14 instead of 12. American Wire Gauge - it has diameter and carrying specifications, and the wire giver had wrong specifications. Also it is 10 dollars for a small wire which seems unfair.

Because of this I just realized that the cons of parallel outnumber its pros.

Normal

Connect 7.4 to each L298N. The only disadvantage is that one of the batteries might die out first. I am just going to use this for simplicity, but maybe in the future I will use a parallel system.

Sensor Voltage

This was also another voltage dilemma with similar circumstances. I was considering putting the 3.7V to the accelerometer and I even looked up all of the specs of the accelerometer. I think that 3.7 which is 0.4 higher than the 3.3 of the MPU6050 is good - it would get safely reduced down. This was just a nuance I considered. Finally, I refined my requirement. I needed 3 3.3Vs and 2 5Vs. So I searched for something that outputed that. That's how I got to the MB-102. I was also looking for a jack version, but then I remembered that I had one power bank left so I could just use that - I would use a usb-c to usb change with the MB-102 and a copy of the Miady powerbank that the pi uses. mb's usb-c to usb-c to usb connector to usb of the powerbank.

Wheels

I am going to get mechanum wheels. I am going to put more about how they actually work like their movement mechanism in their .md file, but selecting them was still a process.
image

Size

I initially was going to get 38mm wheels but the I looked at my current normal wheels and realized that that would be way too small, so I switched to 97mm. Another reason for this is the wheels always falling off, getting hurt, and other problems mentioned in my previous devlogs.

Hubs

I measured my current hubs first and got 10mm. The wheels I wanted were 6mm hubs. But then I measured again and realized I made a mistake. I had measured the thickness of the plastic around the hub hole also accidently. That thickness happened to be 2mm so I got 2mm + 6mm + 2mm which is 10mm.

motor_hub

At the end I realized my mistake, but I spend a long time looking for shaft connectors. But at least, I know what to do if my wheels do end up being too small.

Wiring Diagram

image

snippet of my diagram

I spent loads of time on this. I have finally finished the entire wire diagram of my proposal and of the current prototype I have. I faced many problems on the way.

Color

mbwrongvright

I had the mb-102, a module for connecting power to multiple components just the way I needed. But I accidently put it backwards onto the breadboard (it is supposed to go on the breadboard) because when I got it out of the Crikit menu it was backwards. This does not seems like a big deal at first but it means that the pins and entire orientation is backwards. They way it is supposed to stick onto the breadboard is + to the red rail of the breadboard and - to the blue rail of the breadboard. But since its backward + became blue and - became red. Initially, I thought that this was no big deal and it was just the mb's fault but I did not realize how big of a mistake I made. After 30 min to 1 hour of just casually researching and wiring, I noticed that it was very confusing because the first half of the diagram was + red - blue but then the last half was just opposite. This was so unintuitive and horrible I knew I needed to go back in and change everything. This was when I noticed I put it on backwards, it's hard to know at first because some text is sideways and other normal and besides that it's hard to know what direction is supposed to be front in the first place. I changed every wire manually, I reversed the mb then needed to delete all of the wires and start over because it was wrong. This was painful. I was more careful later and better chose wire colors and labeled pink and purple as SCL and SDA properly so that something like this does not repeat.

Other

The battery brand is different than the one used in the diagram. The actual brands are the purple battery and Tokegawa, but the diagram says UltraFire. Just like this, the powerbank look is also different but they functionality is the same. I could not find any mic that looked at least somewhat similar, so I just wrote 'Mic' on a comment, but it works. Other than that, the diagram is beautiful and perfect.

LIDAR

image
image

This is the biggest component that I considered and did research on but never implemented. It is basically a big 3d scanner that scans 360, its an overpowered version of the HC-SR04 and VL combined 360. I watched videos on how it worked, by sending light in all directions. then, you can visualize where the light parts to see where here is an obstacle. It was perfect and I was so prepared but the price was the problem. They are around 100 dollars. Even the most low-end ones like the Lunar LIDAR are 60 dollars. I remembered how I shouldn't be doing this and how it talked about not buying extremely expensive parts in the guidelines. It is still worth its money but I will use LIDAR one day in the future, just not now.
image

Github

image

I committed a full file with wiring, software, and significance for every single component. This is to ensure every dollar given to me is used to its fullest extent.

I also accidently commited the wiring diagram in my last blueprint project instead of GPT On Wheels because I had the tab open. I tried looking for git commands and terminal and lots of complicated processes, but I just missed the little delete icon.

Future

Everything I mentioned here was just a fraction of the research I did. I also was on aliexpress, looking for more components, analyzing the pi 5 pinout, looking back at my pi with a flashlight to see its GPIO among other things I did. I am going to finish up the descriptions and then put in the code I currently have and might even make a 3d model. So far I think I have made awesome research progress and doing what I am supposed to be for research

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Improvements & Research

image

Improvements

Wheel Fixture

AS I previously mentioned, the front left wheel needs to be at a slight angle for the car to move. I previously did this my loosening it so I needed a better way. I first tried using tape again but it just came off. Finally, I found this plastic tightening band that seemed to work perfectly; it put the wheel at an angle and secured it. Also, the tail of the band sticked out and would hit against the tire every 100 ms but this was good because it actually increased friction, and made turning smoother.

Wire Re-do

The way I had put the wires of the HC-SR04 before was a short M to M wire followed by a long F to F wire but this just induced more places where the wiring could break. I realized that this might be the cause of my old error, noEcho, so I decided to re-do the distance sensors wiring. This took a lot of time for a simple task because it was messy and awkward as I had to maneuver around other wires, making me dislodge them. So then once I had to put those dislodged wires also back into place. Finally, I finished replacing the old setup with F to M wires because they skip the M to F connection in-between reducing the chance of loose wires. After I did this I noticed a significant improvement in the accuracy of the HC-SR04.

Picture of wire re-do and wheel fixture:
image

Power Bank switch

image
Before my Pi would always say "Low Power" so I couldn't use its voltage pins. I just thought this was the power bank's problem but it turns out that I needed to charge the power bank more. I found this out when I was forced to change out my power bank with an alternate because it ran out of power. The alternate had no issues and after the first power bank was charged for a long time it also had no issues.
What this means:

2 5V Pins and 2 3V Pins are available

This opens up a plethora of new components that I could add in the future like another distance sensor or a gyroscope. I will probably end up adding these.

Sample Output

I also did even more testing on the AI. This is a section of one of its full logs of a bigger run through my house (if I pasted the full log, it would fill too much space):

"... the view appears to be a close-up of a plain, light-colored floor.
The ground view of this household appears to be a close-up of two types of flooring, with the top portion featuring a white or light-colored carpet and the bottom portion showing a smooth, lighter brown surface, possibly hardwood or laminate flooring. The carpet has a textured pattern, while the lower surface is smooth and even, indicating a clear distinction between the two flooring materials.
The ground view of this household appears to be a living room with a brown couch and a table or counter in the background, possibly in a kitchen area. A colorful item, possibly a blanket or pillow, is visible on or near the couch. The overall atmosphere suggests a casual, everyday space with a few personal touches.
The ground view of the household appears to be a plain, smooth surface with no distinct features or objects visible. The surface seems to be made of a light-colored material, possibly concrete or asphalt, and is evenly lit with no notable shadows or textures. There are no plants, furniture, or other items present in the ground view.
The ground view of the household shows a doorway leading to a room with a window, allowing natural light to pour in. The room appears to have a bed or couch at the bottom of the frame, but it is not clearly visible due to the blurry image. The walls and ceiling are painted white, creating a bright and airy atmosphere.
The ground view of the household appears to be dimly lit, with the focal point being a window covered in white blinds that allow natural light to filter in. In front of the window, there seems to be a piece of furniture or object, but its details are obscured by darkness and shadows. The overall ambiance suggests a quiet, possibly morning or evening setting.
The ground view of the household appears to be dimly lit, with a bed on the bottom left and a silhouette of person or object on the right side. In the center, there is a window with open blinds allowing natural light to filter in, creating a contrast between light and dark areas. The overall atmosphere suggests a quiet and possibly morning or evening setting.
The ground view of the household appears to be a blurry, out-of-focus image of a floor or ground surface, possibly made of tile or stone, with a white and gray color scheme. There is a dark-colored border or edge visible on the left side of the image, which could be a baseboard or a piece of furniture. The overall appearance suggests a clean and possibly recently cleaned or wet surface.
The ground view of the household appears to show a cluttered floor with a visible receipt or paper on the ground. There's also what seems to be a piece of clothing or fabric, possibly a jacket or pants, scattered around. The overall impression is one of disorganization and messiness.
The ground view of this household appears to be a blank space with no visible furniture or objects on the
..."

Research

I have been doing design research for my design proposal, also as a break from fully building and coding.

Wiring Diagram

I spend too much time searching for a good website and not building. I used to use Fritzing but I uninstalled it due to its ridiculous memory consumption. I also spent time creating an Tinkercad account for no reason to use their wiring diagram service, but it did not have the components I needed. So, I finally settled on Cirkit, which had all the components I was looking for and was easily web-accessible.

Starting my diagram:
image

Not Saving

Since this was on the web, I had done something before then I forgot to save my work, so I needed to restart from scratch. This was very painful, but at least I remember now.

Research

I was just looking at what could help my car. I found some useful components like LIDAR, a bigger battery, and more. I still consider these but they are not my top proirity.

Aliexpress

I have been hunting for parts on Aliexpress, checking for measurements, compatibility, quality, and of course price. It's a new experience as I normally use amazon. I have 5 or 6 parts so far, but more are coming.
image

Descriptions

I have started listing thorough descriptions of what each of my components are and why they are necessary. I know this is necessary so others can understand my project, and I am commiting all of this on Github.
image

Future

Hardware: Mainly considering another distance sensor and gyroscope because I already have them.
Software: I will also work on finishing my wiring diagrams and descriptions for components. I will also try doing some more component research on the internet and aliexpress.

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Fully Running

IMG_20251108_172522364

Turning

The car could go back and forth but would not turn. This is because it was quite heavy and rectangular. Those two attributes mainly prevent the car from turning. I tried around 20 different approaches.

Long arc

It would go back very far, then slightly turn, then go forward and repeat this. This technically worked but it took around a minute and so much space it was not even worth it.

Back Forward

The front wheels would stay still and the back wheels would go full power, the intent of this was to sort of force the back of the car, and in turn, the entire car to turn, but since the weight was in the back of the car, this did not work, and the car almost moved as normal.

Opposite

Back would go backward, and front would go forward. This ended up producing a loud squeaky noise as the motors went against each other.

Front Forward

Back wheels would stay still, and front would go full power. This was the technique that showed the most promise since it was quick. Initially it got around 5 degrees, but it was something.

Other

  • Other Speeds
  • Pivot maneuver
  • Hybrid of other methods

Physics

Front Forward

Front forward was the method that worked best, but it still needed lots of improvement, I was sure that with some modifications it would work.

Physics Experiment

In order to understand how long to do front forward and how to improve it I needed to know its specifications. I conducted an experiment on it to see what it does. Materials I used were a ruler, protractor and tape. I put a piece of tape on the right front wheel to use as a reference point. Then I run front forward for 5 seconds. I then, using the protractor, measured the angle it had traveled. I also measured the distance the top of the car was from the tape to see how far it went forward, and I measured how far the right wheel was from the tape. I did this multiple times and recorded the results.

image

Results: it would got 5-10 degrees, it would move forward 12cm, and the right wheel was around 14.3cm away from it original spot.

Using these results I adjust the code to run longer, but this took way too long. I also had a look at the distance it would travel and tweaked it. This really helped me fix the issue but I also made some other adjustments.

  1. Weight on the back
  2. Left wheel loosened
  3. Right wheel lubricated

Weight on the back

image
If there is more weight on the back it will turn better. This is because the lighter front will move with the force, but the heavier back will not move, but since they are connected, in the front's attempt to move it will pivot around the back.
Masses tried:
- marker
- eraser
- stapler

I also tried with no masses. Adding to much mass was NOT good because nothing would happen then. I realized the the best setup was to lighten the front by removing one marker off it and putting a marker at the back.

Left wheel loosened

Usually a tire pushes down on the floor, and with the help of physics moves forward. Hower if I tilt that tire, then it will apply a force slightly to the left/right and that will help the tire pivot.

Right wheel lubricated

What tries to oppose this tilted tire is the other front tire because it still has a force that propels forward, at no angle. If this were to be also tilted, the entire front would lost structural balance and fall to the ground. Problem: need to negate the force causing forward motion without tilting the tire. Solution: Remove friction. All tires are made out of rough material and have grooves to catch friction. If you cover the grooves and make the material smooth, friction would significantly reduce. This is why I covered the right tire with scotch tape. I tried using scotch tape throughout this project, but this is the only time it actually helped.

Turning

By taking advantage of physics I was able to make the large rectangular car with only four wheels turn.

AI ON WHEELS!

The car could fully go and explore my house on its own with the AI.

Pseudocode

if (distance to object is far):
AI()
go()
elif (distance to object is greater than turning distance):
AI()
turn()
else:
## it's already too late
backward()

The code follows this basic structure, combining everything discussed in my previous logs where I do detailed into the code.

Problems
  • Sometimes the object would not be detected because the motors got the power and the distance sensor said "no echo"
  • On each crash, the front wheels would take the damage, right front wheels was okay, but left front wheel was already tilted so it ended up falling the most.
  • Ground would just disconnect because the car was going fast
  • It would turn slightly more or less, especially after the front wheels were injured. All of these were just random errors.

Modes

There is discovery mode where the car and AI freely roam, logging what happens. I also had a mode where the car was controlled by the AI and the AI would determine what to do based on the camera.

image
wanted to see what the ai would think of the plushy

image
balloon

Future

image
image

I also spent a bunch of hours on the test runs and tested with even more objects like a glue bottle.
Also, the little plastic face was not something I 3d printed myself, but something that I salvaged from a previous project using that sensor.
For now, the basics are pretty much done. Next, I will do more research and planning and less hands-on work as a break.

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Distance Sensor

WhatsApp Image 2025-11-05 at 21.58.01_6dbba28d
HC-SR04 Wiring

Recap

I previously got the camera and ai working.

Problems along the way

Car Structure

The car's wheels sometimes lean to one side or the other, so I needed some way for the car's structure to be more safe. So, I put an expo market to sort of hold the cardboard pieces against each other and prevent them from bending inwards. I also used a glue stick in a similar way for underneath. I also added a second expo marker, but then once I found it ineffective, I just removed it.
WhatsApp Image 2025-11-05 at 21.18.16_e0731f09
Before, I tried using the scotch tape and cardboard again, but it did go according to plan.

Fragile

Midway, sometimes the ground would just disconnect. Midway, the wheels would just come flying off.
There is really nothing I can do about this except upgrade to plastic case, but I don't have a 3d printer.

Camera

The camera, before, would not open. This was because I forgot to close the camera after opening it. I just forgot about his point on the last log.

Distance Sensor

The distance sensor is necessary to make sure that the car does not crash. I am using the HC-SR04.

Hardware

Wiring Diagram

image
Although, voltage will be supplied by the 18650 batteries.

Math & Resistors

There are two resistors: a 470 ohms and a 330 ohms.
They are used to form a voltage divider because the echo has 5V but the pi's pins are 3V3.
By connected 470 to ground, 330 to echo, and free ends to another pin, a voltage divider is formed to achieve this. The ideal ratio is 2:3 so any resistor combo that gets this is okay.

Other resistors

I did not have a 470 resistor so I put a 330 ohm and 220 ohm in series to form a 470. However, I just replaced it with a 510 ohm later when trying to solve an error where the distance sensor picked up the same thing always

Mounting

I realized that if I wanted to remain organized I needed a breadboard there, so I put everything on the breadboard and then put that on the car. The space was congested and it was hard to put wires in.

Code

# in main
ECHOPIN = 6
TRIGGER
PIN = 13
sensor = DistanceSensor(echo=ECHOPIN, trigger=TRIGGERPIN, max_distance=4)

# in file
from gpiozero import DistanceSensor
from time import sleep
from main import sensor

while True:
print('Distance to nearest object is', round(sensor.distance * 100, 2), 'cm')
sleep(2)

This initializes the distance sensor and prints how far away the object in front is in cm. The round converts it to cm and then rounds it to two decimal points. There is a 2 second delay between each reading.

Same Value Error

No matter how far away the wall was, the sensor would always 1.25cm. There was also another variation of this same error sometimes where it would only print 100cm.
Screenshot 2025-10-31 183854
I spend a long time trying to fix this by restarting power, trying different GPIO pins and more. It turns out that I just needed to connect the entire system to my raspberry pi's ground. A seemingly complex problem actually had a very simple solution.

No Echo Error

There was an error that said that no echo was received. This error just comes on and off around 20% of the time. I suspect this is because the HC-SR04 requires 5V and it sometimes does not get enough power because of the motors. I suspect this because this happens usually after a long motor run. The best solution I found to this was to just wait 30s and make sure the connections were secure, but if I had a better power source this might entirely disappear.

Final Output

Final Wiring:
WhatsApp Image 2025-11-05 at 21.58.01_9a4c9b45

Wires

I initially used M to M, but then once I mounted the breadboard I used M to M connected with one F to F then another M to M. I realized this was redundant and was just better using a longer M to M and had to spend more time replacing all the wires.

Output

Screenshot 2025-10-31 183748

Future

Connect ai, distance sensor, and camera. Bring everything together.

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Code & Camera

IMG_20251026_215910434

Recap

Before what I had was a basic car, and this code was very simple and straightforward. Now I need to start using the camera and actually integrate the ai into it.

Camera Mounting

Before, the camera was backward. This was one of the most annoying parts that was very unnecessary and made me almost want to quit the project in anger. This camera would not stay in one place.

Tries

I needed the camera to not be backwards, so I tried many methods like:
- cotton
- cardboard stand
- scotch tape
- -string
But all of these failed and I just ended up wasting lots of time

Case

I don't have a 3d printer at home, unfortunately, so I need to use my school club's common 3d printer. Since there are 20 people using the same printer and the printer was blacklisted from the school wifi, it was very hard to get this printed, but I managed because my friend was kind enough to give his phone hotspot. But anyways, the problem with the case was that it was too tight for the camera, and even though it could work it could not fully fit in. If I had spent more time on this, I might have been able to force it to stay. Also, the screw holes were too small, but considering that it was my first cad, it was expected. After trying more combinations of the previous tries and the case, I decided it was best to just see if the ai could recognize what it was doing with a backward blurry image. 2.5 or 3 hours had passed from this alone, so I could not handle it anymore.

Picture

IMG_20251102_113132734

Code

The code for this project is so extensive and explorable that it could be considering a software project too. I am going to put the full file in the repository but explain some components here. By the way, other than debugging a couple lines with syntax / simple name errors, I wrote all of the 153 lines of code by myself, without any AI .This was the part of this log that took the most time, but unlike the camera, I regret nothing because I truly got lots of work done. Also, everything is in Python.

Used libraries:
+ Langchain & related (ai framework, but due its enormous size, has dozens of individual libraries)
+ mcp (core logic)
+ Picamera2 (to control the camera)
+ gpiozero (way to control hardware in pi 5)
+ base64 (for image)
+ dotenv (to load my .env, but you don't really need it)
+ asnycio (ai takes time)

Model

This is the novel part of this project and what sets my car apart from every other car.

LLM

The core of the code, without it there is nothing to actually control the car. This is the brain 🧠
of the project.

openrouterapikey = os.getenv("OPENAIAPIKEY")

llm = ChatOpenAI(model="meta-llama/llama-4-maverick:free",

               api_key=openrouter_api_key,

               base_url="https://openrouter.ai/api/v1"

)

Langchain, an open framework for creating ai agents, is used in python for this example, and openrouter is used for this particular llm but I went between many and different providers.

Image processing

with open(r"/home/shreemahor5/Python/Robot/Robot/image.png", 'rb') as image_file:

image_bytes = image_file.read()

base64_bytes = base64.b64encode(image_bytes).decode("utf-8")

prompt = [

{"type": "text", "text": "Describe the image"},

{"type": "imageurl", "imageurl": {"url": f"data:image/jpeg;base64,{base64_bytes}"}},

]

A series of transformations occur to the image file to make it suitable, then it is put in a suitable format for the llm, a list of dictionaries.

Function & Connection

This is the most relevant snippet of the main ai call function:

async def agent(description):

async with stdio_client(server_params) as (read, write):

    async with ClientSession(read, write) as session:

        await session.initialize()

        tools = await load_mcp_tools(session)

        agent = create_react_agent(llm, tools)

These must be async functions because the ai does not take a fixed amount of time to process anything - leaving the function to wait for its response, so asnyc functions are necessary. All the rest of the code does is just connect what I already have to my MCP using Langchain, and I will get to this.

MCP

Now that the brain is done we need something for it to use, so we need tools 🛠️. In order to do this, I use something called MCP, model context protocol, which is used to connect llms with tools, giving them the ability to reason and choose what to do, effectively making them agents. Without this nothing would be possible, its revolutionary.

Sample tool

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("Movement")

@mcp.tool()

def forward():

print("\nForward\n")

motor_a.forward(0.5)

sleep(2)

motor_a.stop()

There are more tools, but this is just one. In order to make a function an MCP tool, you must use the @mcp.tool() decorator on the function. It pairs very well with langchain.

Motors

motor_a = Motor(forward=IN1, backward=IN2, enable=ENA, pwm=True)

motor_b = Motor(forward=IN3, backward=IN4, enable=ENB, pwm=True)

Motor a is the front wheel pair and motor b is the back wheel pair. This is how you control the motors, as defined in gpiozero docs.

Main file

Camera

cam.start()
sleep(2)
cam.capture_file("image.jpg")

This is just a small snippet, but it uses picamera2.

Putting it all together

while True:
if input("Do you want to run the test? (y/n): ").lower() != 'y':
break
answer = llm.invoke([HumanMessage(content=prompt)]).content
print(answer)
asyncio.run(agent(answer))

All this does is put together all the pieces of the code. The way it works is by having two llms, one interpreting the image, and one interpreting its interpretation, but I will go more in depth next log since this one is already too long.

Result

I wrote some instructions on a paper, then made the ai interpet what to do, these are some.
IMG_20251102_125657262

Most of the time, it actually went forward or said that there was nothing to be done if there were no instructions, but it was a little confused as to when to go backward.

IMG_20251026_215910434

Errors

Of course, my code did not work first try.

MCP not connecting

I already expected this because I got the same error while I was experimenting with MCP a long time ago, I restarted the server, saved, stopped among other things because some combination worked last time. But, this time that was not enough, but it turned out that I had misspelt the name of the file. But it was good, I did the other checks on the server anyways.

AI Hallucinations

Sometimes the ai would claim to be using an old mcp server, or just not see the tools. Sometimes, it just broke and took a long time. These are just some of its failures, but one that stood out and was the funniest error I have gotten so far in the project was this:
mcp error

Additional Notes

The idea is uniquely mine, and I did NOT use any youtube video for code or software guidance. I used a thorough book and the online docs for some libraries, particularly, gpiozero docs was most helpful.

Car

Moves fine, but the front wheels bend inward, which is not nice. Also, more than once, mid-movement, the wheels have just come rolling of, so the car could still be improved. I am not working on cad but keeping it at the back of my mind.

Future

I will explain more of the architecture and logical flow, since here I gave code snippets. Also, I will put the full code files in my repository. I am looking into putting a distance sensor to make sure the ai does not crash, the HC-SR04, which I already have.
image

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Working Car Prototype

IMG_20251019_195711770 (1).jpg

Jump from planning

I needed all the planning, sample CAD, and research to get this far.
I also ended up using extra parts I did not plan for like tape and plastic bands.

Components

L298N Motor Driver

This was used to connect the motors to the pi. It has 4 outputs (it can control two motor pairs) and also has speed control

Powering Issue

For testing I used the pi's 5V but that would not suffice in when the pi is independent of the cable, so I needed to use an external power source. I already knew this so had a 18650 battery.

But the biggest problem was that 5V was not enough for 4 motors so I added two batteries but all 4 did not get enough power still. I spent a lot of time trying to fix a simple problem and even tried to get it to run on only 2 motors because getting all 4 was very hard. I tried:
- Using a breadboard
- using thinner wires
- Swapping the motors
- and more
Finally I realized that I had connected the wire of the batteries to the '5V' but that limits their voltage to only 5V so I needed to change it to 12V even though the batteries did not reach that much.
IMG_20251013_213022055.jpg

Pi

I used GPIO 19 and 18 for PWM control and adjusting motor speed. I used other GPIOs for forward and backward control

Power Bank

5V 10A Miadi Power Bank for powering the Pi. I got a warning saying that the pi did not get enough power so I needed to hit the power button anytime I wanted it to draw full power. I also went into config.txt in firmware and updated it with this exact line:
usbmaxcurrent_enable=1

18650 Batteries

From Tokeygawa and have a case which had a on off switch which was useful when I forgot to connect PWM and had no jumper, resulting in the motors spinning forever. But, luckily I was able to just switch the batteries off before any serious damage.

Motors & Tires

The tires had friction well and for the most part (except one that was slightly off) fit onto the motors and spun properly.

Connection Issue

The other issue that drained lots of time was that the wheels would not connect to my cardboard base.
I experimented with the following:

  1. Normal Scotch Tape - this was very fragile and did not last at all
  2. Screws
    • I used M2 Screws and Connectors but then this combo was too long and the cardboard and motor slots did not have the required length, so I tried glueing on cardboard and even inserting cardboard to to finish the fit
    • This worked but it was not as tight as I wanted it to be and was still a little wobbly so I searched for more solutions
  3. Double Sided Tape
    • This worked surprisingly well although after some trial and error I found that the metal part of the motor was most adhesive to the tape
  4. Wires
    • putting a wire band through the two motor hole slots and tying it to the base
    • heavier but stronger
    • ran out of wire bands so I needed to use old male to male wires
  5. Glue - worked very poorly

I finally decide on -
Double Sided Tape + Wires this combo worked best

Body

I had two other initial bodies. One broke and the other was deteriorated from all of my connection method attempts. This is the initial old one:
IMG_20251011_164423560.jpg

This is the final body, it has black tape so that the same error that the old body had does not also exist here. The black tape adds reinforcement. Finally I also later added a expo marker because I needed some blunt object to keep the cardboard sides from toppling.
IMG_20251018_164123293.jpg

Final

I wired the components on the body.
IMG_20251018_115444022.jpg

Future

I must connect the ai model I have to this and plan for speakers and audio. I will also work more on the CAD.

Picture midmotion:
image.png

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Got AI Model on Pi

image.png
Gemma3:4b analyzed a picture taken by Arducam

First, research update

Microphone

I looked at a good microphone that's omnidirectional.

Speaker

I still did not find a good speaker (most of the speakers are very expensive and heavy).

Cables

I already have cables or wires, male to male, male to female, and female to female.

CAD

Slowly making progress but not investing all my time into it.

AI Model

Plan

Initial Plan: to install a small model on the raspberry pi. This would be technically possible but I only had 3GBs left on the pi and so if I did I could barely use my pi anymore.

  • Some Possible Solutions Explored* (I spent more time looking at more):
    1. just use a different free api key
      • did not do this because api keys have their limits and for privacy
    2. find the smallest model
      • if the model becomes too small like 990MB then there is no point in really using it due to its poor accuracy
      • pi could still slow down
    3. Use network to put model on the computer to the pi
      • this is what I chose

Network

Goal

Connect the model running on Ollama an app to control local ai models on my computer (gemma3:4b) to my pi through their shared network

First Problem: Server Listening

By default, ollama only listens to localhost (my own computer), in order to change this I needed to run a bunch of terminal commands some of them were:
+ set OLLAMA_HOST to 0.0.0.0
+ ollama serve
I also did other things in Task Manager like stopping the initial server

Second Problem: Firewall

My windows would block my pi from access through port 11434. I needed to set a new firewall rule using my pi's address so the pi can access it but my computer is still safe

Models

I checked some other models like gemma3:1b and smollm but these smaller models could not process images so after LOTS of research I finalized on gemma3:4b

Final result

Camera activation:
image.png

I used rpicam (they changed libcamera to rpicam) to take a photo of a plush with my arducam. Then, I gave this to this model and asked it to "Describe this image and its theme in detail". It recognized the plush.

Future

I might use I bigger model, and I have not linked the ai to motors.

One of many commands I ran to ensure it works:
the error is good as it confirms it is working
image.png

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

CAD and Spreadsheet

image.png

In FreeCAD

Model

Just started a new model (pictured above). Its very simple now because it is in its initial phase.

Spreadsheet

image.png

I made a spreadsheet to organize my values so I would not have to end up redoing everything and figure out I had the wrong measurements, like my last project. To ensure that does not happen, I will continuously update it and refer to it.

Linking Error

For a long time I additionally tried to actively link my spreadsheet to the CAD Model, but FreeCAD wasn't allowing it. This process required links & alaisses and very complicated. I spent lots of time trying to get this done, but then I decided just manually referring to it was enough for now. This is were most of my time was drained.

Research

Standoffs

I also did some research. I finalized the mounting process. I would use standoffs and screws and found a nice set on Amazon.

Speakers

I am going to look more into speakers. The model I liked was out of stock.

Shreemahor Sivakumar Shreemahor Sivakumar added to the journal ago

Pi Issue and Researching Materials

image.png
rpicam.jpg

Research

Motors

I didn't know much about motors before and had minimal experience working with them (I only worked on one motor and one pump). I looked at what types of motors there are and browsed for some time. I also explored types of motors to determine which would be best for the car. I looked and watched some videos on mechanum wheels and considered servos. While it was interesting to learn this theory I just decided on 4 motors. Looking back, even though I did spend lots of time on finding parts and the driver I could have saved 2-3 hours if I just immediately picked that, even though other parts were interesting to learn about.

Final configuration: 4 motors and l298n

General layout

I decided that the model would work like a layered cake. I am considering which screws and other peripherals are necessary to make this happen though. It also took me a long time to arrive at this layered setup. I looked at flat boxes, towers, and even hexapods, but the layers were easiest and most efficient

Raspberry Pi Issue

I spent a VERY LONG TIME trying to connect my ribbon cable to my pi. This is the cable between a camera and the pi, but it was very hard to connect. I previously accidently bended and damaged it so that didn't help, and the python packages weren't installed properly. I finally solved this by using a flashlight and little screwdriver for adjustment and finally situating the cable. I had to do the camera installation process 3 times.

Shreemahor Sivakumar Shreemahor Sivakumar started ✨🤖 GPT On Wheels ⚙️💡 ago

10/8/2025 - Pi Issue and Researching Materials

image.png
rpicam.jpg

Research

Motors

I didn't know much about motors before and had minimal experience working with them (I only worked on one motor and one pump). I looked at what types of motors there are and browsed for some time. I also explored types of motors to determine which would be best for the car. I looked and watched some videos on mechanum wheels and considered servos. While it was interesting to learn this theory I just decided on 4 motors. Looking back, even though I did spend lots of time on finding parts and the driver I could have saved 2-3 hours if I just immediately picked that, even though other parts were interesting to learn about.

Final configuration: 4 motors and l298n

General layout

I decided that the model would work like a layered cake. I am considering which screws and other peripherals are necessary to make this happen though. It also took me a long time to arrive at this layered setup. I looked at flat boxes, towers, and even hexapods, but the layers were easiest and most efficient

Raspberry Pi Issue

I spent a VERY LONG TIME trying to connect my ribbon cable to my pi. This is the cable between a camera and the pi, but it was very hard to connect. I previously accidently bended and damaged it so that didn't help, and the python packages weren't installed properly. I finally solved this by using a flashlight and little screwdriver for adjustment and finally situating the cable. I had to do the camera installation process 3 times.

10/9/2025 - CAD and Spreadsheet

image.png

In FreeCAD

Model

Just started a new model (pictured above). Its very simple now because it is in its initial phase.

Spreadsheet

image.png

I made a spreadsheet to organize my values so I would not have to end up redoing everything and figure out I had the wrong measurements, like my last project. To ensure that does not happen, I will continuously update it and refer to it.

Linking Error

For a long time I additionally tried to actively link my spreadsheet to the CAD Model, but FreeCAD wasn't allowing it. This process required links & alaisses and very complicated. I spent lots of time trying to get this done, but then I decided just manually referring to it was enough for now. This is were most of my time was drained.

Research

Standoffs

I also did some research. I finalized the mounting process. I would use standoffs and screws and found a nice set on Amazon.

Speakers

I am going to look more into speakers. The model I liked was out of stock.

10/10/2025 - Got AI Model on Pi

image.png
Gemma3:4b analyzed a picture taken by Arducam

First, research update

Microphone

I looked at a good microphone that's omnidirectional.

Speaker

I still did not find a good speaker (most of the speakers are very expensive and heavy).

Cables

I already have cables or wires, male to male, male to female, and female to female.

CAD

Slowly making progress but not investing all my time into it.

AI Model

Plan

Initial Plan: to install a small model on the raspberry pi. This would be technically possible but I only had 3GBs left on the pi and so if I did I could barely use my pi anymore.

  • Some Possible Solutions Explored* (I spent more time looking at more):
    1. just use a different free api key
      • did not do this because api keys have their limits and for privacy
    2. find the smallest model
      • if the model becomes too small like 990MB then there is no point in really using it due to its poor accuracy
      • pi could still slow down
    3. Use network to put model on the computer to the pi
      • this is what I chose

Network

Goal

Connect the model running on Ollama an app to control local ai models on my computer (gemma3:4b) to my pi through their shared network

First Problem: Server Listening

By default, ollama only listens to localhost (my own computer), in order to change this I needed to run a bunch of terminal commands some of them were:
+ set OLLAMA_HOST to 0.0.0.0
+ ollama serve
I also did other things in Task Manager like stopping the initial server

Second Problem: Firewall

My windows would block my pi from access through port 11434. I needed to set a new firewall rule using my pi's address so the pi can access it but my computer is still safe

Models

I checked some other models like gemma3:1b and smollm but these smaller models could not process images so after LOTS of research I finalized on gemma3:4b

Final result

Camera activation:
image.png

I used rpicam (they changed libcamera to rpicam) to take a photo of a plush with my arducam. Then, I gave this to this model and asked it to "Describe this image and its theme in detail". It recognized the plush.

Future

I might use I bigger model, and I have not linked the ai to motors.

One of many commands I ran to ensure it works:
the error is good as it confirms it is working
image.png

10/19/2025 - Working Car Prototype

IMG_20251019_195711770 (1).jpg

Jump from planning

I needed all the planning, sample CAD, and research to get this far.
I also ended up using extra parts I did not plan for like tape and plastic bands.

Components

L298N Motor Driver

This was used to connect the motors to the pi. It has 4 outputs (it can control two motor pairs) and also has speed control

Powering Issue

For testing I used the pi's 5V but that would not suffice in when the pi is independent of the cable, so I needed to use an external power source. I already knew this so had a 18650 battery.

But the biggest problem was that 5V was not enough for 4 motors so I added two batteries but all 4 did not get enough power still. I spent a lot of time trying to fix a simple problem and even tried to get it to run on only 2 motors because getting all 4 was very hard. I tried:
- Using a breadboard
- using thinner wires
- Swapping the motors
- and more
Finally I realized that I had connected the wire of the batteries to the '5V' but that limits their voltage to only 5V so I needed to change it to 12V even though the batteries did not reach that much.
IMG_20251013_213022055.jpg

Pi

I used GPIO 19 and 18 for PWM control and adjusting motor speed. I used other GPIOs for forward and backward control

Power Bank

5V 10A Miadi Power Bank for powering the Pi. I got a warning saying that the pi did not get enough power so I needed to hit the power button anytime I wanted it to draw full power. I also went into config.txt in firmware and updated it with this exact line:
usbmaxcurrent_enable=1

18650 Batteries

From Tokeygawa and have a case which had a on off switch which was useful when I forgot to connect PWM and had no jumper, resulting in the motors spinning forever. But, luckily I was able to just switch the batteries off before any serious damage.

Motors & Tires

The tires had friction well and for the most part (except one that was slightly off) fit onto the motors and spun properly.

Connection Issue

The other issue that drained lots of time was that the wheels would not connect to my cardboard base.
I experimented with the following:

  1. Normal Scotch Tape - this was very fragile and did not last at all
  2. Screws
    • I used M2 Screws and Connectors but then this combo was too long and the cardboard and motor slots did not have the required length, so I tried glueing on cardboard and even inserting cardboard to to finish the fit
    • This worked but it was not as tight as I wanted it to be and was still a little wobbly so I searched for more solutions
  3. Double Sided Tape
    • This worked surprisingly well although after some trial and error I found that the metal part of the motor was most adhesive to the tape
  4. Wires
    • putting a wire band through the two motor hole slots and tying it to the base
    • heavier but stronger
    • ran out of wire bands so I needed to use old male to male wires
  5. Glue - worked very poorly

I finally decide on -
Double Sided Tape + Wires this combo worked best

Body

I had two other initial bodies. One broke and the other was deteriorated from all of my connection method attempts. This is the initial old one:
IMG_20251011_164423560.jpg

This is the final body, it has black tape so that the same error that the old body had does not also exist here. The black tape adds reinforcement. Finally I also later added a expo marker because I needed some blunt object to keep the cardboard sides from toppling.
IMG_20251018_164123293.jpg

Final

I wired the components on the body.
IMG_20251018_115444022.jpg

Future

I must connect the ai model I have to this and plan for speakers and audio. I will also work more on the CAD.

Picture midmotion:
image.png

11/2/2025 - Code & Camera

IMG_20251026_215910434

Recap

Before what I had was a basic car, and this code was very simple and straightforward. Now I need to start using the camera and actually integrate the ai into it.

Camera Mounting

Before, the camera was backward. This was one of the most annoying parts that was very unnecessary and made me almost want to quit the project in anger. This camera would not stay in one place.

Tries

I needed the camera to not be backwards, so I tried many methods like:
- cotton
- cardboard stand
- scotch tape
- -string
But all of these failed and I just ended up wasting lots of time

Case

I don't have a 3d printer at home, unfortunately, so I need to use my school club's common 3d printer. Since there are 20 people using the same printer and the printer was blacklisted from the school wifi, it was very hard to get this printed, but I managed because my friend was kind enough to give his phone hotspot. But anyways, the problem with the case was that it was too tight for the camera, and even though it could work it could not fully fit in. If I had spent more time on this, I might have been able to force it to stay. Also, the screw holes were too small, but considering that it was my first cad, it was expected. After trying more combinations of the previous tries and the case, I decided it was best to just see if the ai could recognize what it was doing with a backward blurry image. 2.5 or 3 hours had passed from this alone, so I could not handle it anymore.

Picture

IMG_20251102_113132734

Code

The code for this project is so extensive and explorable that it could be considering a software project too. I am going to put the full file in the repository but explain some components here. By the way, other than debugging a couple lines with syntax / simple name errors, I wrote all of the 153 lines of code by myself, without any AI .This was the part of this log that took the most time, but unlike the camera, I regret nothing because I truly got lots of work done. Also, everything is in Python.

Used libraries:
+ Langchain & related (ai framework, but due its enormous size, has dozens of individual libraries)
+ mcp (core logic)
+ Picamera2 (to control the camera)
+ gpiozero (way to control hardware in pi 5)
+ base64 (for image)
+ dotenv (to load my .env, but you don't really need it)
+ asnycio (ai takes time)

Model

This is the novel part of this project and what sets my car apart from every other car.

LLM

The core of the code, without it there is nothing to actually control the car. This is the brain 🧠
of the project.

openrouterapikey = os.getenv("OPENAIAPIKEY")

llm = ChatOpenAI(model="meta-llama/llama-4-maverick:free",

               api_key=openrouter_api_key,

               base_url="https://openrouter.ai/api/v1"

)

Langchain, an open framework for creating ai agents, is used in python for this example, and openrouter is used for this particular llm but I went between many and different providers.

Image processing

with open(r"/home/shreemahor5/Python/Robot/Robot/image.png", 'rb') as image_file:

image_bytes = image_file.read()

base64_bytes = base64.b64encode(image_bytes).decode("utf-8")

prompt = [

{"type": "text", "text": "Describe the image"},

{"type": "imageurl", "imageurl": {"url": f"data:image/jpeg;base64,{base64_bytes}"}},

]

A series of transformations occur to the image file to make it suitable, then it is put in a suitable format for the llm, a list of dictionaries.

Function & Connection

This is the most relevant snippet of the main ai call function:

async def agent(description):

async with stdio_client(server_params) as (read, write):

    async with ClientSession(read, write) as session:

        await session.initialize()

        tools = await load_mcp_tools(session)

        agent = create_react_agent(llm, tools)

These must be async functions because the ai does not take a fixed amount of time to process anything - leaving the function to wait for its response, so asnyc functions are necessary. All the rest of the code does is just connect what I already have to my MCP using Langchain, and I will get to this.

MCP

Now that the brain is done we need something for it to use, so we need tools 🛠️. In order to do this, I use something called MCP, model context protocol, which is used to connect llms with tools, giving them the ability to reason and choose what to do, effectively making them agents. Without this nothing would be possible, its revolutionary.

Sample tool

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("Movement")

@mcp.tool()

def forward():

print("\nForward\n")

motor_a.forward(0.5)

sleep(2)

motor_a.stop()

There are more tools, but this is just one. In order to make a function an MCP tool, you must use the @mcp.tool() decorator on the function. It pairs very well with langchain.

Motors

motor_a = Motor(forward=IN1, backward=IN2, enable=ENA, pwm=True)

motor_b = Motor(forward=IN3, backward=IN4, enable=ENB, pwm=True)

Motor a is the front wheel pair and motor b is the back wheel pair. This is how you control the motors, as defined in gpiozero docs.

Main file

Camera

cam.start()
sleep(2)
cam.capture_file("image.jpg")

This is just a small snippet, but it uses picamera2.

Putting it all together

while True:
if input("Do you want to run the test? (y/n): ").lower() != 'y':
break
answer = llm.invoke([HumanMessage(content=prompt)]).content
print(answer)
asyncio.run(agent(answer))

All this does is put together all the pieces of the code. The way it works is by having two llms, one interpreting the image, and one interpreting its interpretation, but I will go more in depth next log since this one is already too long.

Result

I wrote some instructions on a paper, then made the ai interpet what to do, these are some.
IMG_20251102_125657262

Most of the time, it actually went forward or said that there was nothing to be done if there were no instructions, but it was a little confused as to when to go backward.

IMG_20251026_215910434

Errors

Of course, my code did not work first try.

MCP not connecting

I already expected this because I got the same error while I was experimenting with MCP a long time ago, I restarted the server, saved, stopped among other things because some combination worked last time. But, this time that was not enough, but it turned out that I had misspelt the name of the file. But it was good, I did the other checks on the server anyways.

AI Hallucinations

Sometimes the ai would claim to be using an old mcp server, or just not see the tools. Sometimes, it just broke and took a long time. These are just some of its failures, but one that stood out and was the funniest error I have gotten so far in the project was this:
mcp error

Additional Notes

The idea is uniquely mine, and I did NOT use any youtube video for code or software guidance. I used a thorough book and the online docs for some libraries, particularly, gpiozero docs was most helpful.

Car

Moves fine, but the front wheels bend inward, which is not nice. Also, more than once, mid-movement, the wheels have just come rolling of, so the car could still be improved. I am not working on cad but keeping it at the back of my mind.

Future

I will explain more of the architecture and logical flow, since here I gave code snippets. Also, I will put the full code files in my repository. I am looking into putting a distance sensor to make sure the ai does not crash, the HC-SR04, which I already have.
image

11/5/2025 - Distance Sensor

WhatsApp Image 2025-11-05 at 21.58.01_6dbba28d
HC-SR04 Wiring

Recap

I previously got the camera and ai working.

Problems along the way

Car Structure

The car's wheels sometimes lean to one side or the other, so I needed some way for the car's structure to be more safe. So, I put an expo market to sort of hold the cardboard pieces against each other and prevent them from bending inwards. I also used a glue stick in a similar way for underneath. I also added a second expo marker, but then once I found it ineffective, I just removed it.
WhatsApp Image 2025-11-05 at 21.18.16_e0731f09
Before, I tried using the scotch tape and cardboard again, but it did go according to plan.

Fragile

Midway, sometimes the ground would just disconnect. Midway, the wheels would just come flying off.
There is really nothing I can do about this except upgrade to plastic case, but I don't have a 3d printer.

Camera

The camera, before, would not open. This was because I forgot to close the camera after opening it. I just forgot about his point on the last log.

Distance Sensor

The distance sensor is necessary to make sure that the car does not crash. I am using the HC-SR04.

Hardware

Wiring Diagram

image
Although, voltage will be supplied by the 18650 batteries.

Math & Resistors

There are two resistors: a 470 ohms and a 330 ohms.
They are used to form a voltage divider because the echo has 5V but the pi's pins are 3V3.
By connected 470 to ground, 330 to echo, and free ends to another pin, a voltage divider is formed to achieve this. The ideal ratio is 2:3 so any resistor combo that gets this is okay.

Other resistors

I did not have a 470 resistor so I put a 330 ohm and 220 ohm in series to form a 470. However, I just replaced it with a 510 ohm later when trying to solve an error where the distance sensor picked up the same thing always

Mounting

I realized that if I wanted to remain organized I needed a breadboard there, so I put everything on the breadboard and then put that on the car. The space was congested and it was hard to put wires in.

Code

# in main
ECHOPIN = 6
TRIGGER
PIN = 13
sensor = DistanceSensor(echo=ECHOPIN, trigger=TRIGGERPIN, max_distance=4)

# in file
from gpiozero import DistanceSensor
from time import sleep
from main import sensor

while True:
print('Distance to nearest object is', round(sensor.distance * 100, 2), 'cm')
sleep(2)

This initializes the distance sensor and prints how far away the object in front is in cm. The round converts it to cm and then rounds it to two decimal points. There is a 2 second delay between each reading.

Same Value Error

No matter how far away the wall was, the sensor would always 1.25cm. There was also another variation of this same error sometimes where it would only print 100cm.
Screenshot 2025-10-31 183854
I spend a long time trying to fix this by restarting power, trying different GPIO pins and more. It turns out that I just needed to connect the entire system to my raspberry pi's ground. A seemingly complex problem actually had a very simple solution.

No Echo Error

There was an error that said that no echo was received. This error just comes on and off around 20% of the time. I suspect this is because the HC-SR04 requires 5V and it sometimes does not get enough power because of the motors. I suspect this because this happens usually after a long motor run. The best solution I found to this was to just wait 30s and make sure the connections were secure, but if I had a better power source this might entirely disappear.

Final Output

Final Wiring:
WhatsApp Image 2025-11-05 at 21.58.01_9a4c9b45

Wires

I initially used M to M, but then once I mounted the breadboard I used M to M connected with one F to F then another M to M. I realized this was redundant and was just better using a longer M to M and had to spend more time replacing all the wires.

Output

Screenshot 2025-10-31 183748

Future

Connect ai, distance sensor, and camera. Bring everything together.

11/8/2025 - Fully Running

IMG_20251108_172522364

Turning

The car could go back and forth but would not turn. This is because it was quite heavy and rectangular. Those two attributes mainly prevent the car from turning. I tried around 20 different approaches.

Long arc

It would go back very far, then slightly turn, then go forward and repeat this. This technically worked but it took around a minute and so much space it was not even worth it.

Back Forward

The front wheels would stay still and the back wheels would go full power, the intent of this was to sort of force the back of the car, and in turn, the entire car to turn, but since the weight was in the back of the car, this did not work, and the car almost moved as normal.

Opposite

Back would go backward, and front would go forward. This ended up producing a loud squeaky noise as the motors went against each other.

Front Forward

Back wheels would stay still, and front would go full power. This was the technique that showed the most promise since it was quick. Initially it got around 5 degrees, but it was something.

Other

  • Other Speeds
  • Pivot maneuver
  • Hybrid of other methods

Physics

Front Forward

Front forward was the method that worked best, but it still needed lots of improvement, I was sure that with some modifications it would work.

Physics Experiment

In order to understand how long to do front forward and how to improve it I needed to know its specifications. I conducted an experiment on it to see what it does. Materials I used were a ruler, protractor and tape. I put a piece of tape on the right front wheel to use as a reference point. Then I run front forward for 5 seconds. I then, using the protractor, measured the angle it had traveled. I also measured the distance the top of the car was from the tape to see how far it went forward, and I measured how far the right wheel was from the tape. I did this multiple times and recorded the results.

image

Results: it would got 5-10 degrees, it would move forward 12cm, and the right wheel was around 14.3cm away from it original spot.

Using these results I adjust the code to run longer, but this took way too long. I also had a look at the distance it would travel and tweaked it. This really helped me fix the issue but I also made some other adjustments.

  1. Weight on the back
  2. Left wheel loosened
  3. Right wheel lubricated

Weight on the back

image
If there is more weight on the back it will turn better. This is because the lighter front will move with the force, but the heavier back will not move, but since they are connected, in the front's attempt to move it will pivot around the back.
Masses tried:
- marker
- eraser
- stapler

I also tried with no masses. Adding to much mass was NOT good because nothing would happen then. I realized the the best setup was to lighten the front by removing one marker off it and putting a marker at the back.

Left wheel loosened

Usually a tire pushes down on the floor, and with the help of physics moves forward. Hower if I tilt that tire, then it will apply a force slightly to the left/right and that will help the tire pivot.

Right wheel lubricated

What tries to oppose this tilted tire is the other front tire because it still has a force that propels forward, at no angle. If this were to be also tilted, the entire front would lost structural balance and fall to the ground. Problem: need to negate the force causing forward motion without tilting the tire. Solution: Remove friction. All tires are made out of rough material and have grooves to catch friction. If you cover the grooves and make the material smooth, friction would significantly reduce. This is why I covered the right tire with scotch tape. I tried using scotch tape throughout this project, but this is the only time it actually helped.

Turning

By taking advantage of physics I was able to make the large rectangular car with only four wheels turn.

AI ON WHEELS!

The car could fully go and explore my house on its own with the AI.

Pseudocode

if (distance to object is far):
AI()
go()
elif (distance to object is greater than turning distance):
AI()
turn()
else:
## it's already too late
backward()

The code follows this basic structure, combining everything discussed in my previous logs where I do detailed into the code.

Problems
  • Sometimes the object would not be detected because the motors got the power and the distance sensor said "no echo"
  • On each crash, the front wheels would take the damage, right front wheels was okay, but left front wheel was already tilted so it ended up falling the most.
  • Ground would just disconnect because the car was going fast
  • It would turn slightly more or less, especially after the front wheels were injured. All of these were just random errors.

Modes

There is discovery mode where the car and AI freely roam, logging what happens. I also had a mode where the car was controlled by the AI and the AI would determine what to do based on the camera.

image
wanted to see what the ai would think of the plushy

image
balloon

Future

image
image

I also spent a bunch of hours on the test runs and tested with even more objects like a glue bottle.
Also, the little plastic face was not something I 3d printed myself, but something that I salvaged from a previous project using that sensor.
For now, the basics are pretty much done. Next, I will do more research and planning and less hands-on work as a break.

11/13/2025 - Improvements & Research

image

Improvements

Wheel Fixture

AS I previously mentioned, the front left wheel needs to be at a slight angle for the car to move. I previously did this my loosening it so I needed a better way. I first tried using tape again but it just came off. Finally, I found this plastic tightening band that seemed to work perfectly; it put the wheel at an angle and secured it. Also, the tail of the band sticked out and would hit against the tire every 100 ms but this was good because it actually increased friction, and made turning smoother.

Wire Re-do

The way I had put the wires of the HC-SR04 before was a short M to M wire followed by a long F to F wire but this just induced more places where the wiring could break. I realized that this might be the cause of my old error, noEcho, so I decided to re-do the distance sensors wiring. This took a lot of time for a simple task because it was messy and awkward as I had to maneuver around other wires, making me dislodge them. So then once I had to put those dislodged wires also back into place. Finally, I finished replacing the old setup with F to M wires because they skip the M to F connection in-between reducing the chance of loose wires. After I did this I noticed a significant improvement in the accuracy of the HC-SR04.

Picture of wire re-do and wheel fixture:
image

Power Bank switch

image
Before my Pi would always say "Low Power" so I couldn't use its voltage pins. I just thought this was the power bank's problem but it turns out that I needed to charge the power bank more. I found this out when I was forced to change out my power bank with an alternate because it ran out of power. The alternate had no issues and after the first power bank was charged for a long time it also had no issues.
What this means:

2 5V Pins and 2 3V Pins are available

This opens up a plethora of new components that I could add in the future like another distance sensor or a gyroscope. I will probably end up adding these.

Sample Output

I also did even more testing on the AI. This is a section of one of its full logs of a bigger run through my house (if I pasted the full log, it would fill too much space):

"... the view appears to be a close-up of a plain, light-colored floor.
The ground view of this household appears to be a close-up of two types of flooring, with the top portion featuring a white or light-colored carpet and the bottom portion showing a smooth, lighter brown surface, possibly hardwood or laminate flooring. The carpet has a textured pattern, while the lower surface is smooth and even, indicating a clear distinction between the two flooring materials.
The ground view of this household appears to be a living room with a brown couch and a table or counter in the background, possibly in a kitchen area. A colorful item, possibly a blanket or pillow, is visible on or near the couch. The overall atmosphere suggests a casual, everyday space with a few personal touches.
The ground view of the household appears to be a plain, smooth surface with no distinct features or objects visible. The surface seems to be made of a light-colored material, possibly concrete or asphalt, and is evenly lit with no notable shadows or textures. There are no plants, furniture, or other items present in the ground view.
The ground view of the household shows a doorway leading to a room with a window, allowing natural light to pour in. The room appears to have a bed or couch at the bottom of the frame, but it is not clearly visible due to the blurry image. The walls and ceiling are painted white, creating a bright and airy atmosphere.
The ground view of the household appears to be dimly lit, with the focal point being a window covered in white blinds that allow natural light to filter in. In front of the window, there seems to be a piece of furniture or object, but its details are obscured by darkness and shadows. The overall ambiance suggests a quiet, possibly morning or evening setting.
The ground view of the household appears to be dimly lit, with a bed on the bottom left and a silhouette of person or object on the right side. In the center, there is a window with open blinds allowing natural light to filter in, creating a contrast between light and dark areas. The overall atmosphere suggests a quiet and possibly morning or evening setting.
The ground view of the household appears to be a blurry, out-of-focus image of a floor or ground surface, possibly made of tile or stone, with a white and gray color scheme. There is a dark-colored border or edge visible on the left side of the image, which could be a baseboard or a piece of furniture. The overall appearance suggests a clean and possibly recently cleaned or wet surface.
The ground view of the household appears to show a cluttered floor with a visible receipt or paper on the ground. There's also what seems to be a piece of clothing or fabric, possibly a jacket or pants, scattered around. The overall impression is one of disorganization and messiness.
The ground view of this household appears to be a blank space with no visible furniture or objects on the
..."

Research

I have been doing design research for my design proposal, also as a break from fully building and coding.

Wiring Diagram

I spend too much time searching for a good website and not building. I used to use Fritzing but I uninstalled it due to its ridiculous memory consumption. I also spent time creating an Tinkercad account for no reason to use their wiring diagram service, but it did not have the components I needed. So, I finally settled on Cirkit, which had all the components I was looking for and was easily web-accessible.

Starting my diagram:
image

Not Saving

Since this was on the web, I had done something before then I forgot to save my work, so I needed to restart from scratch. This was very painful, but at least I remember now.

Research

I was just looking at what could help my car. I found some useful components like LIDAR, a bigger battery, and more. I still consider these but they are not my top proirity.

Aliexpress

I have been hunting for parts on Aliexpress, checking for measurements, compatibility, quality, and of course price. It's a new experience as I normally use amazon. I have 5 or 6 parts so far, but more are coming.
image

Descriptions

I have started listing thorough descriptions of what each of my components are and why they are necessary. I know this is necessary so others can understand my project, and I am commiting all of this on Github.
image

Future

Hardware: Mainly considering another distance sensor and gyroscope because I already have them.
Software: I will also work on finishing my wiring diagrams and descriptions for components. I will also try doing some more component research on the internet and aliexpress.

11/15/2025 - Wiring Diagram and Research

image

Aliexpress

Everything I did here was about the future parts I am going to get, not what I have right now.
I did lots of research on parts in aliexpress. I found that I needed to always only buy the pres-soldered parts as I didn't have a soldering gun.

Voltage Problem

The upgrade from normal wheels to mechanum wheels increased the power demand. Which means the motors need more power, but at the same time not too much. Each of the sensors needed voltage and some needed more than others. The HC-SR04s need 5V, VL53L1Xs need 3V. At the same time the pi needs its power and I need to be versatile just in case I want more components later.
image

Big Battery

I considered just getting one huge 30V battery and then branching off voltage. After doing some research on voltage I realized that I needed a bunch of connectors, and since I don't have a multimeter, it is not my best choice.

All in Series

I had a look at would happen if I put everything in series. Then I did research. This has multiple issues.

  1. Only batteries of same voltage can go in series. Otherwise the bigger battery will try to charge the smaller one and the small battery will explode. This has happened to me before so I will not let it happen again.
  2. Motor Rating. I looked at the detailed specifications of all of the components. this was a part of the research. I found that the motors were rated to max of around 6 6.4 V. If I were to put too much voltage in then they would melt.
  3. 3. Safety In general doing something wrong here is costly and unsafe.

Parallel

I heavily considered this but in the end I decided that it wasn't worth it for the extra 10 dollars it demanded. Connecting the batteries of 7.4V in parallel to the l298ns in parallel would create an efficient power system. Example: if the back motors demand more power, then they will take it, if front needs more, they will take it, no battery dies out first. But in order to do this, something has to wire them in parallel.

  1. Breadboard This gave me safety issues again. I looked to see if it was safe and when it wasn't decided it wasn't worth the risk.
  2. TX60 Y Split Connector I spent so much time looking at this. It is good but the problem is that it's hard to get. It's either at dollar express and requires more items (dollar express requires a combo) or has very bd quality. The non-dollar express one had barely any buys, generic pictures, no quality guarantee from aliexpress. It also had very bad reviews and multiple people saying that the cable came wrong and it being a waste of money - AWG 14 instead of 12. American Wire Gauge - it has diameter and carrying specifications, and the wire giver had wrong specifications. Also it is 10 dollars for a small wire which seems unfair.

Because of this I just realized that the cons of parallel outnumber its pros.

Normal

Connect 7.4 to each L298N. The only disadvantage is that one of the batteries might die out first. I am just going to use this for simplicity, but maybe in the future I will use a parallel system.

Sensor Voltage

This was also another voltage dilemma with similar circumstances. I was considering putting the 3.7V to the accelerometer and I even looked up all of the specs of the accelerometer. I think that 3.7 which is 0.4 higher than the 3.3 of the MPU6050 is good - it would get safely reduced down. This was just a nuance I considered. Finally, I refined my requirement. I needed 3 3.3Vs and 2 5Vs. So I searched for something that outputed that. That's how I got to the MB-102. I was also looking for a jack version, but then I remembered that I had one power bank left so I could just use that - I would use a usb-c to usb change with the MB-102 and a copy of the Miady powerbank that the pi uses. mb's usb-c to usb-c to usb connector to usb of the powerbank.

Wheels

I am going to get mechanum wheels. I am going to put more about how they actually work like their movement mechanism in their .md file, but selecting them was still a process.
image

Size

I initially was going to get 38mm wheels but the I looked at my current normal wheels and realized that that would be way too small, so I switched to 97mm. Another reason for this is the wheels always falling off, getting hurt, and other problems mentioned in my previous devlogs.

Hubs

I measured my current hubs first and got 10mm. The wheels I wanted were 6mm hubs. But then I measured again and realized I made a mistake. I had measured the thickness of the plastic around the hub hole also accidently. That thickness happened to be 2mm so I got 2mm + 6mm + 2mm which is 10mm.

motor_hub

At the end I realized my mistake, but I spend a long time looking for shaft connectors. But at least, I know what to do if my wheels do end up being too small.

Wiring Diagram

image

snippet of my diagram

I spent loads of time on this. I have finally finished the entire wire diagram of my proposal and of the current prototype I have. I faced many problems on the way.

Color

mbwrongvright

I had the mb-102, a module for connecting power to multiple components just the way I needed. But I accidently put it backwards onto the breadboard (it is supposed to go on the breadboard) because when I got it out of the Crikit menu it was backwards. This does not seems like a big deal at first but it means that the pins and entire orientation is backwards. They way it is supposed to stick onto the breadboard is + to the red rail of the breadboard and - to the blue rail of the breadboard. But since its backward + became blue and - became red. Initially, I thought that this was no big deal and it was just the mb's fault but I did not realize how big of a mistake I made. After 30 min to 1 hour of just casually researching and wiring, I noticed that it was very confusing because the first half of the diagram was + red - blue but then the last half was just opposite. This was so unintuitive and horrible I knew I needed to go back in and change everything. This was when I noticed I put it on backwards, it's hard to know at first because some text is sideways and other normal and besides that it's hard to know what direction is supposed to be front in the first place. I changed every wire manually, I reversed the mb then needed to delete all of the wires and start over because it was wrong. This was painful. I was more careful later and better chose wire colors and labeled pink and purple as SCL and SDA properly so that something like this does not repeat.

Other

The battery brand is different than the one used in the diagram. The actual brands are the purple battery and Tokegawa, but the diagram says UltraFire. Just like this, the powerbank look is also different but they functionality is the same. I could not find any mic that looked at least somewhat similar, so I just wrote 'Mic' on a comment, but it works. Other than that, the diagram is beautiful and perfect.

LIDAR

image
image

This is the biggest component that I considered and did research on but never implemented. It is basically a big 3d scanner that scans 360, its an overpowered version of the HC-SR04 and VL combined 360. I watched videos on how it worked, by sending light in all directions. then, you can visualize where the light parts to see where here is an obstacle. It was perfect and I was so prepared but the price was the problem. They are around 100 dollars. Even the most low-end ones like the Lunar LIDAR are 60 dollars. I remembered how I shouldn't be doing this and how it talked about not buying extremely expensive parts in the guidelines. It is still worth its money but I will use LIDAR one day in the future, just not now.
image

Github

image

I committed a full file with wiring, software, and significance for every single component. This is to ensure every dollar given to me is used to its fullest extent.

I also accidently commited the wiring diagram in my last blueprint project instead of GPT On Wheels because I had the tab open. I tried looking for git commands and terminal and lots of complicated processes, but I just missed the little delete icon.

Future

Everything I mentioned here was just a fraction of the research I did. I also was on aliexpress, looking for more components, analyzing the pi 5 pinout, looking back at my pi with a flashlight to see its GPIO among other things I did. I am going to finish up the descriptions and then put in the code I currently have and might even make a 3d model. So far I think I have made awesome research progress and doing what I am supposed to be for research

11/22/2025 - Finished Submitting Design Review

Finished Design

image

The design is done, I have submitted the design! However, I faced many issues before I could finish the design. Unfortunately, I found better ways to solve my issues after I finished dealing with them in not the most efficient way.

Uploading Files

I needed to get all of my code onto github, but all of my code was on the pi. My approaches:

  1. Gmail, but gmail has attachment restrictions, sometimes it says "file too big" in red text at the bottom or it says this. This was how I was getting images through before so I was disappointed. image
  2. Whatsapp, this was the option that worked best. I used the Whatsapp app on my pc, then connected to my phone by scanning the qr code. Then, I just messaged myself the code and video files. image

What I should have done

What I did

Since I needed to get code over to github in the end, I should have created a remote repository on my pi, then pull pushed and synced with github. I instead manually uploaded every file on Whatsapp then manually downloaded each then formed my own replicate directories by have the pi on RealVNC viewer on the other window pulled up. I ended up having to manually go into vs code and and files and folders. But the biggest problem was that I renamed lots of things. I renamed many folders for clarity then had to go in manually to change them. Not only was this annoying, but it decreased the possibilities of my code working. I needed to change every single path manually because I renamed them I wanted to rename MCP_agent.py to agent.py for conciseness, and I did but once I saw that I needed to go back and change everything, I just kept its original name. Pylance did handle it but I had specified folder.file but Pylance specified .file only so it did not handle all of the renaming. This technically did not affect performance since I did not do anything else but rename and add comments but it increases the chances of me going wrong and got me frustrated

Solution

image
Open my repository on my pi. Press . to open dev editor. Then clone the repository. Then get a remote repository so I can make changes directly from the Pi 5. This would have saved me lots of time and decreased the chances of me messing up. I needed to do this on my pc after I got all the files through whatsapp anyways.

Uploading Videos

I had lots of large videos to upload. All my tries:

  1. Drag and Drop - it responded with "Wowza thats a big file" so it did not work
  2. Copy and Paste Dev Editor- I thought that I could bypass it in this vs-code-like editor but it also gave an error box with a red x.
  3. Drag and Drop in the Dev Editor - This gave the same error
  4. Finally after some research I was forced to Git LFS

Git LFS

Github provides a way to put large file in a repository by using Git LFS (Git Large File Storage) to store them and then point to their location. I followed the steps to get Git LFS:

  1. Install from https://git-lfs.com
  2. Run 'git lfs install' on remote repository
  3. Track .pm4 using 'git lfs track ".mp4"'
  4. Commit the .gitattributes file which has this property using 'git add .gitattributes'

But I was not using git lfs before so I had to:

  1. migrate to it using 'git lfs migrate import --include=".mp4"'
  2. then push because of the migration 'git push --force origin main'

Now Git LFS was working, but not the way I wanted. The videos would not appear in the web editor, but they were still downloadable.

What I should have done

What I did

Now, it would allow for downloads but the videos would still not appear, technically people could watch the videos but it was not optimal (I mention more in the README for Outcome).

Solution

In my root directory's README I really needed a video playable on the repository on the web, and I lost faith in Git LFS. So, I tried compressing the video file. I used Veed https://www.veed.io/tools/video-compressor just like I used IloveIMG to compress some large images. I changed the resolution and dimensions to make the video smaller. And it worked! the video now played in the web. I should have done this for all of the video files, but I did not want to overcomplicate the files by removing Git LFS then manually deleting then going back and committing. But, in the future I will just compress videos instead of Git LFS.

I learned a more efficient and better way to commit code - remote workspace on pi - and a better way to commit videos - compressing them - so for the full project I will do this and have better commits

Repository Structure

I added lots of READMEs wherever I needed to say something. I also finally decided to dedicate a file for output, and I decided that a blender render was unnecessary. Overall, I am very pleased with how the repository structure turned out.

image

Most of the rest of the things I did in this log were just taking what I already have, making it better to review (compressing, snipping, commenting, elaborating, explaining), and writing READMEs. Id did spend a significant amount of time writing comments explaining the code though. I used a header that looked like "----------------------" to signify bigger parts, and this made it easier to communicate and get through what the code meant in the complex file with AI code MCP_agent.py. Fort eh other comments I just used the normal #, but I have fully explained all of my code clearly using lots of comments. I have used my keyboard a lot more in these past few devlogs than the ones where I was building the prototype.

Final

I had lots of fun building the prototype and going so far in GPT On Wheels. I can't wait for the components to arrive so I do finally finish my ✨🤖 GPT On Wheels ⚙️💡

11/26/2025 - Improving Hardware

image

Making Hardware Improvements using components I already have

Pan-Tilt

The camera can only have one view. This was one of the most annoying parts with the prototype itself because it could only look forward, not look around. Humans can do this by turning their heads, so GPT On Wheels needs something similar. This is what the Pan-Tilt is for. I watched many videos on how the pan-tilt worked with servos but still found it hard to believe until I tested it myself. Because servos can only turn clockwise or anti, how would they make something look around?
image
The x horizontal is simple, it is jut a flat circle. The y vertical direction however is different; the servo is actually mounted facing a different direction, while being connected to the first servo. So the first servo moves in the x then the y servo is the same thing but facing a different direction so it moves y, as illustrated by my picture. X is pan and Y is tilt.

But how do you manually configure this? All of the videos I watched had 3d printed exact parts (which I don't have) and little plastic connectors and screws (which I do have). I did not have the exact 3d parts for servos, but I had some little 3d parts from an old project. I decided to reuse for the pan-tilt frame. I just used tape but I needed some way for the bottom servo to stick to the top servo. This is what the plastic connectors are usually for, but I don't have exact parts for them or know exactly how to configure them, so I just tried.

  1. Only screws just did not work because no turnable-element/tightness/connector with 3d part
  2. Tape too fragile
  3. Cardboard unattachable at end

What finally worked was a foam block. It locked perfectly and its sponginess was exactly what I needed. Along with tape, it worked.

image

But it had one problem: the length of the camera's ribbon cable was very short and it would limit the camera from fully going in one direction.

image
As seen in the picture, the servo tries to pull the camera down, but the cable resists.

Solution: the 30cm cable - it would allow the cable to just extend instead of resisting
Also, setting the pan-tilt test up was annoying because I needed to insert a bunch of more wires on the prototype and put the pan-tilt in an awkward position because the pi was still on the prototype then I needed to remove all of the clutter, making everything worse.

LCD 1602 Display

The RGB LED was to display status, but it cannot display text, that's what this LCD 1602 Display is for.
Also, it would be better to have some sort of screen at the front to make it look better. The Display would display status, maybe sensor information, maybe the AI's thoughts.

image

Environmental Sensors

I will include a photoresistor, thermistor, and DHT11. They are for detecting light, temperature, and humidity.

Photoresistor:

image

Thermistor:

image

DHT11:

image

All of them are powered through the MB102 rail. Even though all of these seem insignificant at first, and they seem like I just added them just for the sake of adding more components, they together are actually useful. It allows GPT On Wheels to get valuable information on its environment. For example, if light increases, temperature changes, and humidity changes then the AI knows its outside or near a door. Or maybe there is a lamp and as the light increases and using the camera, it could tell there is a lamp, the thermistor could work similarly for a place like the kitchen.

Blender 3D visualization

I made a 3D visualization in Blender to better communicate how the final design will look like. It does not have all of the parts in the full design It only has the main ones, and not all of the components look like their 3d version in real life Also, the wheels and circuits I got from the free marketplace because they are too complex and require too much time for me to design myself (that's why they barely look like their counterparts). Blender has a steep learning curve so it was time-consuming and I was searching for the keyboard shortcuts. However after lots of hard work and doing work in blender, I got a basic representation:

image

I'm sure that these changes have improved how well my project actually works in the hardware side and communicated that better.

12/21/2025 - Mic and Speaker

image

Mic

The mic was just a small usb addon on the usb 3.0 that worked easily. I could go to the input tab on the gui after the 'pavucontrol' command, then going under the input tab, or alternatively just clicking the mic symbol at the top right corner to adjust volume.

Speaker

This was troublesome because when I first connected it it did not work.

Biggest issue: No headphone jack

The pi 5 does not have a headphone jack so it's hard to buy a normal speaker. So this bluetooth one would be best.

Initial Try

I just tried connecting the usb and usb c, I even had a usb c to usb adapter ready, but audio would not play. I tried switching the M button but that just sent to FM mode and static.

Working Method

  1. I navigated to the interface for raspberry pi 5 settings using 'sudo raspi-config' which brought me to the interface
  2. I went into advanced -> audio -> pulseaudio and I chose pulseaudio because that's the correct cli integration
  3. Then I installed some dependencies and started in the terminal
  4. then I needed to start bluetoothct1 the command line tool for audio bluetooth devices using 'power on' then 'agent on' then 'scan on'
  5. Then I needed to find my speaker - it showed up as 'BT Speaker'
  6. After that I needed to connect it by 'pair [address]'

Then I used pavucontrol to adjust audio and ensure its working, I tried other methods also like more raspberry pi configurations and pulsemixer but this route was the best.

Finally using the python library for raspberry pi audio devices, sounddevice, and numpy, I ran a simple script to check programmatically if the audio was working.

image

The pause and next buttons don't work but that's okay.

Next

I still can't really start building because I am still waiting for the batteries to arrive, but I can start experimenting like this.