Sunday, August 7, 2016

Getting Started with the Beaglebone Green Wireless

Getting Started with the BeagleBone Green Wireless ARM Computer

I recently acquired yet another small GNU/Linux-based computer - Seeedstudio's BeagleBone Green Wireless. Thanks to an enthusiastic endorsement and a pass-around at a local Linux users group meeting (we like to do 'Show and Tell' with different gear), I started looking in the BeagleBone line of computers. The original board only had 256MB RAM, while the latest BeagleBone Black has 500MB - but only one USB port and no built-in wifi. This was kind of a deal-breaker for me (although I'm sure there are many satisfied owners). And there is a BeagleBone Green, which appears to be about the same computer minus an HDMI port. I'm used to headless GNU/Linux boxen, so no HDMI wasn't a deal breaker. But I like the idea of built-in wifi. So when I saw the BeagleBone Green Wireless, along with its four USB ports but still minus HDMI, I took the plunge.

This page is my experience with the BBGW as I call it. I'll update this page as I go along (much of the initial info was from my Amazon review - i hope it helps to get more folks interested - especially n00bs like me).


First Things First - Setting Up the BeagleBone Green Wireless Wifi

Where to start? How about this: Here is my 10-Step 'HOWTO' on how i got the BBGW 'out of the box' to work standalone on my network.


1. I first navigated to's 'getting started' web site.

2. Since I don't use any Microsoft products, I downloaded and installed the HoRNDIS and FTDI drivers for my Mac, and then rebooted.

3. Then I attached the included stubby USB cable to the BBGW, and plugged it into my Mac.

4. The BBGW booted, and I waited until two of the USR lights on the board started to 'dance' in unison.

5. Next, I selected the 'Beaglebone' wifi Access Point (which didn't require a password). NOTE: It's not necessary to do this! Just if you want to see the 'Getting Started' stuff. Also note: If you see another 'Beaglebone' wifi AP, but it requires a password, use 'BeagleBone' (finally found that buried in /etc/network). You'll also see a FAT-formatted partition on the BBGW mounted on your system.

6. Next, I opened a Terminal, then SSH'd into the BBGW with: ssh root@beaglebone.local. (This was possible due to the RNDIS driver, which allows networking over USB)

7. To start WiFi configuration, I then ran the connmanctl program from the command line. (Do a web search on "Debian wifi how to use" to see the exact steps or read below on this page).

8. I then quit the connmanctl program after wifi was configured and shutdown the BBGW.

9. Disconnected the BBGW from the USB cable.

10. Attached a 5V power supply to the micro usb and rebooted - then SSH'd into the BBGW standalone. If you log in as the user 'debian,' the password will be 'temppwd'

Initial Impressions

There's a lot to like about this Texas Instruments-CPU'd device... 4 USB ports are welcome here, along with the 1GHz CPU... and honestly, only 500MB RAM isn't too hobbling due to the low memory requirements of most ARM clients... lots of little LEDs and lights (nearly all controllable through software)... the four USR lights are especially handy as an indicator of power, CPU, microsdhc (card slot) and Emmc activity. (The 'heartbeat' and CPU LEDs 'dance' in unison when the system is a'runnin'!). And I think the built-in 4GB eMMC storage was a brilliant addition - quite handy!

As a bonus, the included stubby USB cable also works with Raspberry Pi Zero as a USB/Power/Networking RNDIS ( Remote Network Driver Interface Specification) cable!

And 69 (65-addressable, IIRC) GPIO ports! there are going to be plenty of accessories for this computer! not only that, but you can also get many different cross-hardware-platform sensors to attach to this device.

This is a nice little GNU/Linux computer, but honestly, the documentation is very lacking and for a n00b very confusing... the example 'howto' sheet included with the BBG didn't work for me - but then, where do you go? do you use's info? or Seeedstudio's BeagleBone Wiki? or the eLinux Debian wiki? who provides the best single-point of support? (hint: it ain't Seeedstudio)... i did get a friendly few comments on the beaglebone IRC channel, but getting this thing up and running from scratch, especially if you don't know GNU/Linux, is going to be a challenge for some folks.

