Difference between revisions of "BeagleBone"

From Robert-Depot
Jump to: navigation, search
(Default boot from SD card)
(Hardware)
 
(43 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
=Setup=
 
=Setup=
 +
==Change Hostname==
 +
<syntaxhighlight lang="bash">sudo vi /etc/hostname</syntaxhighlight>
 +
<syntaxhighlight lang="bash">sudo vi /etc/hosts</syntaxhighlight>
 +
==Add public key==
 +
<syntaxhighlight lang="bash">cat ~/.ssh/id_rsa.pub | ssh debian@beaglebone1.local "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"</syntaxhighlight>
 +
==Debloat==
 +
http://kacangbawang.com/beagleboneblack-revc-debloat-part-1/
 +
==Install devmem2==
 +
https://scivision.co/devmem2-on-the-beaglebone-black/
 +
==Install Adafruit BBBIO==
 +
https://github.com/adafruit/adafruit-beaglebone-io-python
 +
==Install
 +
==Textmate and rmate for simple remote editing==
 +
*install textmate on os x system
 +
*install ruby on beaglebone:
 +
<syntaxhighlight lang="bash">
 +
opkg install ruby
 +
</syntaxhighlight>
 +
*install rmate on beaglebonei:
 +
<syntaxhighlight lang="bash">
 +
gem install rmate
 +
</syntaxhighlight>
 +
*setup ssh tunneling
 +
<syntaxhighlight lang="bash">
 +
ssh -R 52698:localhost:52698 pi@192.168.2.144
 +
</syntaxhighlight>
 +
 +
==Disable default services==
 +
<syntaxhighlight lang="bash">
 +
systemctl disable bone101
 +
systemctl disable cloud9       
 +
systemctl disable gateone
 +
</syntaxhighlight>
 +
 
==Copy OS to microSD card==
 
==Copy OS to microSD card==
 
*Download OS (.img.xz)
 
*Download OS (.img.xz)
Line 16: Line 50:
 
==Default boot from SD card==
 
==Default boot from SD card==
 
*boot beaglebone while holding the S2 button (by SD card reader). this boots from the sd card.
 
*boot beaglebone while holding the S2 button (by SD card reader). this boots from the sd card.
*move the MLO file from /media/BEAGLEBONE/ to a safe place:
+
*rename the MLO file from /media/BEAGLEBONE/ :
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
mkdir backup
+
cd /media/BEAGLEBONE
mv /media/BEAGLEBONE/MLO backup
+
mv MLO MLO_bak
 
</syntaxhighlight>
 
</syntaxhighlight>
 
*The beaglebone will now boot from microSD until you replace the MLO file.
 
*The beaglebone will now boot from microSD until you replace the MLO file.
 +
 +
==Edimax WiFi fix==
 +
for debian 3.8.13-bone70
 +
*http://www.feverlabs.org/2015/03/edimax-wifi-adapter-on-beaglebone-black/
 +
Basically, disable HDMI output.
 +
 +
likely due to HDMI interference.
 +
alternately, use a usb extension cable :)
 +
 +
*boot wifi
 +
<syntaxhighlight lang="bash">sudo ifup wlan0</syntaxhighlight>
 +
if it works...
 +
<syntaxhighlight lang="bash">sudo ifup wlan0
 +
ioctl[SIOCSIWAP]: Operation not permitted
 +
ioctl[SIOCSIWENCODEEXT]: Invalid argument
 +
ioctl[SIOCSIWENCODEEXT]: Invalid argument
 +
Internet Systems Consortium DHCP Client 4.2.2
 +
Copyright 2004-2011 Internet Systems Consortium.
 +
All rights reserved.
 +
For info, please visit https://www.isc.org/software/dhcp/
 +
 +
Listening on LPF/wlan0/80:1f:02:bf:23:52
 +
Sending on  LPF/wlan0/80:1f:02:bf:23:52
 +
Sending on  Socket/fallback
 +
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
 +
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
 +
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
 +
DHCPOFFER from 10.1.10.1
 +
DHCPACK from 10.1.10.1
 +
bound to 10.1.10.121 -- renewal in 4605 seconds.</syntaxhighlight>
 +
 +
*adafruit wifi reset script: https://learn.adafruit.com/setting-up-wifi-with-beaglebone-black?view=all
 +
 +
