DescriptionDogbot is your ideal companion. He can’t get you back the ball you threw at him, but he is capable of tasks that require a certain degree of intelligence and no jaws. Dogbot was made (not born) with an Arduino Nano as his core controller, with the ATMega 168 processor. He was programmed to avoid obstacles, follow lines and heed voice commands. Training Dogbot to do new tricks is easier than training a real dog!
Hardware and Design
The following components have been used:
- Arduino Nano v3
- Arduino Nano I/O Shield
- IR Sensor TCRT5000
- LED Matrix 8×8 MAX7219
- Servo Motor SG90 (x1)
- Continuous Rotation Servo FS90R (x2)
- Bluetooth Module HC-05
- FS90R Wheels (x2)
- Caster Wheel (x1)
- Ultrasound Sensor HC-SR04
- 20 Female-to-Female Dupont Jumper Wires
Dogbot has a 150 mm circular base. The ultrasound sensor (his “eyes”) is located in front. Under the eyes is the LED Matrix, which serves as a mouth. It’s main use is adding expressiveness to Dogbot. He may be happy, sad, surprised, or in any state we can draw on the 8×8 matrix.
The wheels have a triangular disposition, with the caster wheel in front and both motor wheels in the back. By using the two independent motors, Dogbot can rotate in place, move forward or swerve slightly in any direction. The main drawback of this setting is that we must do some calibration: when the same order is given to each motor, the speed of the wheels can be different.
The SG90 Servo Motor moves the tail, and as such it is located in the back, between the motor wheels.
The IR sensor is attached on Dogbot’s belly, between the wheels. It is a little offset from the surface, so it can be closer to the floor. The sensor has a very short range (max. 15 mm), so it’s necessary for the line detection application.
Software and Applications
This is one the easiest applications. Usually it’s done with multiple IR sensors, but in this case we used a single sensor. The basic algorithm is as follows:
The code is really straightforward and works like a charm. While it is detecting the line, it goes right, when it stops detecting it, it goes left. The goRight and goLeft functions are implemented so that the robot doesn’t fully turn in that direction; instead one wheel is given slightly more power than the other. By necessity, the motion is a little jerky, we could achieve something smoother with more sensors. The delay controls that “jerkiness”, and increasing it makes it look less like Dogbot is having a seizure. However, too long a delay also increases the risk of losing the line.
To add some flavour, Dogbot shows a happy smile when following the line and is fazed when he loses it. This adds some complexity to the logic but is easy enough to implement.
This application uses the ultrasound sensor. The sensor works by sending a sound wave and measuring the time until we get it back. As the speed of sound in the air is known (340 m/s approx.), we can convert the time to a distance. The specs tell us we can sense up to 4m ahead, though we don’t need that much. When Dogbot sees something that’s closer than 30 cm, he turns right. With this rudimentary system, he can avoid big obstacles. Sometimes he oversees some thin obstacles, though, like chair legs and such. But in his clumsy way, he gets by. Being round helps: he doesn’t get stuck trying to turn in a wall.
What is a dog you can’t order around? Dogbot can’t sit, but he will sing on command! For this application we used the Bluetooth module, the buzzer and a tool called App Inventor 2, generously provided by the MIT. App Inventor 2 let us design an Android app which could connect with Dogbot via Bluetooth. After the pairing of devices is done, Dogbot waits on standby for the next command. Using the Voice Recognition function which comes integrated with every Android system we can command anything we like. Some things that Dogbot understands are:
- Turn Left
- Turn Right
- Good Boy! (he wags his tail and smiles)
The app also provides some buttons that can be configured (in the Arduino code) to do any function. The singing part is done by reproducing tones of certain frequencies during different intervals with the buzzer. Some melodies can be found on the Internet, and if you’re musical enough you may even want to write your own.
Sergio Alemany Ibor
Gonzalo Ferrer Pastor