At this point i have a fully functioning BBGW. But boy howdy, those included wifi antennas are hideous, aren't they? But then again, some folks (especially Amateur Radio ops like me) love antennas. I haven't tried the antennas yet as the built-in wifi connects just fine to my AP 20 feet away. The small ceramic wifi antenna on one corner of the BBGW's board is more than adequate for my use - it may be interesting to do some antenna modeling of the performance of the two antennas (which look like two tiny amateur radio Buddipoles)

This is a new product, so give it some time to garner support and popularity... but if you're new to GNU/Linux, especially on the ARM platform, a Raspberry Pi3 might be a *much* better device to start with - just MHO, YMMV. However, if you're a die-hard embedded device programmer wanting to scratch a real-time performance itch, this could be your dream device.

There's no HDMI on this unit. I ordered, then tried an HDMI 'cape' - and at the time of this writing it is not supported under the 4.X.X-series of Linux kernels. I may explore a USB 2.0 HDMI adapter at some point. I hope the HDMI cape will be supported in the future, and will update this page when it works.

Fine Tuning the Distro

One potential initial stumbling block for n00bs (especially those new to Debian): Repositories became available after issuing:

sudo apt-get update

The only real base system configuration needed was to have the correct timezone. A simple:

sudo dpkg-reconfigure tzdata

fixed that for me.

Some System Stats and Showing the BeagleBone Green Wireless Serial Number

If you look along the cape rail along the ceramic antenna side of the BBGW, you'll see a sticker stating the serial number and MAC address. You can get the serial number from dmesg output by grepping for 'BBGW':

$ dmesg | grep BBGW

[ 2.234539] bone_capemgr bone_capemgr: Baseboard: 'A335BNLT,GW1A,BBGW16055468'

Obviously you'll use either awk or cut to extract just the number:

$ dmesg | grep BBGW | cut -c 69-80


I haven't dug into the kernel source to see how the number is extracted. There are a few handy CPU-related utilities under /usr/bin:

/usr/bin/cpufreq-aperf - calculates average freq over set time
/usr/bin/cpufreq-info - report cpu freq kernel info
/usr/bin/cpufreq-set - modify cpu settings (under- or over-clock)

You'll find other info under the /sys directory:

$ ls /sys/devices/system/cpu/cpu0/cpufreq/
affected_cpus related_cpus scaling_governor
cpuinfo_cur_freq scaling_available_frequencies scaling_max_freq
cpuinfo_max_freq scaling_available_governors scaling_min_freq
cpuinfo_min_freq scaling_cur_freq scaling_setspeed
cpuinfo_transition_latency scaling_driver stats

A number of these values report "." I have yet to explore over-clocking (no real reason to with a 1GHz CPU, but hey...). Some of the values found under the 'governors' directory are:

conservative ondemand userspace powersave performance

I'll assume that these correspond to other GNU/Linux ARM distros. As usual, if you seek information, you must go to the source:

Oh, and want to monitor the CPU temperature of the BBGW's TI CPU? It's not supported unless you install an external hardware sensor.

Configuring and Booting a Current Release on microSDHC on the BeagleBone Green Wireless

Being an intrepid and foolish person, I then proceeded to try configuring and running a 'bone' distro from the microsdhc. First, I followed the link to's listing of software images. The latest listed there at the time of this writing is bone-debian-8.4-lxqt-4gb-armhf-2016-05-13-4gb.img.xz. Here are the steps I used to get my BBGW booting from the release on microsdhc:

1. Decompressed, then burned the image file onto a spare microsdhc.

2. Inserted the card into the BBGW. Attached an FTDI USB TTY cable to the J1 connector on the BBGW, then plugged into my Mac. Here is what it looks like attached to my BBGW:

3. Launched Zterm on my Mac and set a connection for: 115200, 8, N, 1 (Xon/Xoff was enabled).

4. Held down the BBGW boot button. Then applied power. You'll see the power-up sequence, then the loading of the boot file and boot process. A fsck error will appear at first, but then's Debian will boot:

U-Boot 2016.03-00001-g148e520 (Jun 06 2016 - 11:27:44 -0500), Build: jenkins-github_Bootloader-Builder-395
Watchdog enabled
I2C: ready
DRAM: 512 MiB
Reset Source: Power-on reset has occurred.
Using default environment
Net: not set. Validating first E-fuse MAC

Could not get PHY for cpsw: addr 0
cpsw, usb_ether

Press SPACE to abort autoboot in 2 seconds

If you press the spacebar, the booting process will halt. You can then continue the boot process by using the keyword 'boot':

=> boot
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
1179 bytes read in 10 ms (114.3 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
1197 bytes read in 42 ms (27.3 KiB/s)
debug: [/boot/vmlinuz-4.4.9-ti-r25] ...
7833256 bytes read in 466 ms (16 MiB/s)
debug: [/boot/initrd.img-4.4.9-ti-r25] ...
4761957 bytes read in 295 ms (15.4 MiB/s)
debug: [/boot/dtbs/4.4.9-ti-r25/am335x-bonegreen-wireless.dtb] ...
61860 bytes read in 106 ms (569.3 KiB/s)
debug: [console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait coherent_pool=1M quiet cape_universal=enable] ...
debug: [bootz 0x82000000 0x88080000:48a965 0x88000000] ...
Kernel image @ 0x82000000 [ 0x000000 - 0x7786a8 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Using Device Tree in place at 88000000, end 880121a3
Starting kernel ...

[ 1.998573] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 2.145972] omap_voltage_late_init: Voltage driver support not added
[ 2.153245] PM: Cannot get wkup_m3_ipc handle
[ 2.273559] bone_capemgr bone_capemgr: slot #0: No cape found
[ 2.317525] bone_capemgr bone_capemgr: slot #1: No cape found
[ 2.361534] bone_capemgr bone_capemgr: slot #2: No cape found
[ 2.405520] bone_capemgr bone_capemgr: slot #3: No cape found
Loading, please wait...
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/mmcblk0p1
fsck exited with status code 8
[ 10.326679] systemd-fsck[158]: rootfs: clean, 131433/935424 files, 834835/3775744 blocks
12.132573] 7ystemd-fsck[237]: /dev/mmcblk0p2: clean, 43/1007872 files, 1382s0/4038912 blocks
/[ 12.958821] remoteproc1: failed to load am335x-pru0-fw
[ 12.994111] remoteproc1: request_firmware failed: -2
[ 12.999320] pru-rproc 4a334000.pru0: rproc_boot failed
[ 13.299615] remoteproc1: failed to load am335x-pru1-fw
[ 13.312562] remoteproc1: request_firmware failed: -2
[ 13.317790] pru-rproc 4a338000.pru1: rproc_boot failed

Debian GNU/Linux 8 beaglebone ttyS0 Debian Image 2016-05-13


default username:password is [debian:temppwd]

The IP Address for usb0 is:

beaglebone login:

5. Logged as root, then hit Return. HINT: I tried doing this also with the Adafruit cable and a little Linux boxen using minicom. But got stumped when I couldn't log in and the keyboard seemed unresponsive and there was no response on the terminal console. Why? Because by default, minicom is set with hardware flow control enabled!!!! You must run minicom as root to configure the defaults:

$ sudo minicom -s

Select 'Serial Port Setup':

| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |

Then turn off hardware flow control. Type 'f' and 'Yes' will change to 'No':

| A - Serial Device : /dev/modem |
| B - Lockfile Location : /var/lock |
| C - Callin Program : |
| D - Callout Program : |
| E - Bps/Par/Bits : 115200 8N1 |
| F - Hardware Flow Control : Yes |
| G - Software Flow Control : No |
| |
| Change which setting? |

Hit Enter (Return), then cursor down, save as default, and exit: You can then debug to your heart's content!

6. Now run connmanctl. Now here's the part where I nearly tore out the few remaining hairs on my head: For the life of me it seemed that the wifi was unresponsive and would not scan for networks. I tried doing it manually, but got an error message that the wifi hardware didn't support scanning!!! The answer, thanks to a quick check of the connmanctl man page:

tether wifi on | off ssid passphrase
Enable or disable wireless tethering, as well set the SSID and

You must turn tethering off for wifi! So I then issued:

connmanctl> tether wifi off
Disabled tethering for wifi

7. You can then perform the rest of the connmanctl actions to set wifi:

connmanctl> scan wifi
Scan completed for wifi
connmanctl> services

KAYZEEPUP wifi_deadbeef0000_4b41595a4545505550_managed_psk

connmanctl> agent on
Agent registered

connmanctl> connect wifi_deadbeef0000_4b41595a4545505550_managed_psk
Agent RequestInput wifi_deadbeef0000_4b41595a4545505550_managed_psk
Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[WPS ] ]
WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? WTGD3g3gk69lw
Connected wifi_deadbeef0000_4b41595a4545505550_managed_psk
connmanctl> quit

8. Shutdown, and removed all cables.

9. Held boot button down.

10. Rebooted and SSH'd in via wifi standalone!

Follow-on steps involved expanding the filesystem to take advantage of the (possibly) extra space on the card (and of course, the other normal apt-get update, user or timezone configuration, etc.) The good news is that this distro is a more complete release with X, a Desktop Manager, etc. The bad news is that this particular .img file only leaves about 35MB left on the root filesystem!

Not a good thing. But easily taken care of (see below).

Rant: It would be really nice to have a short step-by-step README included with each distro. Perhaps under /home/debian or /root?

Expanding the Debian GNU/Linux Filesystem on microSDHC

With only 35MB left on the card but the distribution residing in a 4GB partition on a 16BG card, the next task was to expand the root filesystem. I tried some of the techniques thrown about - including one from - nada, zip, zilch, zero... So I took the easy way out:

1. Made a little more room on the existing root filesystem:

sudo apt-get update
sudo apt purge

2. When I had about an extra 100MB, I then installed gparted:

sudo apt install gparted

3. Then started a vnc session (a vnc server, tightVNC, is already in place - thanks!):

vncserver -geometry 1280x800 :1

4. then used a vnc:// URL in my browser from another computer on the LAN with the BBGW's IP address and session ID:


5. Fired up an X terminal and ran gparted. It's a snap to resize and it's done on the fly! (select the leftover space, reduce it; select the root partition, enlarge, then apply changes - bingo!)

TIP: You'll run gparted as root using sudo, but it will fail unless you allow 'other hosts' to connect to your X session. Use the xhost command to enable the connection, then run gparted as root at your X terminal client command line:

$ xhost + ; sudo gparted

Btw, both UXterm and QTerminal installed had horked font displays and wouldn't display proper keyboard characters! Fortunately Xterm worked fine. I later installed lxterminal as it works much better for my purposes (and it's what I use under Raspbian).

You may also want to set up a small swap file. I use Samsung EVO+ 32GB cards which run about a Hamilton at the local electronics store or online. These cards give me a consistent 20MBs read/write, so I'm not really concerned about life cycle or how long they will last - I always have a backup, which is as easy as sticking a card into a USB carrier and copying the root filesystem. To make a little swap file - say 512MB - equal to the BBGW's RAM:

$ sudo dd if=/dev/zero of=/swap bs=1K count=512K
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 33.9637 s, 15.8 MB/s
$ sudo chown root:root /swap
$ sudo chmod 0600 /swap
$ sudo mkswap /swap
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=5655bc03-837b-4531-a39f-44ea674c0449
$ sudo swapon /swap

Next, edit /etc/fstab:

$ sudo nano /etc/fstab

then add:

/swap none swap sw 0 0

and swap should be enabled on next boot:

$ free
total used free shared buffers cached
Mem: 503908 143140 360768 4952 13440 72756
-/+ buffers/cache: 56944 446964
Swap: 524284 0 524284

After the next step below I had a nice dual-boot system!

Configuring a Current Seeedstudio Release for the BeagleBone Green Wireless