*<syntaxhighlight lang="bash">iwconfig</syntaxhighlight>
  
 
==What Kernel am I running==
 
==What Kernel am I running==
Line 30: Line 98:
  
 
=Debugging=
 
=Debugging=
 +
==Find Beaglebone on Local Network==
 +
*MAC Address: C8:A0:30:AB:71:1D (Texas Instruments)
 +
Nmap scan report for 192.168.2.31
 +
**Scan for BBB:
 +
<syntaxhighlight lang="bash">sudo nmap -sP 192.168.2.* | awk '/^Nmap/{ip=$NF}/C8:A0:30/{print ip}'
 +
</syntaxhighlight>
 
==TTL Cable==
 
==TTL Cable==
 
*Install USB drivers
 
*Install USB drivers
 
**for os x - http://sourceforge.net/projects/osx-pl2303/
 
**for os x - http://sourceforge.net/projects/osx-pl2303/
 
*Connect pins like so:
 
*Connect pins like so:
http://www.adafruit.com/images/medium/954bbb_MED.jpg
+
http://www.adafruit.com/images/large/954bbb_LRG.jpg
  
 
(RED IS NOT CONNECTED)
 
(RED IS NOT CONNECTED)
Line 40: Line 114:
 
**<code>screen /dev/cu.usbserial 115200</code>
 
**<code>screen /dev/cu.usbserial 115200</code>
 
*http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/test-and-configure
 
*http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/test-and-configure
 +
 
==ssh not working==
 
==ssh not working==
 
*https://groups.google.com/forum/?fromgroups#!topic/beagleboard/Ya2qE4repSY
 
*https://groups.google.com/forum/?fromgroups#!topic/beagleboard/Ya2qE4repSY
Line 54: Line 129:
 
*http://potrace.sourceforge.net/#downloading
 
*http://potrace.sourceforge.net/#downloading
 
=gphoto2=
 
=gphoto2=
 +
*install libusb-1.0-dev
 +
<syntaxhighlight lang="bash">
 +
opkg install libusb-1.0-dev
 +
</syntaxhighlight>
 
*download libgphoto2  
 
*download libgphoto2  
 
**http://sourceforge.net/projects/gphoto/files/libgphoto/
 
**http://sourceforge.net/projects/gphoto/files/libgphoto/
 
*download gphoto2  
 
*download gphoto2  
 
**http://sourceforge.net/projects/gphoto/files/gphoto/2.5.2/
 
**http://sourceforge.net/projects/gphoto/files/gphoto/2.5.2/
*build and install libgphoto2, then gphoto2:
+
*build and install libusb, libgphoto2, then gphoto2:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
./configure
 
./configure
Line 64: Line 143:
 
make install
 
make install
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=Onboard LEDs=
 +
*flashing an led by hand from terminal: http://elinux.org/EBC_Exercise_10_Flashing_an_LED
  
 
=GPIO=
 
=GPIO=
Line 71: Line 153:
 
==other==
 
==other==
 
gpio - http://beaglebone.cameon.net/home/using-the-gpios
 
gpio - http://beaglebone.cameon.net/home/using-the-gpios
 +
 
=Hardware=
 
=Hardware=
 +
==Rechargeable LiPo==
 +
http://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone/blog/2013/08/10/bbb--rechargeable-on-board-battery-system
 +
==Real Time Clock (RTC)==
 +
http://www.dfrobot.com/image/cache/data/DFR0151/V1.1/IMGP9616-600x600.jpg
 +
*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==
 
==C920==
===capture===
+
===software===
*https://github.com/derekmolloy/boneCV/
+
*boneCV - https://github.com/derekmolloy/boneCV/
 +
===capturing===
 +
*capture 300 frames of H264 at 1920 x 1080 to output.raw:
 +
<syntaxhighlight lang="bash">
 +
capture -F -o -c 300 > output.raw
 +
</syntaxhighlight>
 +
*capture and convert with audio:
 +
<syntaxhighlight lang="bash">
 +
./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
 +
