Close
0%
0%

MINIBOT

A small semi-autonomous robot.

Similar projects worth following
I was going to make a bigger robot, but the 3v geared motors only wanted to go in a small robot. So I made a very small robot. It is very slow, but this is my first robot and it is only for driving around in my house so it doesn't have a need for speed.

I think this robot would be a lot better with some faster motors. I bought 2 3v 16rpm geared motors on Amazon about a year ago, and finally got around to using them. I bought 16rpm because I thought that would give more torque... maybe it does but these motors are super tiny!

One upside to having such a slow robot is it's not going to crash into anything and break something in your house or break itself. I do believe they sell the same exact motor dimension in different RPM ranges up to 300 RPM. I think for this robot 50-150 RPM would be ideal.

Originally I was going to use tracks for the robot. I still think that would be the best, especially with only 2 motors. But I was having trouble with 3d printing tracks. I did get a set to print out, but they were too big and the motors didn't have enough torque to turn them.

I wanted either tracks or 4 wheel drive on this robot. So I decided to 3d print a drive gear that goes in between each wheel gears, so each side the wheels turn at the same rate. This actually worked quite well.

The robot has the following components:

  • Arduino Pro Micro: The main brain that reads all sensors and controls the motors.
  • ESP32-CAM: For the ability to drive the robot remotely. Mostly stays in deep sleep when not being used.
  • x2, 3v 16RPM tiny geared motors: For driving the wheels. See my info about these motors above.
  • HC-SR04 Ultrasonic Distance Sensor: The only sensor (aside from the camera) on the front. Used for Obstacle avoidance.
  • IR Infrared Obstacle Avoidance Sensor: Placed on the back for detecting distance when backing up. This module only has a range of about 2-3 inches, so it is not very useful for navigation. I also discovered it draws about 40 mA as long as it is connected to VCC. That is about 3x more than the Arduino and all the other sensors combined (not including motors or ESP32). I ended up switching it with a transistor. That way it can only be powered when backing up.
  • PIR Motion detection sensor: If the cat walks in the room the robot wakes up!
  • Light-Dependent Resistor: For measuring the area's relative luminosity.
  • 30 mA 5v Monocrystalline solar panel: For keeping the battery topped off and sensing light strength.
  • TP4056 LiPo charger: For charging the robot via USB
  • Slide Switch for powering off robot
  • 10 Pin header for programming Arduino and ESP32.
  • 5v Boost convertor module. This runs everything. The HC-SR04 is required to be powered by 5v. The motors work better on 5v, and the ESP32 and Arduino each have 3.3v LDO on them, so 5v is an acceptable power level for their input.
  • 1100 mA 1s Lipo Battery: drains in a few hours if using ESP32. Otherwise lasts a long time.