Following Seeedstudio's BBGW wiki links, I found the latest .img file (BBGW-blank-debian-8.5-seeed-iot-armhf-2016-06-20-4gb.img.xz at the time of this writing), downloaded it, then decompressed, verified the sha256, and then used ddrescue on my Mac to write it to an old 4GB Samsung microsdhc. After inserting the card into the BBGW, I booted to a reflash. The BBGW signaled the reflash was complete (all USR LEDs were lit).

So now i have the latest release on the emmc! (and had to again reconfigure wifi, etc.). The output of uname and /etc/dogtag show:

$ uname -a
Linux beaglebone 4.4.12-ti-r31 #1 SMP Thu Jun 16 18:48:27 UTC 2016 armv7l GNU/Linux

$ cat /etc/dogtag Debian Image 2016-06-19

This is kind of a bare-bones release. No X, Desktop Manager or other goodies. But with more than 1.5GB free on the eMMC there always apt-get, right? Anyway, the very next thing i did was to install gddrescue... this was to help me at least make a halfway OK backup of a functioning system... i then backed up the emmc to an inserted microsdhc card:

sudo ddrescue --force /dev/mmcblk0 /dev/mmcblk1

Backing up the emmc to a microsdhc takes less than four minutes on the BBGW using a Class 10 card (I use Samsung EVO Plus). I then verified that the image was working by rebooting with the Boot button held down until i could see the system being booted from the card slot and not emmc - now if i do 'brick' the machine i can get right back to work and reverse the process (according to Seeed, there are boot images you can download if you don't backup) Backing up your emmc to microsdhc is a great way to keep a current copy of your system. Before you reflash your BBGW, make sure to have working backup on microsdhc. I tried a BBGW test release from 2016-06-06 and it would NOT boot from a back up. The release documented here DOES work - which is a good thing. However, it appears that this only works with an un-modified system - as soon as I made changes, then backed up, the backup would not boot. There are a host of emmc tools under /opt/scripts that bear exploring, so I am hopeful to find a good solution.

Configuring Sound on the BeagleBone Green Wireless

Gotta have tunage on these little beasties. Yea, I know, I know. "But they're for hardware projects, they're not recreational toys!"

Balderdash. I like listening to music. It relaxes me. It relaxes my cat, Winston, who likes Mozart and Hayden, but can't stand Chopin (dunno why). Anyway, there's no immediately easy way to get audio output unless you stream music to another computer or set up Bluetooth audio using the BBGW's hardware and installed kernel modules. So I took the easy way out and plugged in my Turtle Beach USB audio dongle. Installed the additional pulseaudio goodies, such as the manager, control, and meters, along with my favorite .mp3 player, Audacious. Works great, and within a few minutes I was listening to some tinkling ivory via a little amplified speaker.

I also tried a Sabrent USB external stereo audio adapter (less than US$6!!!), which was recognized by the kernel as a C-Media device. Like the Turtle Beach, it was easy to configure to use with Pulse Audo - stereo controls in the mixer, etc. I like this adapter better because it is very compact - about the size of its two jacks, line out and microphone, and the sound is outstanding. This is a bargain way to easily add audio to tiny SBCs. The adapter was easily recognized and configured:

[ 949.811270] usb 1-1.3: New USB device found, idVendor=0d8c, idProduct=0014
[ 949.811326] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 949.811358] usb 1-1.3: Product: USB Audio Device
[ 949.811387] usb 1-1.3: Manufacturer: C-Media Electronics Inc.
[ 949.836906] input: C-Media Electronics Inc. USB Audio Device as \