</syntaxhighlight> from [http://nerdlogger.com/2013/11/09/streaming-1080p-video-using-raspberry-pi-or-beaglebone-black/ here]
 +
 
 +
===convert to mpg4===
 +
<syntaxhighlight lang="bash">
 +
raw2mpg4
 +
</syntaxhighlight>
 +
or
 +
<syntaxhighlight lang="bash">
 +
ffmpeg -f h264 -i output.raw -vcodec copy output.mp4
 +
</syntaxhighlight>
 +
 
 +
===formats===
 +
<syntaxhighlight lang="bash">
 +
v4l2-ctl --list-formats-ext
 +
</syntaxhighlight>
 +
*set resolution:
 +
<syntaxhighlight lang="bash">
 +
v4l2-ctl --set-fmt-video=width=960,height=720,pixelformat=1
 +
</syntaxhighlight>
 +
*
 +
 
 
===streaming===
 
===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/
 
*RTP - http://derekmolloy.ie/streaming-video-using-rtp-on-the-beaglebone-black/
 
*UPD - multicast - http://derekmolloy.ie/udp-video-streaming-beaglebone-black/
 
*UPD - multicast - http://derekmolloy.ie/udp-video-streaming-beaglebone-black/
 +
 
===dash cam===
 
===dash cam===
 
*http://zachhuff386.github.io/dashcam/
 
*http://zachhuff386.github.io/dashcam/
Line 114: Line 237:
 
*Generate configuration files. '''Configure without python.''' In the sphinxbase-0.8 directory:
 
*Generate configuration files. '''Configure without python.''' In the sphinxbase-0.8 directory:
 
**<code>./autogen.sh --without-python</code>
 
**<code>./autogen.sh --without-python</code>
 +
=Supercollider=
 +
*http://supercollider.github.io/development/building-beagleboneblack.html
  
 
=Audio=
 
=Audio=
Line 140: Line 265:
 
*install python-curses:
 
*install python-curses:
 
**<code>opkg install python-curses</code>
 
**<code>opkg install python-curses</code>
 +
=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:
 +
<syntaxhighlight lang="bash">echo "I didn't realize it could be so fast" > /dev/usb/lp0</syntaxhighlight>
 +
*print to lp from python:
 +
<syntaxhighlight lang="python">lp = open("/dev/lp0","w")
 +
lp.write("Hello World!\n")
 +
lp.close()</syntaxhighlight>
 +
http://rosettacode.org/wiki/Hello_world/Line_printer#Python
 +
==CUPS on beaglebone==
 +
*Install CUPS:
 +
<syntaxhighlight lang="bash">opkg install cups</syntaxhighlight>
 +
*List available printers:
 +
<syntaxhighlight lang="bash">lpinfo -v</syntaxhighlight>
 +
*Add ML320 as new printer:
 +
<syntaxhighlight lang="bash">lpadmin -p ML320 -E -v usb://OKI%20DATA%20CORP/ML320/1TURBO</syntaxhighlight>
 +
*Enable ML320:
 +
<syntaxhighlight lang="bash">cupsenable ML320</syntaxhighlight>
 +
*https://groups.google.com/forum/#!topic/beagleboard/Tn-rQfOdEPg
 +
*https://wiki.archlinux.org/index.php/CUPS_printer-specific_problems
 +
=OSC messaging on the beaglebone=
 +
*http://das.nasophon.de/pyliblo/
 +
*http://liblo.sourceforge.net/
 +
 
=Run a Script on Login (Start a Service)=
 
=Run a Script on Login (Start a Service)=
 +
==Make a Shell Script==
 +
'''launch_mirror.sh''' - launches my python script as detached screen session
 +
<syntaxhighlight lang="bash">
 +
#!/bin/bash
 +
 +
cd /home/root/convexmirror
 +
/usr/bin/screen -dmS mirror /home/root/convexmirror/convex_mirror.py
 +
</syntaxhighlight>
 +
make the scrip user executable
 +
<syntaxhighlight lang="bash">
 +
chmod u+x
 +
</syntaxhighlight>
 +
 +
==Make a Service==
 +
make a service file:
 +
<syntaxhighlight lang="bash">
 +
vi /lib/systemd/system/cvxmirror.service
 +
</syntaxhighlight>
 +
'''cvxmirror.service''':
 +
<syntaxhighlight lang="bash">
 +
[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
 +
</syntaxhighlight>
 +
make links:
 +
<syntaxhighlight lang="bash">
 +
cd /etc/systemd/system/
 +
ln /lib/systemd/system/cvxmirror.service cvxmirror.service
 +
</syntaxhighlight>
 +
make system take notice:
 +
<syntaxhighlight lang="bash">
 +
systemctl daemon-reload
 +
</syntaxhighlight>
 +
start service manually:
 +
<syntaxhighlight lang="bash">
 +
systemctl start cvxmirror.service
 +
</syntaxhighlight>
 +
stop service manually:
 +
<syntaxhighlight lang="bash">
 +
systemctl stop cvxmirror.service
 +
</syntaxhighlight>
 +
enable on startup:
 +
<syntaxhighlight lang="bash">
 +
systemctl enable cvxmirror.service
 +
</syntaxhighlight>
 +
 +
'''Run and don't exit'''
 +
call bash afterwards. it will keep the screen process open
 +
<syntaxhighlight lang="bash">
 +
/usr/bin/screen -dmS printing bash -c '/home/debian/children/okidata_udp_server.py; exec bash'
 +
</syntaxhighlight>
 +
'''Run service on network boot'''
 +
<syntaxhighlight lang="bash">
 +
After=syslog.target network-online.target
 +
</syntaxhighlight>
 +
 +
 +
 
http://www.nunoalves.com/open_source/?p=308
 
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/
 
http://kezhong.wordpress.com/2011/11/19/creating-my-own-systemd-service-files-on-fedora-16x86_64/
 +
 
=Other=
 
=Other=
 
*video on C++ programming with Beaglebone - http://www.youtube.com/watch?feature=endscreen&NR=1&v=vFv_-ykLppo
 
*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
 
*Contest. Win 2 free beagleboards - http://elinux.org/BeagleBoard/contest

Latest revision as of 22:46, 1 December 2015

<<< back to Wiki Home

Setup

Change Hostname

sudo vi /etc/hostname
sudo vi /etc/hosts

Add public key

cat ~/.ssh/id_rsa.pub | ssh debian@beaglebone1.local "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

Debloat

http://kacangbawang.com/beagleboneblack-revc-debloat-part-1/

Install devmem2

https://scivision.co/devmem2-on-the-beaglebone-black/

Install Adafruit BBBIO

https://github.com/adafruit/adafruit-beaglebone-io-python ==Install

Textmate and rmate for simple remote editing

  • install textmate on os x system
  • install ruby on beaglebone:
opkg install ruby
  • install rmate on beaglebonei:
gem install rmate
  • setup ssh tunneling
ssh -R 52698:localhost:52698 pi@192.168.2.144

Disable default services

systemctl disable bone101 
systemctl disable cloud9         
systemctl disable gateone

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.

Edimax WiFi fix

for debian 3.8.13-bone70

Basically, disable HDMI output.

likely due to HDMI interference. alternately, use a usb extension cable :)

  • boot wifi
sudo ifup wlan0

if it works...

sudo ifup wlan0
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/80:1f:02:bf:23:52
Sending on   LPF/wlan0/80:1f:02:bf:23:52
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 10.1.10.1
DHCPACK from 10.1.10.1
bound to 10.1.10.121 -- renewal in 4605 seconds.
  • iwconfig
    

What Kernel am I running

  • uname -a

other

Debugging

Find Beaglebone on Local Network

  • MAC Address: C8:A0:30:AB:71:1D (Texas Instruments)

Nmap scan report for 192.168.2.31

    • Scan for BBB:
sudo nmap -sP 192.168.2.* | awk '/^Nmap/{ip=$NF}/C8:A0:30/{print ip}'

TTL Cable

954bbb_LRG.jpg

(RED IS NOT CONNECTED)

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
./configure
make
make install

Onboard LEDs

GPIO

PyBBIO

other

gpio - http://beaglebone.cameon.net/home/using-the-gpios

Hardware

Rechargeable LiPo

http://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone/blog/2013/08/10/bbb--rechargeable-on-board-battery-system

Real Time Clock (RTC)

IMGP9616-600x600.jpg

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
from here

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

dash cam

Servo

Serial Communication

Ubuntu

Angstrom

  • update opkg:
    • opkg update
  • install pyserial:
    • opkg install python-pyserial

Pockesphinx

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

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

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/system/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

Run and don't exit call bash afterwards. it will keep the screen process open

/usr/bin/screen -dmS printing bash -c '/home/debian/children/okidata_udp_server.py; exec bash'

Run service on network boot

After=syslog.target network-online.target


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