BeagleBone
From Robert-Depot
Contents
- 1 Setup
- 2 Debugging
- 3 OpenCV
- 4 potrace
- 5 gphoto2
- 6 Onboard LEDs
- 7 GPIO
- 8 Hardware
- 9 Serial Communication
- 10 Pockesphinx
- 11 Supercollider
- 12 Audio
- 13 Debian
- 14 Installing Ubuntu
- 15 Curses
- 16 Oki Data Microline 320/1Turbo
- 17 OSC messaging on the beaglebone
- 18 Run a Script on Login (Start a Service)
- 19 Other
Setup
Copy OS to microSD card
- Download OS (.img.xz)
- unzip
- figure out what your card is. check df before and after inserting the card:
df -h
- unmount the drive:
diskutil unmountDisk /dev/disk2s1
- copy image to drive:
dd if=Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.06.20.img of=/dev/rdisk2 bs=1m
Default boot from SD card
- boot beaglebone while holding the S2 button (by SD card reader). this boots from the sd card.
- rename the MLO file from /media/BEAGLEBONE/ :
cd /media/BEAGLEBONE
mv MLO MLO_bak
- The beaglebone will now boot from microSD until you replace the MLO file.
What Kernel am I running
uname -a
other
- a lot of good setup stuff here: http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/
Debugging
TTL Cable
- Install USB drivers
- for os x - http://sourceforge.net/projects/osx-pl2303/
- Connect pins like so:
(RED IS NOT CONNECTED)
- From Terminal, start session:
screen /dev/cu.usbserial 115200
- http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/test-and-configure
ssh not working
want to allow processes to keep running?
OpenCV
python-opencv
- install python opencv bindings:
opkg install python-opencv
potrace
gphoto2
- install libusb-1.0-dev
opkg install libusb-1.0-dev
- download libgphoto2
- download gphoto2
- build and install libusb, libgphoto2, then gphoto2:
./configure
make
make install
Onboard LEDs
- flashing an led by hand from terminal: http://elinux.org/EBC_Exercise_10_Flashing_an_LED
GPIO
PyBBIO
other
gpio - http://beaglebone.cameon.net/home/using-the-gpios
Hardware
Real Time Clock (RTC)
- TinyRTC 1.1 - http://www.dfrobot.com/index.php?route=product/product&product_id=879#.UqdVqmT6f3E
- Remove RA1 to operate at 3.3V. (This is an array of pullup resistors for pins SDA - SQ)
- http://learn.adafruit.com/adding-a-real-time-clock-to-beaglebone-black/overview
C920
software
capturing
- capture 300 frames of H264 at 1920 x 1080 to output.raw:
capture -F -o -c 300 > output.raw
- capture and convert with audio:
./capture -F -o -c0|avconv -re -i - -f alsa -ac 2 -i hw:1,0 -strict experimental -threads 0 -acodec aac -ab 64k -ac 2 -vcodec copy avtest.mp4
scp avtest.mp4 rtwomey@192.168.2.31:~/Movies
convert to mpg4
raw2mpg4
or
ffmpeg -f h264 -i output.raw -vcodec copy output.mp4
formats
v4l2-ctl --list-formats-ext
- set resolution:
v4l2-ctl --set-fmt-video=width=960,height=720,pixelformat=1
streaming
- http://www.oz9aec.net/index.php/beaglebone/476-turning-the-beaglebone-into-a-high-definition-ip-camera
- RTP - http://derekmolloy.ie/streaming-video-using-rtp-on-the-beaglebone-black/
- UPD - multicast - http://derekmolloy.ie/udp-video-streaming-beaglebone-black/
dash cam
- http://zachhuff386.github.io/dashcam/
- BeagleBone Black (16gb/1080p/30fps/Logitech C920): 9 hrs 30 mins
Servo
- https://groups.google.com/forum/?fromgroups#!topic/beagleboard/NBm14riUIts
- https://groups.google.com/forum/?fromgroups#!topic/beagleboard/wjbOVE6ItNg
- implementation in bonescript https://github.com/jadonk/bonescript/blob/master/node_modules/bonescript/index.js
- by hand http://www.phys-x.org/rbots/index.php?option=com_content&view=article&id=106:lesson-3-beaglebone-black-pwm&catid=46:beaglebone-black&Itemid=81
Serial Communication
Ubuntu
- use wget to fetch setup tools:
- install setuptools:
sudo sh setuptools-0.6c11-py2.7.egg
- install pyserial:
sudo easy_install pyserial
Angstrom
- update opkg:
opkg update
- install pyserial:
opkg install python-pyserial
Pockesphinx
- https://groups.google.com/forum/?fromgroups=#!topic/beagleboard/aBznzq_bNuU
- Install libasound2, alsa-dev, and alsa-lib-dev. (libasound and alsa-lib-dev were already installed on my beaglebone black):
opkg install alsa-dev
- Get sphinxbase and pocketsphinx, preferrably putting them in a code directory:
- Unzip:
tar -xzf sphinxbase-0.8.tar.gz
tar -xzf pocketsphinx-0.8.tar.gz
- Generate configuration files. Configure without python. In the sphinxbase-0.8 directory:
./autogen.sh --without-python
Supercollider
Audio
- purchase usb sound card.
- connect stereo microphone.
- record audio with arecord:
arecord -D sysdefault -t wav -c 2 -r 44100 -f S16_LE -v binaural2.wav
- play audio:
aplay binaural2.wav
- use the ALSA mixer to set recording levels, output levels, etc.:
alsamixer
Debian
Installing Ubuntu
- The instructions below are written for linux. I installed from a Ubuntu live USB drive (Ubuntu 13) on my macbook pro (os x 10.8).
- Once you are booted in ubuntu on your non-beagleboard system, follow instructions here:
- there will probably be missing packages
- you may need to add universe to package repository to get those missing packages:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
- list disks:
diskutil list
Curses
- install python-curses:
opkg install python-curses
Oki Data Microline 320/1Turbo
- plug in Sabrent usb to parallel adapter
- should show up in device tree as: /dev/usb/lp0
- echo arbitrary text to lp0 from bash shell:
echo "I didn't realize it could be so fast" > /dev/usb/lp0
- print to lp from python:
lp = open("/dev/lp0","w")
lp.write("Hello World!\n")
lp.close()
http://rosettacode.org/wiki/Hello_world/Line_printer#Python
CUPS on beaglebone
- Install CUPS:
opkg install cups
- List available printers:
lpinfo -v
- Add ML320 as new printer:
lpadmin -p ML320 -E -v usb://OKI%20DATA%20CORP/ML320/1TURBO
- Enable ML320:
cupsenable ML320
- https://groups.google.com/forum/#!topic/beagleboard/Tn-rQfOdEPg
- https://wiki.archlinux.org/index.php/CUPS_printer-specific_problems
OSC messaging on the beaglebone
Run a Script on Login (Start a Service)
Make a Shell Script
launch_mirror.sh - launches my python script as detached screen session
#!/bin/bash
cd /home/root/convexmirror
/usr/bin/screen -dmS mirror /home/root/convexmirror/convex_mirror.py
make the scrip user executable
chmod u+x
Make a Service
make a service file:
vi /lib/systemd/system/cvxmirror.service
cvxmirror.service:
[Unit]
Description=Runs looping convex mirror code
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/home/root/convexmirror/launch_mirror.sh
[Install]
WantedBy=multi-user.target
make links:
cd /etc/systemd/system/
ln /lib/systemd/cvxmirror.service cvxmirror.service
make system take notice:
systemctl daemon-reload
start service manually:
systemctl start cvxmirror.service
stop service manually:
systemctl stop cvxmirror.service
enable on startup:
systemctl enable cvxmirror.service
http://www.nunoalves.com/open_source/?p=308 http://kezhong.wordpress.com/2011/11/19/creating-my-own-systemd-service-files-on-fedora-16x86_64/
Other
- video on C++ programming with Beaglebone - http://www.youtube.com/watch?feature=endscreen&NR=1&v=vFv_-ykLppo
- Contest. Win 2 free beagleboards - http://elinux.org/BeagleBoard/contest