2014 Fall Mobot Tutorial Wiki¶
Meeting 1 Slides: http://roboticsclub.org/redmine/attachments/download/681/Mobot.pptx
Kit information¶
Kit parts: https://docs.google.com/spreadsheets/d/1EsVXvhnv7uK04XOaw85-hedyqBzIjzfdL_7_mrz4Is8/edit?usp=sharing
BeagleBone I/O Control¶
Step 1: Connect the electrical system
We have provided a recommended electrical setup diagram for a basic mobot. Make sure all voltages and polarities are correct before powering the system.
https://www.roboticsclub.org/redmine/attachments/download/685/mobotElectrical.pdf
Pin functions for the board: http://beagleboard.org/Support/bone101
Step 2a: Control the motors via C++
Pin control can be done through terminal commands. We have starter code that let you run these commands in your C++ program. This provides digital output, and PWM, which is useful for controlling motors.
https://github.com/npol/BeagleBone-Black-Cpp-IO
Mapping of hardware pins to bank and pin numbers can be found in these charts:
https://github.com/derekmolloy/boneDeviceTree/tree/master/docs
For information on how the terminal commands work:
For GPIO (digital input and output):
Good video describing the process and how to hook up signals:
https://www.youtube.com/watch?v=s9tnTcQlTDY
Also, a tutorial showing how to control GPIO without using 'cd' all the time.
http://www.circuidipity.com/bbb-led.html
For PWM (output for speed control):
There isn't good documentation, but I am compiling something together for you to use.
https://groups.google.com/forum/#!msg/beagleboard/wjbOVE6ItNg/Dym4H4HuI8gJ
Step 2b: Control the motors via Python
Adafruit has a GPIO library that can be used to control the I/O pins:
Adafruit I/O Library: https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/overview
- GPIO
- PWM
- ADC
- I2C
- SPI
- UART
- Servo https://learn.adafruit.com/controlling-a-servo-with-a-beaglebone-black/overview
Adafruit tutorial for Wifi: https://learn.adafruit.com/setting-up-wifi-with-beaglebone-black
BeagleBone Image Processing with Pygame¶
Code presented by Sam on 10/11: http://roboticsclub.org/redmine/attachments/download/684/video_test.py
Tutorial for capturing images from camera, threshold, and blob detection
http://www.pygame.org/docs/tut/camera/CameraIntro.html
Tutorial for splitting images into colorspace components, reading and writing images
http://www.petercollingridge.co.uk/book/export/html/550
Presentation with some code snippets
http://ozark.hendrix.edu/~ferrer/presentations/pyarkansas2010/RealTimeImageProcessing.pdf
BeagleBone Image Processing with OpenCV in C++¶
Code to capture and save image: http://roboticsclub.org/redmine/attachments/download/683/camtest.cpp
Example openCV code (not Mobot related): https://sites.google.com/site/theelectronbazaar/home/projects/cam2cam
Code: http://roboticsclub.org/redmine/attachments/download/682/videoGrab.cpp
To compile:
g++ -O2 `pkg-config --cflags --libs opencv` videoGrab.cpp -o videoGrab
To run:
./videoGrab
Instructions for using BeagleBone Black¶
We have already set up Ubuntu and required packages. CMU's LAN connection requires registration of devices, which is a long procedure, so instead we used a non-CMU network to install the packages. Instructions:
BeagleBone Black Setup
For Ubuntu:
hostname: 192.168.7.2
username: ubuntu
password: temppwd
Installed packages
- [[https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu|Adafruit IO Library]]: for access to pins and peripherals
- [[http://www.pygame.org/news.html|Pygame]]: For camera access and image processing
- pyserial: For access to UART serial port
- vim and emacs text editors
Reference Manual: http://www.adafruit.com/datasheets/BBB_SRM.pdf
Instructions for using Raspberry Pi¶
Raspi setup¶
- Connect the raspberry pi to your computer using a ttl console cable: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable?view=all
Windows should automatically install the driver. Set the serial port to 115200baud, no parity, 1 stop bit
Username: pi
Password: raspberry
Note regarding shutdown:
Like your computer, it is not good to suddenly switch off power to the raspberry pi. Instead use the shutdown command, then once you lose the ability to type to it via terminal, unplug power.
To shutdown:
sudo shutdown -h now
To restart:
sudo shutdown -r now
- Configure Raspi for I2C: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
Note: You need to be connected to the internet to update and install packages. Plugging in an Ethernet cable should do the trick. You can still control the Raspi over serial.
Beaglebone Black Setup¶
1. Follow instructions on bealgebone getting started to ensure you have the latest Angstrom distribution
2. Follow the following video to capture video from the PSEYE
http://www.adafruit.com/blog/2014/03/18/get-opencv-up-and-running-on-beagleboneblack-txinstruments-beagleboardorg/
Detailed video, but specific to a $80 logitech camera (but gives 1080p)
http://derekmolloy.ie/beaglebone/beaglebone-video-capture-and-image-processing-on-embedded-linux-using-opencv/
Another option, but did not work:
http://mechomaniac.com/node/32