Autocharge SG90 Nano Robot
Usually an indoor navigation is based on BT beacons or other expensive equipment. The main idea of this project was to develop a cheap robot (Arduino Nano and 2 SG90 servos), capable of navigating for certain time and then try to find the charging base.
How does it work?
The robot will move around avoiding obstacles due to the distance sensor. It will also maintains a configurable running time counter. When that counter decrease under a certain level, the robot will enter "charging mode"
In "charging mode", it will use the digital compass module to go towards certain coordinates (example: all the way south east) to find the charging station.
When the robot enters charging station, the line tracking sensor will detect a color change and the robot will stay there for certain time to allow charging.
Charging base is a simple device with - connected to an aluminium base and + connected to a high pole. The robot will make contact using an antenna for the + and a ground cable to make contact with aluminium.
Supplies
1 x Arduino Nano
2 x Sg90 Servo continuous rotation (IMPORTANT: not the regular SG90 but the 360 continuous)
1 x 3,7 1000ma battery
1 x Switch
1 x Distance sensor HC-05
1 x 1 digital compass QMC5883
1 x TP 4056 charger
For the charging base: a 5v Power Supply, wires and an aluminium base.
Front Axis
Just glue both servo motors together. You can also cut the jumpers, connect both + (red wire), both - (brown wire) and use a new jumper connector for servo signals (orange wires)
3D Print Robot Body (or Make It With Cardboard and Glue)
If you have a 3d printer, you can just print wheels, the support body and the front sensor case. Files can be found here.
But if you don't, just glue the battery to the front axis and use use a stick to place the line tracking sensor.
Note: In the pictures you will find a bluetooth receiver since this robot is also capable of remote BT controlling.
Circuit
- All 5v/3v from sensors and motors are connected together All GND are connected together
- Then battery out from TP4056 is connected to Arduino VIN (switch in the middle) Battery output - from TP4056 - to Arduino GND
- Servo motor 1, orange cable to D9
- Servo motor 2, orange cable to D10
- Distance sensor trig pin to D6
- Distance sensor echo pin to D7
- Line to D8
- Compass SDA to A4
- Compass SCL to A5
Note: The circuit image includes some parts that are optional for this project like BlueTooth module, laser and light detection.
Main Code
Compass Navigation to Base Code
Detect Base Code
Charging Base
In the picture you can find a reference for charging base. A 5V power supply with Ground connected to an aluminium base and 5V + connected to an upper pole. Those 2 will make contact with robot TP4056 - and +