Ultrasonic Obstacle-avoiding Robot
This is my attempt at designing and building an obstacle avoiding robot! RekaBot (named after a fairy (: ) can detect obstacles with an ultrasonic sensor that can move around with help from a servo. Based on the measurements she takes, the tracks are driven towards the direction with the biggest distance – avoiding obstacles.
Read in and try to build one yourself!
Step 1: Concept, Drawings and Preliminary BOM
In this project I will tell the story of how RekaBot was built. The target is to build a robot which is capable of avoiding walls and obstacles in an infinite loop.
What do we need in order to build this bot:
- Zumo Robot chassis – ebay
- Pololu micro gearmotors 1:100 – ebay
- HCSR04 ultrasonic sensor – ebay
- SG90 servo motor – ebay
- DRV8801 carrier boards – pololu
- MC34063 DC-DC converter IC – ebay
- PIC18F4550 microcontroller – ebay
- USB socket – ebay
- DIP40, DIP8 IC holders – ebay, ebay
- Lithium-Ion batteries – ebay
- inductors, capacitors, resistors – local electronics shop
- diodes, transistors, LEDs – local electronics shop
- PCBs, ferric chloride, laser printer, acetone
- drills, bits, saw, screwdriver, hammer, pliers, tweezers, sand paper
- soldering iron, solder wik, solder, flux
- PicKit2, PicKit3, for programming
- multimeters for voltage and current measurements
- a laptop with useful software on it, printer
- serial to USB converter – ebay
What I had extra:
- heat gun to salvage components from old boards
- third hand for soldering components
- power supply for tests
- digital storage oscilloscope
- lots of components in stock for quick tests
Long story short
I started with ordering components off E-Bay and local sites, starting with the robot chassis. Nothing special here, just the fact that they shipped without the motors, this hurt a bit – I wasn’t expecting that. I found the warning on their website eventually: “no motors included!”. Of course, it had a link to a quite expensive motor, so I ended up purchasing them separately. After I got those, I assembled the chassis, and drew some initial schematics. With the schematics done, I designed the PCBs with AD14, made the artwork prints on shiny paper, etched and drilled some PCB’s, and soldered the components. Looking back, I can say that all the stuff mentioned in the two lists were really helpful, the oscilloscope in particular. It was extremely useful for debugging the PSU board, all four converters were in trouble at first power-up, but thanks to my RIGOL DZ1104, the errors were easy to locate, and I eventually succeeded powering everything up.
After I got rid of the obvious hardware problems, I used a PicKit3 to write a bootloader into the PIC. This is an important step to fast program update, not to mention, that it only needs a free USB port from the laptop, there’s no need to take your programmer everywhere. Once that was done, I ended up calculating timers, setting up time bases, and writing the C routines for the servo motor, ultrasonic range sensor, LEDs, and other stuff that needed to be handled.
When I got to a point where I was able to turn the servo at any given angle, and read an approximate distance to the closest obstacle with the HC-SR04, I developed a super-simple algorithm which leads the robot away from the obstacles. Once the testing was done, I gathered all the photos I took, all the memo-s I wrote to myself, and compiled it into this instructable for you to read and re-make. I hope you’ll find it interesting, and will try to make one yourself!
For more detail: Ultrasonic Obstacle-avoiding Robot
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- mind controlling robot using pic