Home » Posts tagged 'arduino'
Tag Archives: arduino
DYOR: Tobias
The objective of this post is to provide an overview of the assignment to build a robot in the Mobile Robotics course during the spring semester of 2024. The robot is built with lowcost components and should have some functionalities like line tracking, obstacle avoidance, moving its arms, and making expressions and sounds. We also made an app to control the robot through Bluetooth.
DYOR: Ms Cafe con Leche
Made by:
CTO (Chief Technical Officer) : Anja Våge Burtonwood
CHO (Chief Hardware Officer) : Linn Håberg Dimmen
Design
Components:
- Arduino nano
- I/O Extension Shield para Arduino Nano
- SPP-C Bluetooth (compatible HC-06)
- Caster wheel
- 9V battery
- 8×8 LED Matrix, max7219
- Two FS90R servos 360°
- Two 60mm wheels for the FS90R servos
- Linefollower module, TCRT500+
- Ultrasound distance sensor module, HC-SR04
- Passive buzzer module
We assembled the robot on a metal base provided by our professor. For assembling we used both a glue gun and plastic spacers. We connected everything with cables to the extension shield. We used Facilino as a basis for our code, but to achieve the desired custom functionality we ended up writing most of the code ourselves. Facilino was very helpful for modulizing and understanding the functions for each hardware component. We chose the name “Cafe con Leche” due to our high consumption of this beverage during class, it has nothing to do with the robot’s functionality.
Functions
The robot has three main modes; Manual, Linefollowing and Music mode.
Manual mode
In manual mode we are using bluetooth to connect with the robot and send instructions. Since we both have iPhones, we have not made an app, but instead we are running a python script. The python script connects to the bluetooth module of the robot which is instructed to receive messages. For sending commands we used the “pybluez” library, which can be found online. There were some bugs when first testing out this functionality. Originally the plan was to only send integers as commands, but this lead to weird behaviour as the robot was not only receiving the commands that we sent, but also some garbage from the pybluez library (such as “CONNECTED” etc.). Therefore, we had to send commands as strings using an ID and decode them in the Arduino code. This ensures that the robot does not act on received strings unless it is a valid command. The python script also automatically reconnects if the robot is lost, as long as the user closes the bluetooth socket first (by pressing “esc”).
When pressing different buttons on the keyboard of the computer, the commands show up in the terminal of the python script, functioning as a sort of low level interface for the commands. As long as the robot is connected, it will receive the messages sent and decode them. While responding to these commands, the robot will also display arrows on the LED matrix which indicate the current direction. We have chosen to steer the robot using the ‘wasd’ keys, which is common in computer games. Each key incrementally increases the speed in its corresponding direction. This makes steering both flexible and intuitive. The space bar immediately stops the robot, resetting all speed and turn values.
The instructions
- ‘w’ = increase speed in the forward direction
- ‘s’ = increase speed in the backwards direction
- ‘a’ = increase turning in the left direction
- ‘d’ = increase turning in the right direction
- ‘*space bar*’ = stop the motors
- ‘m’ = change mode
Linefollowing
When the robot is in linefollowing mode, it will follow a line on the floor. It does this using the IR sensor and its analog output values. The robot can still receive messages through bluetooth, but will only react to the ‘m’ button, which is to switch modes. While in Linefollowing mode, the LED matrix will display a big L. In this mode, we also look for objects in front of the robot. If the ultrasound sensor detects an object less than 10cm away, the robot will reverse and turn for a few seconds. While it is reversing, the LED matrix will show a big X, and the robot will be making a low beeping sound. After this it will continue to linefollow once it finds the line again.
Music mode
In music mode, the robot stands still and plays music from the video console WII. While in this mode, the LED matrix will display a heart. If connected to bluetooth, you can still change modes with the ‘m’ button, but the other commands will have no effect.
DYOR Adventures of RoboLink
In this entry I will present my robot from the Mobile Robotics class at UPV based on the DYOR Robot Concept. My main theme is the video game “The Legend of Zelda”. (more…)