Beaglebone: Difference between revisions
Line 52: | Line 52: | ||
* There is a version dated 2013.09.12 at http://downloads.angstrom-distribution.org/demo/beaglebone/ as the instruction from http://www.height8.com/info/devel/hardware/beagleboneblack/macupdateangstrom | * There is a version dated 2013.09.12 at http://downloads.angstrom-distribution.org/demo/beaglebone/ as the instruction from http://www.height8.com/info/devel/hardware/beagleboneblack/macupdateangstrom | ||
# Umount the uSD card | # Umount the uSD card <pre> | ||
<pre> | |||
mount # find /dev/sdc1 | mount # find /dev/sdc1 | ||
sudo diskfutil unmount /dev/sdc1 | sudo diskfutil unmount /dev/sdc1 | ||
ls *.xz | ls *.xz | ||
</pre> | </pre> | ||
# Copy img file to microSD card. Took about 15-30 minutes. | # Copy img file to microSD card. Took about 15-30 minutes. | ||
<pre> | <pre> | ||
Line 70: | Line 68: | ||
# remove the microSD card and insert it fully into BBB uSD card slot. | # remove the microSD card and insert it fully into BBB uSD card slot. | ||
</pre> | </pre> | ||
# Flash the BBB | |||
Flash the BBB | |||
Hold down the 'user boot' button (closes to uSD card slot) and power on BBB until the 4 LED's light up for a few seconds. | Hold down the 'user boot' button (closes to uSD card slot) and power on BBB until the 4 LED's light up for a few seconds. |
Revision as of 17:11, 27 November 2013
Basic
Wiki
- http://elinux.org/BeagleBone
- ARM architecture from wikipedia.
- Downloading images and instruction from www.armhf.com
- Adafruit learning which includes flashing eMMC and other stuff.
- http://eewiki.net/display/linuxonarm/BeagleBone+Black covers a lot about BBB.
- http://hipstercircuits.com/category/beaglebone/
Ubuntu
- Image (~70MB) download http://www.armhf.com/index.php/download/ and how to write the image to microSD card , boot from microSD and then the internal eMMC under Ubuntu/Debian.
- wget the image
- Use sudo su instead su to have full root permission. Use xz command to write the image to microSD
- Insert microSD to BBB and holding the button (closest to microSD) while applying power on BBB
- To copy the image to eMMC, use wget again to get the image file. Use sudo su instead su to have full root permission. Then use xz command again to write the image to eMMC.
- Remove microSD and reboot BBB. If we keep microSD in BBB, it will boot from microSD. MicroSD has the advantage that we can extend the space while eMMC cannot.
- At the beginning, the "/" partition still has 1.4GB space (see table below). If we boot into microSD and follow the instruction to expand the microSD file system, we can make use whole space in uSD.
root@ubuntu-armhf:/home/ubuntu# df -h Filesystem Size Used Avail Use% Mounted on rootfs 1.8G 295M 1.4G 18% / /dev/root 1.8G 295M 1.4G 18% / devtmpfs 248M 4.0K 248M 1% /dev none 4.0K 0 4.0K 0% /sys/fs/cgroup none 50M 232K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 1004K 466K 538K 47% /boot/uboot
- Kernel is 3.8.
- The image contains a miniminal Ubuntu system. It only takes 276 MB when I use df -h command to check. So it does not come with a full desktop.
- Defautl username=ubuntu, password=ubuntu
- http://robotic-controls.com/learn/beaglebone/beaglebone-black-ubuntu
- If I try to install xubuntu-desktop, it requires 421MB data to download and 1.2GB space to install. So it is not feasible since the /dev/mmcblk0p2 partition has only 1.8GB space. Fortunately, the solution in here works well.
- Unfortunately, I got an error when I issue 'startx'.
Fatal server error: AddScreen/ScreenInit failed for driver 0 Please check the log file at "/var/log/Xorg.0.log" for additional informaiton.
After I reboot, things looks better. I can get a login GUI. However, the system is very slow and I can not see mouse on the desktop.
- http://fleshandmachines.wordpress.com/2013/09/08/beaglebone-black-debian-and-x11/#more-1250 is another instruction teaching how to install Debian and lxde desktop (Lubuntu used starlxde and if we install xface such as xubuntu we should use sudo startxfce4). It also shows how to access debian from remote connection.
Angstrom
- Download Angstrom image from http://beagleboard.org/latest-images
- I pick 2GB eMMC version for Beaglebone Black
- https://s3.amazonaws.com/angstrom/demo/beaglebone/BBB-eMMC-flasher-2013.06.20.img.xz
- There is a version dated 2013.09.12 at http://downloads.angstrom-distribution.org/demo/beaglebone/ as the instruction from http://www.height8.com/info/devel/hardware/beagleboneblack/macupdateangstrom
- Umount the uSD card
mount # find /dev/sdc1 sudo diskfutil unmount /dev/sdc1 ls *.xz
- Copy img file to microSD card. Took about 15-30 minutes.
# Method 1. tar -xJf BBB-eMMC-flasher-2013.06.20.img.xz sudo dd bx=1m if=~/Downloads/BBB-eMMC-flasher-2013.06.20.img of=/dev/sdc sudo sync # Method 2. xz -cd BBB-eMMC-flasher-2013.06.20.img.xz > /dev/sdc # remove the microSD card and insert it fully into BBB uSD card slot.
- Flash the BBB
Hold down the 'user boot' button (closes to uSD card slot) and power on BBB until the 4 LED's light up for a few seconds. It will take 30-45 minutes to flash the image onto the eMMC. Once it's done, the 4 LED's will all stay lit up at the same time. You can then power down your BBB, remove uSD and power up BBB.
microHDMI to VGA cable
http://circuitco.com/support/index.php?title=BeagleBone_Black_Accessories
Question: How to create EDIT? My NEC monitor supports only 1024 x 768.
Beagleboneblack HDMI page from circuitco.com.
My Observation about angstrom distribution
When I use the image BBB-eMMC-flasher-2013.06.20.img to put it on the microSD card with win32DiskImager, I see (from plugging SD in Ubuntu) the microSD card has 2 partitions
eMMC-Flasher -ext4 BEAGLE_BONE - vfat
where eMMC-Flasher contains an ubuntu data and BEAGLE_BONE contains only 4 files.
ID.txt - just one line MLO - 98K binary u-boot.img - 371K binary uEnv.txt - just one line
Flashing is done by pressing the 'Boot' button while connecting the power. It took 1 hour in my case when I flashed BBB-eMMC-flasher-2013.06.20.img.
However, once the microSD is flashed to eMMC, the 'eMMC-Flasher' partition will be gone and 'BEAGLE_BONE' partition is changed to include 3 new folders- App, Docs and Drivers AND some new files - START.htm, autorun.inf, README.md.
Android OS
http://icculus.org/~hendersa/android/
Books
- Bad to the Bone: Crafting Electronics Systems with Beaglebone and BeagleBone Black
- Getting Started with BeagleBone: Linux-Powered Electronic Projects With Python and JavaScript
BBB vs Raspberry Pi
- http://makezine.com/magazine/how-to-choose-the-right-platform-raspberry-pi-or-beaglebone-black/
- http://www.doctormonk.com/2013/07/raspberry-pi-vs-beaglebone-black.html
Beaglebone 101
My created screenshots http://goo.gl/o03iex
Configure Angstrom
http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/
Package download
opkg update opkg install XXXX opkg list | grep "gfortran"
However, at least for BBB case, I cannot find gfortran package so I cannot install R. See discussions below
The angstrom linux package browser is the place we can see if packages for BBB Cortex-A8. According to Wikipedia the Cortex-A8 has armv7a architecture.
On ubuntu, we can use ldconfig -v command to show the installed libraries and their versions. See here. If we like to manually add libraries to ubuntu/debian, we can check the tip here.
Ubuntu
Find out the IP address if we use internet sharing
Download fing deb package from overlooksoft website. Install it by double clicking the file in file manager. Issue the following command to find out the IP of beaglebone black (shared computer). The IP of my 2nd ethernet adapter (eth1) is 10.42.0.1.
sudo fing -n 10.42.0.1/24
Wifi setup command line
- https://wiki.debian.org/WiFi/HowToUse#Command_Line
- http://embeddedprogrammer.blogspot.com/2013/01/beaglebone-using-usb-wifi-dongle-to.html (it is worthy to mention the tutorial uses USB emulated serial connection ONCE all required software are installed. Similar tech was also used in Raspberry Pi). The Adafruit website also teaches us how to use the USB cable provided by BBB to do an ad-hoc SSH connection. However, the BBB differ from BB by several factors, including removal of USB-to-serial interface; see here
dmesg | grep rtl8192 ifconfig wlan0 sudo apt-get install wireless-tools iwconfig sudo nano /etc/network/interface # Made appropriate change on /etc/network/interface sudo ifup wlan0 // not needed if we have enable wlan0 at boot. // sudo ifconfig wlan0 up sudo iwlist wlan0 scanning ping www.google.com
where the file /etc/network/interface should be like
auto wlan0 iface wlan0 inet dhcp wpa-ssid mynetworkname wpa-psk mysecretpassphrase
Fix date/time
See here. Run the following to change the country and time zone.
sudo dpkg-reconfigure tzdata
VNC
opkg update opkg install x11vnc x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever
Start VNC server at bootup and shutdown
- https://lists.fedoraproject.org/pipermail/devel/2011-July/154611.html
- https://wiki.archlinux.org/index.php/Vncserver
Use microSD as ext storage
It is possible. See the idea in here.
Build R on BBB
I am using Ubuntu 13.04 image since angstrom linux missing many required packages.
Since the space is limited, instead of using 'sudo apt-get build-dep r-base', I manually install the essential packages: build-essential, gfortran, libreadline6-dev, libx11-dev, libxt-dev and optionally openjrk-7-jre.
I am using R 3.0.1.
ubuntu@ubuntu-armhf:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p2 1.8G 276M 1.4G 17% / none 4.0K 0 4.0K 0% /sys/fs/cgroup devtmpfs 248M 4.0K 248M 1% /dev none 50M 220K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 1004K 472K 532K 48% /boot/uboot sudo apt-get update sudo apt-get install build-essential sudo apt-get install gfortran sudo apt-get install libreadline6-dev sudo apt-get install libx11-dev sudo apt-get install libxt-dev sudo apt-get install openjdk-7-jre // (optional) need it if we don't want to get an error message at the end of running 'make' // This require 143MB space. // The whole process (configure + make) takes at least 2 hours on BBB ./configure make // make > ~/Rmake.txt 2>&1 There is still warnings with library/datasets http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695411 It seems this is false alarm. ubuntu@ubuntu-armhf:~/R-3.0.1$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p2 1.8G 1.1G 615M 64% / none 4.0K 0 4.0K 0% /sys/fs/cgroup devtmpfs 248M 4.0K 248M 1% /dev none 50M 224K 50M 1% /run none 5.0M 0 5.0M 0% /run/lock none 248M 0 248M 0% /run/shm none 100M 0 100M 0% /run/user /dev/mmcblk0p1 1004K 472K 532K 48% /boot/uboot
The complete process of running ./configure and make are recorded in
- ./configure Beaglebone and x86_64 box
- make Beaglebone and x86_64 box
Performance test
GPIO Projects
Setting up an IO python library (GPIO, PWM, ADC, I2C, SPI, UART)
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black
- PWM: P8_13, P8_34, P8_36, P8_45, P8_46, P9_14, P9_21, P9_22, P9_29, P9_42. Eg. blink LED, fading LED, servo.
- ADC: P9_33, P9_35, P9_36, P9_37, P9_38, P9_39, P9_40. Eg. measure light, ultrasonic sensor, accelerometer, joystick, Potentiometer.
- I2C: P9_19, PI_20. Eg. temperature/pressure sensors.
- SPI: P9_17, P9_18, P9_21, P9_22, P9_28, P9_29, P9_30, P9_31.
- UART: 17 pins.
Adding a push button
http://learn.adafruit.com/connecting-a-push-button-to-beaglebone-black
Measure light
http://learn.adafruit.com/measuring-light-with-a-beaglebone-black My example:
import Adafruit_BBIO.ADC as ADC import time from time import localtime, strftime sensor_pin = 'P9_40' ADC.setup() #print('Reading\t\tVolts') print time.asctime(time.localtime(time.time())), '\tReading\t\tVolts' while True: reading = ADC.read(sensor_pin) volts = reading * 1.800 #print('%f\t%f' % (reading, volts)) #print(strftime("%Y-%m-%d %H:%M:%S", localtime())) print time.asctime(time.localtime(time.time())), '\t%f\t%f' % (reading, volts) time.sleep(60)
which can be run (and the output was written to a file for logging)
sudo python light.py > tmp.txt
If we want, we can follow the tutorial in here to have the light reading logged on the COMS or send to google docs like [1]. Alternatively, we can let BBB to send an email to you like here.
Fading RGB using PWM
http://learn.adafruit.com/fading-a-rgb-led-on-beaglebone-black/overview
Blinking an LED
http://learn.adafruit.com/blinking-an-led-with-beaglebone-black
Controlling a servo
We can actually try the following simpler approach using bonescript without bothering a command line. Just open a browser tab and type the address http://beagleboard.org/Support/BoneScript/ServoMotor/. It just works! The SG90 micro motor operators at 4.0 to 7.2 volts according to here.
Measuring temperature
http://learn.adafruit.com/measuring-temperature-with-a-beaglebone-black
HC-SR04 (5v) sonar sensor
http://www.youtube.com/watch?v=bssyOCcU_Q4
Connect to 5v device
See 3.2.4 of the book "Bad to the Bone".
- Logic level
- BOB-08745 logic level shifter and BOB-11978 with a tutorial example and a hook up diagram.
- http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/
Input voltage & voltage divider
http://beagleboard.org/Support/BoneScript/accelerometer/
PIR motion sensor (ADC)
http://beagleboard.org/Support/BoneScript/PIRMotionSensor