I am probably forgetting something at the moment, but I will add it later if I remember. I wanted to add a temp/humidity sensor, but as you will see from pictures I will upload, the entire inside of this robot is a tight rat's nest of wires. There may be room to add one more sensor, but I've done enough soldering over the past week haha.

  • Rethinking Modes

    Gordon12 hours ago 0 comments

    The way MINIBOT is currently setup isn't ideal. There are several modes I have it setup to operate in that are sort of clashing with each other.

    Currently, the arduino pro mini that reads all the sensors and drives the bot has 3 modes:

    1. Manual: In this mode the bot will not drive on it's own, it waits for serial data from the ESP32. If data is received it checks for control commands for driving, etc.
    2. Autonomous: In this mode, the bot will drive around randomly. If it comes close to an obstruction, it will turn until it has a clear path in front and keep driving. After 30 turns it will go into sleep mode.
    3. Sleeping: The bot goes into deepsleep, wakes every 8 seconds checks for incoming serial data or activity from the motion sensor. If the motion sensor is triggered it goes back into Autonomous mode.

    While the Arduino is doing the above, the ESP32 wakes from deepsleep every 5 min. upon waking it sends a command to arduino requesting sensor readings. If the battery voltage from that data is less than 3 volts, or it doesnt receive that data in a set amount of time, it goes back into deepsleep for another 5 min. The ESP32 at this point has 2 modes as well. It saves what mode it is in in the RTC memory so it can remember when it wakes up. 

    When first powered up, after doing battery check, it initially creates an AP. If no client connects to that AP in a set amount of time, it sets the flag to the second mode, then sleeps. If a client does connect. The bot can be controlled via a web browser, and video stream viewed.

    The ESP second mode, upon waking, it asks for battery voltage, then it gets data back and if all is okay there, it connects to the secondary WiFi LAN i setup, takes a photo, and uploads it to the raspberry pi that is connected to that LAN via ethernet cable. I am successfully able to access all these photos from anywhere via tailscale.

    After reading all this you may notice where there may be some issues here...

    1st, if the Arduino is asleep when the ESP wakes up, it will time out waiting for serial data, just wasting battery.

    2nd, the timing has to be just right after turning it on and connecting to AP to enter manual mode. Then once disconnecting, the bot has to be power cycled again to reenter manual mode.

    3rd, I am not sure why, but after the bot goes into sleeping mode, it has been having issues after waking up. Or it doesnt want to wake up.

    To solve these problems I need to rethink what is controlling what...

    I think the best angle to go at this is remove the AP mode. I was going to do that anyway because I want to manually control the bot through the Pi via tailscale. Then I need to rethink how the bot is waking up. I think instead of the ESP32 sleeping for 5 min, having the arduino be the one to wake it will be a better idea. I will need to solder a control wire between the two devices to use as an interrupt on the ESP.

    Now the question is how to switch between manual and autonomous mode?

    my idea is to have the manual control page be hosted on the Pi. The bot will connect to this page when it wakes, and if a flag is set for manual control, it will start streaming video and accept commands. if that flag isnt set, it will do the photo upload, then go back to sleep like normal. This might sound kind of annoying, because to control the bot, I would access that page, check manual then have to wait until the Arduino wakes the esp. If I still have its sleep time at 5 minutes that would be the annoying part. The longer the wait, the longer battery life the bot will have.

    So I definitively have some refactoring to do. This all involves writing code on the Arduino, the Esp32 and the Pi server. All this just in case I want to remotely control the bot...

    I could make it a lot easier for myself, just hand control of the esp to arduino for taking and uploading photos and forget about the manual mode... but what's the fun in that lol?

    This was a long ramble, but that's where I am at with MINIBOT. Have just been...

    Read more »

  • Control Minibot From Japan

    Gordon01/03/2025 at 02:13 0 comments

    I don't plan to go to Japan, but if I did, I'd still like to connect to MINIBOT with my phone and see what's going on under my couch.

    I already use Tailscale, so I will install Tailscale on the raspberry pi in order to access it from anywhere. I set up a second wifi router with a different subnet than my main router. The pi is connected to internet through wifi, and to the second router by ethernet. Now I can have MINIBOT and whatever other wifi sensors I want to talk to the Pi able to do so but not take up traffic on main router or be exposed to the main LAN. 

    (WWW)---(home router)
                 |
                wifi
                 |
             <TailScale>
            [Raspberry Pi]
                  |
                 eth
                  |
              (router2)
             /    |    \
            /     |     \
         wifi    wifi   wifi
          /       |       \
     [minibot]    |        \
    ( OO( )( )   [?]      [?]

  • Serial Communication

    Gordon01/02/2025 at 10:51 0 comments

    I wrote some code to send data between Arduino and esp32. For 2 reasons. Actually 3 and maybe more.

    1st, I want the esp32 to know what the battery level is. I want it to sleep if the battery is low. I could have just added a voltage divider and wired it up to battery like the arduino, but it is deep in the mess of wires and has some hot glue holding it in place, didn't want to pull it and solder an analog wire on

    2nd When the robot is being controlled manually, I'd like the sensors to be visible on the control webpage.

    3rd, I may want to upload some or all of that data at some point.

    Most of all of this is about timing, because if the ESP32 is asleep most the time, when it wakes up it sends a code over Serial to Arduino, and the arduino replies with the sensor readings, including the battery voltage. 

    I was having all sorts of issues debugging why it wasnt working properly. I did find some bugs and improve the serial code, but I was still having issues. Eventually I figured out the library I was using for the DHT11 sensor wasn't working properly. It would get stuck while trying to read the sensor. I just found a different library and it was working great after that.

    The second issue is I want the arduino to sleep at times as well... what if the arduino is asleep when the esp32 wakes up and needs data?

    I figured out I can wake the Arduino with the Serial RX pin. So when esp32 sends that control character, the device wakes up.

    I am working on setting up a second wifi router I plan on having connected to a raspberry pi. the robot will use this wifi connection, and I am hoping I can tailscale into the pi and control the robot from anywhere in the world. We'll see...

    my cat still doesnt know what to think of the MINIBOT.

  • A Hat For MINIBOT

    Gordon12/30/2024 at 22:27 0 comments

    There are a few modifications I will make on the bot today.

    The first is the solar panel. Where it was mounted currently, the Arduino is just beneath it, as well as a mess of wires. I had to put hot glue down fast then put some pressure on the solar panel to get it to go into place. But after placing the bot under a very bright light the hot glue softened and the panel lifted up.

    I am going to print a "hat" or bracket of some sort, that can be easily removed that a larger solar panel will fit into. This will also allow easy access to the Arduino as well as plenty of space for the wiring.

    The only downside to doing this is it will remove the ability of the robot being able to drive if it gets flipped over. But so far that has not happened, so I am willing to sacrifice that feature. I still want it to be as low profile as possible for driving under shelves and furniture.

    The second modification will be a small panel for the back ports and switch. As of now the switch is pretty recessed so it is hard to easily access. Also there is no internal connection for the Arduino and ESP32 Serial pins. This is done through the programming header. So The panel I will print that has a better switch on it will also have space for a male header that can be bridged to make those connections. This panel will be easy to unplug in order to program the robot.

    The modifications are complete! I had to print the switch and port cover several times to get everything lined up. But now it's a bit easier to to turn it on and off, and the port cover has a header with the Tx - Rx pins from and to Arduino and ESP32 bridged, so no need to jump with wires.

    With all the extra room with the added Hat for the larger solar panel, I decided to install a DHT-11 Temperature and humidity sensor. These sensors are not super accurate, but I had a bag of them in my modules box so figured I would throw one in. There is enough room in there to add a piezo buzzer so the robot can make some noise too.

    Now I just need to update the code to handle the DHT-11 Sensor, as well as modify a few bugs in the Serial transfer function that I am using to pass data from Arduino to ESP32.

View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates