ECE434 Project - BoneBot

From eLinux.org
Revision as of 17:53, 18 November 2019 by Stichtjd (talk | contribs)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: J. Dalton Stichtenoth and Isaac Austin

Grading Template

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

(Inline Comment)

Executive Summary

Picture that summarizes the project.

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.

Hardware

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.

Installation Instructions

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

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

connmanctl

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.

User Instructions

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.

Highlights

Here is where you brag about what your project can do.

Include a YouTube demo the audio description.

Theory of Operation

This project only runs off of a single Javascript file called drive.js. While this file does import from the Blynk-library for functionality, there is overly complex code or flowchart system for this project. Just by reading through the drive.js code, you should be able to understand where everything comes from and how to system works.

Work Breakdown

Isaac Austin:

  • Piloted the writing of the final code
  • Handled wiring on the breadboard
  • Javascript coding on Object avoidance and Blynk Control

Dalton Stichtenoth:

  • WIFI capabilities
  • Soldering
  • Acquiring parts and materials
  • Running a function on startup
  • Documentation

Future Work

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


Conclusions

Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.




thumb‎ Embedded Linux Class by Mark A. Yoder