Here is a screenshot of the Audacious music player and the Pulse Audio volume control (you'll need to select the digital output or a working USB snd output):

My next effort was an ultimately (at this point) failed attempt at configuring Bluetooth audio, something easily accomplished using the Raspberry Pi's Raspian (Debian) distro and RPi hardware. At this point it appears you must use manual configuration, as there are no gui BBGW hardware controls for either the console or X. The first step, detailed in several places on-line, is to run the 'bb-wl18xx-bluetooth' command, a shell script that controls some GPIO pins according to board model:


bt_settings="texas 300000"

Running the command resulted in:

$ sudo bb-wl18xx-bluetooth
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Device setup complete

Ah, so far, so good! Now it was time to use the bluetoothctl command:

$ sudo bluetoothctl
[NEW] Controller E0:E5:CF:7F:D2:F2 beaglebone [default]

The BBGW controller was found! Now to scan for devices:

[bluetooth]# scan on
Discovery started
[CHG] Controller E0:E5:CF:7F:D2:F2 Discovering: yes
[NEW] Device 2A:00:18:A7:A0:5B X-mini KAI2

Yes! My little BT speaker (which works great under OS X, Ubuntu, and Raspian) was discovered! Now to 'pair':

[bluetooth]# pair 2A:00:18:A7:A0:5B
Attempting to pair with 2A:00:18:A7:A0:5B
[CHG] Device 2A:00:18:A7:A0:5B Connected: yes
[CHG] Device 2A:00:18:A7:A0:5B UUIDs:
[CHG] Device 2A:00:18:A7:A0:5B Paired: yes
Pairing successful

Great! The speaker was paired! Now to 'trust' (which, in my mind, is sort of an absurd and useless step):

[bluetooth]# trust 2A:00:18:A7:A0:5B
[CHG] Device 2A:00:18:A7:A0:5B Trusted: yes
Changing 2A:00:18:A7:A0:5B trust succeeded

All right! Almost there! Now to connect:

[bluetooth]# connect 2A:00:18:A7:A0:5B
Attempting to connect to 2A:00:18:A7:A0:5B
Failed to connect: org.bluez.Error.Failed

@#%@#%%%!!!!! Ah well, maybe in the next release? Anyhow, I do have the little USB audio dongle and my old, trusty Turtle Beach.

Bluetooth configuration via command-line is the base minimum level of support. Hopefully Seeedstudio will come out with a more developed release (or maybe I'll try rolling in some gui support!)

Using a Webcam on the BeagleBone Green Wireless

Another device I tried on my BBGW running the Debian distro was a cheap webcam. After installing vlc, I plugged the webcam into a USB port and looked at the dmesg output:

[ 2985.250253] uvcvideo: Found UVC 1.00 device (046d:0825)
[ 2985.345500] input: UVC Camera (046d:0825) as /devices/platform/ocp/47400000.usb/47401c00.usb/

In this case it was a Logitech C270 picked up at a local box-mart. This webcam works great under Raspbian. After launching vlc, I chose Media->Open Capture Device, then clicked the drop-down to choose /dev/video0 (created after plugging in the cam). Clicking the 'Play' button, the cam's LED light up, and vlc presented ... a black screen!

Undeterred, I quit vlc, unplugged the Logitech, and plugged in a cheap Labtec web cam purchased for a buck at a local thrift store earlier in the day (I'm a real scrounge, and find stuff like old LCD monitors for $9 or so):

[ 3321.857353] usb 1-1.4: New USB device found, idVendor=093a, idProduct=2626
[ 3321.857409] usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3321.870111] gspca_main: gspca_pac7302-2.14.0 probing 093a:2626
[ 3321.884442] input: gspca_pac7302 as /devices/platform/ocp/47400000.usb/47401c00.usb/

After repeating my launch and vlc menu selection, when I pressed the 'Play' button vlc presented a nice little 640x480 live cam feed!

But the feed was laggy, really, really laggy (could be my lousy wifi network and other traffic, though; the screenshot is from a Mac desktop of a vnc session). So there you have it - a win for a piece of cast-off technology!

Using a 128x64 SSD1306 OLED with the Beaglebone Green Wireless

I recently scarfed one of those neato 128x64 OLEDs for about a Hamilton off the 'Net and thought it would make for a nice little system monitor on a headless SBC (single-board computer) like the RPi3 (which somehow seem to keep multiplying 'round these parts - dunno why). The OLED is one of those two-color jobbies that has a yellow area up top and the rest in blue. So i sat down one afternoon and crafted up a little Python (i'm a Python n00b, btw) to have the OLED do something useful. What's nice is that my pitiful results - i hope this can help someone out there - which work fine on the RPi, also ported easily to the BBGW. Honestly, it only took an hour or so of editing the Python script to accommodate the BBGW. BTW, I have to put out a big shout of 'thank you' to rm-hull for SSD1306 code. I followed his directions from the github source and quickly re-implemented his Python library on the BBGW.

What I ended up with was a Python script that shows a series of screens displaying information such as:

kernel version,
IP address,
memory used,
wifi signal strength,
the amount of microSDHC card usage,
and the BBGW's serial number

... along with a little splash screen with a dawg. (Hint: I cheated and didn't resort to .png manipulation; I simply used a .ttf dog font - no kidding!)

Here's the important info. You'll need Python 2.7 installed. First, carefully hook up the OLED's four pins while the BBGW is powered down:

VCC -> +3V, pin 3
GND -> pin 2
SCL -> pin 19
SDA -> pin 20

Boot up, then make sure i2c support is available, although it should be enabled by default by the Debian release.

The i2c device (in this case the SSD1306) showed up on bus(port) 2:

$ i2cdetect -l
i2c-0 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter

I then looked at the device on the bus (note that it is recognized at address '3c' on i2c bus(port) #2 [bus #0 is reserved for capes?]):

$ i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

After seeing the OLED on the bus, I then installed Mr. Hull's wonderful SSD1306 Python library support - search for "rm-hull github ssd1306" and you can download the library, software, README and examples. Follow the directions! You'll need to install a variety of Python support libraries to get a working display. You'll also need to edit the examples to fit the adapter address on the BBGW. For example, use:

device = ssd1306(port=2, address=0x3C)

Then you can add fonts, etc. and have fun! I used a number from Adafruit's SSD1306 libraries. Running an OLED on the BBGW is a very inexpensive way to have system and other information continually displayed. I like that Python scripting is interactive - a simple edit of a script, then running the program eliminates the compile cycle - almost like the days of BASIC programming! I like that you can quickly new features, such as wifi signal strength readings:

I put most of the code together in an afternoon with a little tweaking the next day (such as wifi signal strength). To display the local weather I use a simple shell script that retrieves current conditions from Accuweather based on a zip code query. If you'd like your script to run upon each boot, you'll need to create a short systemd entry. However, first make sure to 'hardwire' the font pathnames in the source code; IOW, specify the exact locations of the fonts. For example:

font = ImageFont.truetype('/home/debian/Downloads/ssd1306-master/FreeSans.ttf', 12)

Next, as root, create a short systemd entry under /lib/systemd/system. I used the name ssd1306.service, which contains:

Description=SSD1306 OLED



Note that the ExecStart entry gives the exact location of the Python script. The WantedBy entry will have the service started upon every reboot. You can then 'install' the service by going to the /lib/systemd/system directory, as again as root, using the systemctl command:

$ sudo systemctl enable ssd1306.service

You can test your BBGW's new OLED service by using the start option:

$ sudo systemctl start ssd1306.service

After you reboot you'll have your BBGW displaying its system stats!

Nitpicks About the BeagleBone Green Wireless

The BBGW needs more and better documentation. The BBGW's current System Reference Manual is somewhat lacking (32 pages vs the more than 130 pages for the Beaglebone Black). BTW, "Force to boot from Micro SD Card or Switch the Wi-Fi mode between AP and station mode " is the description for the Boot button on the Seeedstudio BBGW wiki, but there is NOTHING in the BBGW System Reference manual regarding this behavior - and instead, details are given regarding a boot order - including USB??? (have not tried this yet). Check out the wiki for related links.

An install of vnc4server and then a requisite window manager/desktop system - lxde and lxterminal, along with the midori browser (from Debian's Jessie backports, which only required a simple removal of a comment hashtag from /etc/apt/sources.list) seem to work well.

Finally, I highly recommend getting a 3V FTDI UART USB cable to use serial input/output login - very helpful to see what's going on during an initial boot of a new distro or install. Make sure it is a 3V cable!!!

I hope you find this info useful. I really like my BBGW and I think you will too!

No comments:

Post a Comment