Difference between revisions of "ECE434 Project - BoneBot"
|Line 132:||Line 132:|
== Conclusions ==
== Conclusions ==
more , but to time and money constraints, the . Implementing PWM using PRU GPIO and finding a way to increase the speed of the motor rotation would have been preferable, but the current state of the project is one we are happy with. Getting WIFI and startup functionality working took much longer than we expected, but getting it finished was worth the effort.
Revision as of 17:46, 18 November 2019
Embedded Linux Class by Mark A. Yoder
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!
00 Executive Summary 00 Installation Instructions 00 User Instructions 00 Highlights 00 Theory of Operation 00 Work Breakdown 00 Future Work 00 Conclusions 00 Demo 00 Late Comments: I'm looking forward to seeing this. Score: 10/100
The purpose of this project is to create a small remote controlled robot using the BeagleBone Black as the core. To make the actual building of the robot as simple as possible, we will be borrowing a chassis from the Rose-Hulman Mechanical Engineering Department. We will also be using phone app Blynk as the user interface to control the robot. It will have an autonomous mode where it uses 2 stationary IR sensors to avoid objects in front of it.
For this project, we borrowed a plexiglass Chassis for the base of it. However, anything that can support the weight of the hardware and can be fitted with 2 DC motors will work. The original scope of the project was to build the framework out of Legos before we found out how expensive Legos are. Besides that, the breadboard, and the Beaglebone, we needed 2 IR sensors, a Battery, a USB WIFI dongle and an L293D H-Bridge. We used KeyesIR sensors because they come built in with potentiometers for range alterations, but if you don't anticipate having to change the values, the KeyesIR can be reduced down to a smaller and less intensive size. The battery is self explanatory, as we wanted this to be able to move without the constraints of being connected to a laptop through a USB cable. The Battery should be around 5V, with a current over 1 Amp. As long as it meets those requirements, and can connect to the DC Jack port, the battery should be sufficient. The WIFI dongle is to allow WIFI communication. The implementation of which will be described in the next section. This part can be skipped if your Beaglebone comes with WIFI capabilities. Lastly on the hardware, we have an L293D H-Bridge. This allows us to control the movement of the DC motors in 2 directions. If we wanted to implement bi-directional movement without an H-Bridge, it would have required much more hardware and made the breadboard exceptionally messy. I would recommend that whatever H-Bridge you decide to use, that you get one with the "D" at the end, as that means that the diodes are built into the IC and don't need to be manually added.
These installation instructions are performed on the Beaglebone Black while running an Ubuntu 18.04 Operating System
- First, the Blynk-library and bonescript to interface with the Blynk app need to be installed using:
bone$ sudo npm install -g --unsafe-perm onoff blynk-library bone$ sudo npm install bonescript
- Then, clone the git repository at https://github.com/aisaacn/BoneBot
You'll have to go into drive.js and replace the blynk Authorization code with the one from your instance. Your Blynk instance should consist of a joystick that goes to Virtual pin 0 with the x and y ranging from -100 to 100. It should also have a button that connects to virtual pin 1 to toggle the autonomous mode of the BoneBot. At this point, the code should run, so all we have to do is get it connected to WIFI and run on startup To run the program on startup:
bone$ sudo nano /lib/systemd/BoneBot.service
Insert the following lines into the file:
[Unit] Description=description of code After=syslog.target network.target [Service] Type=simple ExecStart=/path/to/git/repo/start.sh Restart=Always RestartSec=1 [Install] WantedBy=multi-user.target
Now that we have the service created, we just need to let the system know it exists and tell it to start working:
cd /etc/systemd/system/ ln /lib/systemd/BoneBot.service BoneBot.service sudo systemctl daemon-reload sudo systemctl start BoneBot.service sudo systemctl enable BoneBot.service
After this, the code will start running upon rebooting the Beaglebone. However, that is mostly useless if there isn't WIFI set up for the Bone to connect to. So to set that up:
- First, you'll need to enter the the connmanctl line using
Once there, the following commands will enable WIFI:
enable wifi scan wifi services (This is to see what WIFI is available to you) agent on connect wifi_###########_## (this is the WIFI code displayed when you ran services before) quit
Congratulation! you've now setup your Beaglebone Black to connect to WIFI upon booting up. Restart the bone and run:
systemctl status BoneBot.service
to see if you have a working process. It takes a little while for the Bone to connect to WIFI and Blynk, so refresh this a couple times over a few minutes.
Assuming all the above instructions were followed correctly and worked for you, the only things needed to run are the blynk app and the battery. Plug the battery into the DC Jack on the Beaglebone and wait a few minutes. Eventually you should get a notification on the blynk app that tells you that you have connected to the Bone, at which point moving the joystick forward will move the BoneBot forward. The same holds true for reverse, right, and left. If the button is pressed, the BoneBot will stop accepting joystick inputs and move forward until it detects an object with the IR sensors, at which point it will move to avoid that object.
Our project does not require any connection to the computer after the setup is done and it will run automatically every time that the Beaglebone is turned on. The interface is simple and intuitive to anyone who played with remote control cars and the like when they were a kid. It can also enter an autonomous mode where it will drive around on its own and avoid obstacles that it finds in its path. Here's an example of that:
Include a YouTube demo the audio description.
Theory of Operation
- Piloted the writing of the final code
- Handled wiring on the breadboard
- WIFI capabilities
- Acquiring parts and materials
- Running a function on startup
Additional Work that could be added onto this project:
- Currently the wheels turn very slowly, improving the power supply so that the Bot moved at a faster pace would improve the project
- The movement is limited to 4 directions, Straight, Backwards, turn right, and turn left. Using PRU GPIO and PWM pulses to vary the motor speed and add additional directions of movement to the project
- Wifi, and subsequently the Blynk application, takes a long time to connect upon boot. Improving that functionality somehow so that it works right after booting up
- The IR sensors have a limited range of view when it comes to object avoidance. Improving the field of view through rotating the sensor or adding more of them would improve the functionality of the autonomous mode
- Beyond those improvements, this project only utilizes 6 GPIO pins, so adding your own special flair, like a buzzer horn or turn signals, can make it feel more personalized
We originally wanted to use more advanced sonar sensors for object avoidance, but due to time and money constraints, we settled with the less effective IR sensors. Implementing PWM using PRU GPIO and finding a way to increase the speed of the motor rotation would have been preferable, but the current state of the project is one we are happy with. Getting WIFI and startup functionality working took much longer than we expected, but getting it finished was worth the effort.
Embedded Linux Class by Mark A. Yoder