1 2 3 Previous Next

BeagleBone Black

77 posts

NASA Jet Propulsion Laboratory prototyped a new rover design with the BeagleBone Black!

 

"Testing a Space Rover Under Alaskan Ice"

 

 

Here's a screenshot of the BeagleBone:

Screenshot from 2015-06-15 16:40:18.png

Fixing the problems with the BBView and the latest Beaglebone Debian image.

 

So since the new Debian update for the Beaglebone some problems have surfaced with using the BBView. Here I hope to help people fix those errors and get full use of their BBView.

 

Not many steps, and it is very easy to do.

 

     1.    Firstly we need to download the newest Debian Image from Here http://beagleboard.org/latest-images

          Make sure you download the latest SD image (to boot from SD) or the flasher image (to reflash the EMMC with the new image)

 


     2.    Flash the image onto the SD card using your preferred means, dd command in linux /  win32DiskImager in windows are my preferred means.

 

 

     3.     Connect a an HDMI screen and keyboard, or or a TTL serial cable to the Beaglebone. If using the TTL cable you will also need a computer running a serial terminal program                (eg putty for windows)

 

 

     4.    Boot the Beaglebone Black from the new microSD card.

              Insert the microSD card.

               This will either boot the board from the microSD, or flash the new image onto the EMMC if you are using the flasher (This could take a while if using the flasher image)

 

 

     5.    When the board is booted, login using the username:root and password:debian

 

 

     6.     You will need some files to change the display output these files can be downloaded from HERE for Debian. Or from here.

               Just extract the downloaded zip file onto a USB stick and plug this into your Beaglebone Black

 

 

     7.    Now we need to change a few of the files to get the BBView to work

              In the terminal type....

root@beaglebone:~# mkdir /media/udisk
root@beaglebone:~# mount /dev/sda1 /media/udisk
root@beaglebone:~# cp -f /media/udisk/zImage /boot/vmlinuz-3.8.13-bone70 
root@beaglebone:~# cp -f /media/udisk/*.dtb  /boot/dtbs/3.8.13-bone70 
root@beaglebone:~# tar -xvf /media/udisk/kernel_modules.tar.gz -C /
root@beaglebone:~# cp -f /media/udisk/xorg.conf /etc/X11/
root@beaglebone:~# sync










 

 

              FOR 4 INCH DISPLAYS TYPE THIS

root@beaglebone:~# cd /boot/dtbs/3.8.13-bone70
root@beaglebone:~# cp am335x-boneblack-lcd4.dtb am335x-boneblack.dtb
root@beaglebone:~# sync





 

 

              FOR 7 INCH DISPLAYS TYPE THIS

root@beaglebone:~# cd /boot/dtbs/3.8.13-bone70
root@beaglebone:~# cp am335x-boneblack-lcd7.dtb am335x-boneblack.dtb
root@beaglebone:~# sync





 

 

     7.     Now shutdown your board. Connect your BBView and power it back up again.

 

Your BBView should now work as a screen for your Beaglebone Black. Have fun.

callum.ds

Make your own BeagleBot

Posted by callum.ds May 15, 2015

The BeagleBot

 

How to make your own Beaglebone black bot that you can control over WiFi.

 

So I've just done a project with the Beaglebone Black and I've managed to make a little robot car that can be controlled via WiFi from any browser on the same network.

Sounds cool, and it kind of is, but there's a lot that can be improved and changed. If any of you guys do improve it or add anything to it then please please please let me know even if it doesn't quite work, then maybe we can help you get it to work.

 

But first we need to build Bob (Yes, I named it)

 

The Steps:

 

 

 

 


1. Get stuff (easy):

    Stuff we need (there's quite a bit)

Where to buyFarnell Order Codequantityproduct
cpc.farnell.comHK012091ROBOT KIT CHASSIS
uk.farnell.com242222824222281BBONE-BLACK-4G
uk.farnell.com243798124379811WIFI DONGLE
uk.farnell.com165068516506852BATTERY HOLDER, LEADED, 4 X AA
uk.farnell.com234525723452571Alkaline AA Batteries (any will do, get rechargeable if you prefer)
uk.farnell.com207536620753662Continuous rotation servos
uk.farnell.com126775112677511

PCB, RAW, 100X160

uk.farnell.com156468215646821Step-Down Voltage Regulator
uk.farnell.com247467524746751Prototyping Board
uk.farnell.com945108094510801100 µf radial capacitor
uk.farnell.com9451129945112911000 µf radial capacitor
uk.farnell.com956505195650511Diode
uk.farnell.com120954612095461100µH inductor

 

You will also need.....

  • Soldering station (Soldering iron, heat mat, solder, and whatever PPE you need)
  • A bit of wire (some capable of taking up to 5V at 3A, and some thinner gauge just for controlling servos etc)
  • A few male to male and male to female jumper wires may also come in handy
  • pliers thin nosed
  • screwdriver (flat or philips)
  • super glue (be careful) or double sided tape
  • a bit of foam (or another way to hold the BBB and batteries in place and allow them to be removed)
  • duct tape or another way to attach the Beaglebone flap to the chassis
  • A sharp craft/Stanley knife (Be VERY careful when using this, get someone to help if you're not confident. And mind your fingers)

 

 

2. Build the chassis (very easy)

 

Get all the chassis stuff out, we're just using the main base platform, ball bearing at the back, and the wheels.

 

Use the bolts provided to screw the ball bearing wheel to the back of the chassis making sure the bolts go down so that they stick out the bottom and not stick out the top, or else we won't be able to fit our batteries in correctly.

 

Super glue/stick/attach the servos to the bottom of the chassis like the picture below


Then route the wires to the top. You may need to enlarge the hole to get the connectors through.....

 

Next we need to cut the flap for the Beaglebone Black to rest on. Measure out however big you want it (making sure the Beaglebone fits onto it with spare room for the foam) then score the PCB board down the line you want it to break, be very careful and use a cutting rule if possible. Keep scoring from both sides until almost through the board then carefully snap the board. If you don't have a cutting rule or you are not too confident with a craft/Stanley knife then use a hacksaw or similar.

 

Carefully stick the flap to the front of the chassis to create a hinge. that allows the flap to lift up and down so we can access the batteries later.

   

Now we can cut out the foam to fit the Beaglebone Black and the Batteries. Measure and outline the Beaglebone onto the foam then cut out the shape to make a Beaglebone sized hole in the foam then cut around the hole so all you're left with is an outline of foam which we can stick onto the flap.

Now repeat for the batteries.

 

Now we can stick/glue the foam onto the flap and chassis. Make sure the Beaglebone foam holder goes on the top of the flap and the battery holder goes right at the back of the chassis.


 

 

3. Soldering the Prototyping Board for the power connections (You WILL need some basic electronics knowledge and some previous soldering experience for this bit)

This bit is probably the hardest bit of the project because it's very fiddly and requires you to have at least a basic understanding of electronics.

 

Firstly get your protoboard and score it then snap it in half, then score and snap in half again the other way to get a quarter (scoring down the holes makes it easier to snap). This quarter is the bit we're going to use.

 

Now by carefully following the circuit diagram below solder all the components in place.

Circuit Diagram for the BeagleBot power board

The batteries need soldering in series.

On the DC jack the inner pin is positive and the outer metal shell is ground. Check you have the correct wires the correct way round before soldering or else you will blow your Beaglebone!

Also make sure the capacitor and diode polarisation is correct.

ONCE SOLDERED INSERT THE BATTERIES AND CHECK THE VOLTAGE WITH A MULTIMETER. The voltage MUST NOT be above 5V.

After checking the voltage insert the DC jack into the Beaglebone and wait for it to boot. Once successfully boot shut it down. Congratulations you now have a working battery powered Beaglebone.

 

 

4. Installing the packages on the Beaglebone (easy)

This bit is easy peasy.

Plug in and boot the Beaglebone.

Make sure you have internet connection either through Ethernet or WiFi.

Now install everything we need.

In the command terminal type the following lines.

sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y --force-yes --fix-missing
sudo pip install Adafruit_BBIO
sudo apt-get install apache2 php5 libapache2-mod-php5 -y --force-install --fix-missing
systemctl disable cloud9.service
systemctl disable gateone.service
systemctl disable bonescript.service
systemctl disable bonescript.socket
systemctl disable bonescript-autorun.service
systemctl disableavahi-daemon.service
systemctl disable gdm.service
systemctl disable mpd.service

























 

 

5. Get the webserver running (fairly easy)

Now we need to get the webserver running.

First extract the .zip folder with the files in it onto a memory stick.

Insert the memory stick into the Beaglebone and reboot it.

In the terminal copy the files onto the board

sudo cp -R /media/<path_to_memory_stick>/www/* /var/www/
sudo chmod -R www-data:www-data /var/www

























Now let's check that Apache is running on the correct port (port 80)

Use whichever editor you prefer, but here I'm using nano to make it simpler for beginner users

sudo nano /etc/apache2/ports.conf

























Find the line related to listening ports, and make sure it is referring to port 80, change it if needed.

then press ctrl+x then y then enter to save the file.

then type

sudo service apache2 restart

























to restart apache with the new settings

 

now we need to get the Beaglebone to connect to the wifi network.

 

 

6. Get the python script running (easy)

For this all we need to do is make sure the script is executable and make sure python can run it fine

in the terminal type

sudo chmod a+x /var/www/*.py
python2.7 /var/www/move_php.py

























You should hopefully see the words

"Move_php script running..."

on your screen if it is worki

press Ctrl+C to stop python

 

 

7. Auto run the scripts we need running (easy)

For this we are going to use crontab, it is a service that runs in the background and is used to automate the running of tasks, exactly what we need.

In the terminal type

sudo crontab -e
























In the crontab window add to the bottom the following lines

@reboot sudo service apache2 start
@reboot sudo python2.7 /var/www/move_php.py &

























Notice the & sign at the end of the second line. This is very important, as it tells python to run in the background. If you do not include this then python will run in the foreground and prevent the boot sequence from continuing.

Now when we reboot apache2 should auto start and the python script should also run in the background. You can check this by rebooting your Beaglebone then in the terminal typing

ps -e | grep python
























this should return a process I.D. for the python script running in the background

 


8. Assembling Bob (very easy, but can be fiddly)

This bit is very easy but can be a bit annoying to get perfect.

Place the Beaglebone in the foam holder on the flap, and the batteries in the foam holder at the back of the main chassis.

Route all the wires in a neat fashion to where the Beaglebone is on top of the flap.

Follow the picture in the zip file named BeagleBot_connections.png to connect everything (except the power) up to the correct pins, you may need to use jumper wires. If you don't have any jumper wires then you can simply cut the wires the connectors off of the wires you can't connect, strip them twist them and tin them, then you can insert them into the header on the BeagleBone.

Once everything is plugged in, tuck away/neaten up any wires hanging around the place until it looks neat and tidy. It might be a good idea to use electrical tape to hold wires down and out the way. At all costs prevent short-circuits.

 


9. Power (very easy)

Once your BeagleBot is ready to go, plug in the power and wait for it to boot. If you have not set up a static I.P from your router then you will need to connect to the Beaglebone during boot either by ssh over the wifi or via a serial cable to get the I.P. address.

Once you have the I.P address and your board is fully powered and not tethered to anything via a wire you are ready to go!

 


10. GO!! (fun)

Open up a browser window on any PC/phone/tablet that is connected to the same network as the BeagleBot and enter http://<I.P. of your BeagleBot>/move.php into the address bar.

Once the page is loaded tap the buttons to send your BeagleBot on its way.

Hello everyone,

I've been playing with the BeagleBone Black for a long time now.

If you're just getting started I've created a 4 part series on how to get started with the BeagleBone Black.

 

You can access the complete list of tutorials here: http://randomnerdtutorials.com/category/bbb-series/

 

Or you can choose a topic that interests you:

 

Thank you for reading and I hope you find this information useful.

If you have any questions feel free to ask and I'll try to help you.

Hi Guys ,

 

First of all Thanks a ton Element14 for sending one of the BeagleBone Black to test I recently have interfaced a 2.2" SPI LCD 240x320 To the Element14 Beagle Bone Black. Below is a Working demonstration of the Display in action

 

 

I also made a breakout board for the above featuring

1. Easy Plug and play capability (Modular design)

2. Easy UART Access using a Standard arduino mini FTDI module

 

 

Quick Observations,

1. The board is officially BeagleBone Black compliant !! Still No BeagleBone Black Logo is present on board ??

2. This board uses the Latest AM3358 Chip instead of AM3359 one on previous versions.

3. It is an Exact replica of the original BeagleBone Black, and works PREFECTLY.

4. Finally, By default the E14 BBB comes with Debian pre-installed, my old BBB 2G version came with Armstrong installed  

 

Thanks again to Element 14 for sending me a BeagleBone Black.

and please comment below if you want to know more.

Hi Everyone.

 

We are pleased to announce that Canonical has released Snappy Ubuntu Core-- and it's compatible with the BeagleBone Black! Running Snappy Core on smart devices delivers bullet-proof security, reliable updates and the enormous Ubuntu ecosystem at your fingertips – bringing your favorite cloud platform to a wide range of IoT devices and autonomous machines.

cof_orange_hex_400x400.jpg

And the BeagleBone Black is one of the two key recommended ARM based development boards for this core! Over at Beagleboard.org, Jason Kridner says: “BeagleBone Black and Snappy Ubuntu Core together answer the pervasive questions around the Internet of Things, so I am obviously thrilled. Experts and developers often ask me how they can normalize their application environment and have confidence in the security of the system. With a reference design of Snappy on BeagleBone Black, Canonical and BeagleBoard.org have partnered to ensure anyone can build an IoT prototype quickly and affordable, without any barriers to taking their designs to production.”

 

Here are just some of the advantages developers get by using Snappy Core:

 

  • You can just package your IoT app like a mobile app and put it into an IoT app store
  • Transactional upgrades - you don't have to worry about handling complex stuff like patching operating systems, updating apps, rollback in case something goes wrong. Snappy Ubuntu Core does all of that for you.
  • Security, security, security! Android for IoT is just asking for viruses and trojans. Now transpose this to the Internet of Things: do you really want you house, work or city to be taken over by some mischievous hacker? We run each app in a secure container, and the operating system is mounted read-only.
  • Free to use and open source... of course.
  • 70% of penetration on the cloud. So you get a lot of stability on many familiar platforms. No more needing to learn a different operating system for each new platform, like wifi, TV, switch, robot, etc: One OS to rule them all.

 

Here are a couple of videos to help you get started with Snappy Ubuntu Core.

 

First, how to install and run Snappy on your BeagleBone Black:

 

 

 

Next, what Snappy Ubuntu Core means for smart devices running ARM or x86 processors:

 

Let us know what you think! And have fun getting into Snappy Ubuntu Core!

vijuomp

error logging password

Posted by vijuomp Jan 20, 2015

after i enable the bbb-view caps and i have remove flash drive after that again when i powered bbb then in putty when i logged it shows access deneid

For those of you who have been following along with my BeagleBone Black and Drupal series,  you could see this post coming. In my first installment I showed you how to build a website on the BeagleBone Black using the Drupal CMS, and followed it up with Controlling the BeagleBone Black's GPIO Pins with Drupal. This tutorial is going to take things a step further and show you how to take that knowledge, and use it to trigger some relays to turn mains powered electronics on and off. While the method I am going to use would not be ideal for conrtolling an entire home, it works quite well for controlling things like props in a haunted house and other low-amperage things like small fans, lights, and such. Just to make things easier, I am going to recap a good bit of my previous tutorial here. You will still need to go through the Drupal setup steps in the first tutorial though.

 

 

 

Prerequisites: What you need to know to be able to complete this project.

  • Understand how Drupal-based websites work.
  • Understand how PHP can be used to parse commands to the web server's terminal.
  • Understand the basics of how Transistors work, and why they should be used for applications like this.
  • Understand how the BeagleBone Black accesses its GPIO Pins.

 

Hardware Required: What hardware is needed to complete this project.

  • BeagleBone Black (Rev C recommended) BeagleBone Black (Rev C recommended) running the latest Debian image.
  • 5mm Green LED
  • 1x 460Ω 1/4w Resistor
  • 3x 3.3kΩ 1/4w Resistors
  • 3x 100Ω 1/4w Resistors
  • 3x 2n3904 General Purpose NPN Transistors
  • Female to Male Jumper Wires
  • Male to Male Jumper Wires
  • 5V Power Source for BeagleBone Black

 

 

Getting started: Building the discrete circuit and connecting to the Beaglebone Black.

 

Just like last time, we need to set up a transistor that will be used to supply the trigger voltage to the relay coils. The transistor circuit is needed because the BeagleBone Black is only able to supply about 8mAh to each of its GPIO pins and connecting something that draws more than 8mAh can damage the board's ARM chip. We can turn on a general-use PNP transistor with just a few mAh which will let us power the LED externally, and prevent any damage to the board. This is also handy for controlling relays and other components that can be triggered via the GPIO pins. Follow the diagram below to build the simple circuit. Instead of setting up the circuit to illuminate a LED, this time we will configure it to trigger the relay. We will be using a cheap 8-channel relay board to connecto to our circuit, so we will need a common ground, as well as two signal lines to the first two relays.

 

Relay-BBB.jpg

 

With the breadboard populated with our transistor circuits and connected to our BeagleBone Black, lets move onto the software side of things. We will come back and connect the relay board later in the tutorial.

 

 

Setting up the GPIO Pins in Debian: Using the terminal to configure specific GPIO pins in Debian.

 

To test the circuit we need to access our BeagleBone Black via SSH. I covered how to do this in the BeagleBone Black RSS News Reader tutorial, but will post it here as well.

 

To access the BeagleBone Black via SSH I will be using a terminal for Windows called Putty, as well as an add-on called MTPutty, which allows me to run multiple putty instances from within a single tabbed interface. Both Putty and MTPutty are available for free, and take just a few moments to download and install. Chances are, if you are reading this, you already know how to use Putty. If you are using a Mac you can simply use the built-in Terminal to access your Black Via SSH. To connect to your Black, you need to enter the following credentials.


Putty-Config.jpg

With these settings configured, click ok and then double click the BeagleBone Black name in the server list. This will open up a new terminal tab and you will be prompted to enter a username. Unless you have modified the root user, you should enter root as the user name.

 

Putty-connect-2.jpg

 

BeagleBone has made it easy here as there is no password and after entering the username, the connection will finish, and you will be placed in your "home" directory.

Putty-connect-3.jpg

 

Now that you are SSHed into the BeagleBone Black we will need to prepare GPIO_67 (P8:08), GPIO_68 (P8:10), and GPIO_44 (P8:12) . The pinout diagram can be seen below.

 

bbb-pinout.jpg

 

Before we get started with testing, lets take a moment and talk about how the BeagleBone Black's GPIO pins are addressed by the Linux-based Debian operating system. The BeagleBone Black addresses its GPIO Pins by reading the contents of files which are located in the sys/class/gpio directory in the board's operating system. The most basic functionality is to write the pin high or low, and is what we will be doing in this tutorial.

 

To use a GPIO Pin you first need to tell Debian that you are going to use a particular pin in a specific GPIO header. The following code uses GPIO 8.8 as an example, but any GPIO Pin can be accessed by creating these files. Enter the following commands into the BeagleBone Black's terminal.

 

The first thing we need to do is create a few new directories in the /sys/class/gpio/sys/class/gpio directory.

echo 67 > /sys/class/gpio/export
echo 68 > /sys/class/gpio/export
echo 44 > /sys/class/gpio/export



















 

At this point you will need to let the BeagleBone Black know whether or not the specified GPIO pins are input or output.

echo out > /sys/class/gpio/gpio67/direction
echo out > /sys/class/gpio/gpio68/direction
echo out > /sys/class/gpio/gpio44/direction




















 

With this command, the BeagleBone Black no longer supplies 2.3V to the header and it is considered to be turned off. In order for us to set the GPIO Pins high or low we need to set their value to  either 1 or 0. We can do that with the following commands where the gpio# variable is set to the corresponding pin #. An example for gpio_67 is listed below.

 

Set the GPIO Pin High

echo 1 > /sys/class/gpio/gpio67/value




















 

Set the GPIO Pin Low

echo 0 > /sys/class/gpio/gpio67/value




















 

Remove control of the GPIO Pin when finished.

echo 67 > /sys/class/gpio/unexport




















 

You will also need to chown and chmod the directory for each GPIO pin used. This can be done by entering the following commands.

chown -R www-data:www:data /sys/class/gpio/gpio67/value
chown -R www-data:www:data /sys/class/gpio/gpio68/value
chown -R www-data:www:data /sys/class/gpio/gpio44/value
chmod 777 /sys/class/gpio/gpio67/value
chmod 777 /sys/class/gpio/gpio68/value
chmod 777 /sys/class/gpio/gpio44/value


















 

Testing The Circuit: Using the terminal to trigger the GPIO Pin.

 

With those basics out of our way, we can test out setup by turning the LED connected to GPIO_67 on and off. Connect a 9-volt battery to our breadboard and head back to the terminal window and follow the steps below to turn the LED on and off via the command line.

 

9-volt-power.jpg

 

With everything connected, we should be able to use the command line to set GPIO Pin 67 high, which should in turn activate the transistor and allow the LED to light up.

Set the GPIO Pin High

echo 1 > /sys/class/gpio/gpio67/value




















 

If everything was followed correctly, you will see the LED light up

 

LED-Illuminated.jpg

 

Now set the GPIO Pin to low to turn off the circuit.

Set the GPIO Pin Low

echo 0 > /sys/class/gpio/gpio67/value




















 

 

Setting up the Relay Board: Connecting the Relay Board to the BeagleBone Black.

 

If those commands worked, then everything is set up as expected. We can now connect the 8-channel relay board and test to see if it is working correctly. I'm using a cheap relay board I bought on Ebay a while back, but Newark and MCM Electronics both have several you can purchase. My board is quite simple and only requires a VCC input of 5V and a GND connection. Each relay has a trigger pin broken out, and these are where you will attach the GPIO pins via the transistor circuits we built earlier. Since my board only requires 5V to trigger the relay coils, I am going to power it from the BeagleBone Black. Generally this is frowned upon, but since I am only using two relays at once I am letting it slide. If you try triggering more than 2 relays at once, they could try to pull more current from the BeagleBone Black than it can supply and the relays will not trigger and the board could be damaged. If you plan on triggering all 8-relays I would suggest powering it with an external 5V 2amp power source. You could also use the 9-volt battery and a L7805 +5V Linear Voltage Regulator to trim 9-12V down to 5V. Follow the instructions below. I could not find my resistor assortment, and had to risk connecting the relays directly to the BeagleBone Black since they would only be used for the duration of this tutorial.

 

IMAG0662.jpg

 

  • For this tutorial,  connect the two relays to the BeagleBone Black by connecting the VDD_5V (P9:05) pin to the relay boards VCC connection header.
  • Connect the BeagleBone Black's Ground DGND (P9:01) to the Relay Boards GND pin via the transistor circuit.

 

As I mentioned above, I could not find my resistors to complete the transistor circuits, so follow the directions below to connect the relays to the transistor circuits.

 

  • Connect the transistor that is connected to the  BeagleBone Black GPIO_68 (P8:10) pin to the relay 1 pin on the relay board.
  • Connect the transistor that is connected to the  BeagleBone Black GPIO_44 (P8:12) pin to the relay 2 pin on the relay board.

 

Now with those relays connected, its time to test that they work. Click back into the terminal and enter the following commands. If all is right, both relays should click on and off. Note that some relay boards are set as normally closed, and will appear to function the opposite you think they should. You will have to reverse the on and off commands for the relays to function correctly. This is as easy as swapping the 0 and 1 around in the code.

 

Turn Relay 1 on:

echo 0 > /sys/class/gpio/gpio67/value

















 

Turn Relay 1 off:

echo 1 > /sys/class/gpio/gpio67/value

















 

Turn Relay 2 on:

echo 0 > /sys/class/gpio/gpio67/value

















 

Turn Relay 2 off:

echo 1 > /sys/class/gpio/gpio67/value

















 

If they clicked on and off, then proceed to the next step. If they did not then repeat the process to see if you missed something.

 

 

Configuring the Drupal website: Adding the additional control buttons to the website.


With all of the hardware working its now time to configure the website that will let us control each relay as well as the LED remotely. Instead of writing 2000 more words and making this tutorial impossibly long, I have recorded another video to guide you through the configuration process. Check it out below and remember to subscribe to the channel if you like what I am trying to do!

 

 

When you get to the page creation phase, you can find the needed code examples pasted below.

 

LED Code:

 

Relay 1 Code:

 

Relay 2 Code:

 

With the website now configured, you should have a working remote automation system. You can use this to control a number of things such as lamps, irrigation systems, and even props in things like haunted houses, or film sets. I first designed this system to control a simple fog machine for my home on Halloween via my smartphone, but sadly the fog machine burnt out a week before the project was complete. So as you can see in the video below, I am using it to control a light bulb on my office desk. I plan on streamlining the system before next Halloween, and writing a few tutorials here on automation with the BeagleBone Black using triggers such as an Android app, motion sensors, and even pressure plates. If there is enough demand, I would consider turning it into a monthly series so leave me a comment if this is something you might like to see.

 

I have been working on an idea for my project. I am using my BBB to get the weather forecast and to let me know if I need to take an umbrella when I go out. (To be honest I don't use an umbrella but this is is for a "proof of concept" idea).

 

I am using python here to collect the forecast from Weather Underground, the api page is very helpful, and when I have the forecast as a json document I can extract the data I am looking for and do stuff with it. Currently I am displaying the weather forecast form my local area for the day that the program is being run and the next day. I have coded the place that I want the weather for into the string that makes up the URL, as my project is going to be setup per user I think that this is OK. See code below:

 

# program to grab the weather forecast from weather underground
# author Mark Venn
# based on code from "Getting Started with Raspberry Pi"
# currently collects the forecast for current day and next day. Lights an LED if the chances of rain are over 60%

# imports
import requests
import Adafruit_BBIO.GPIO as GPIO
import time

# configure GPIO pins
GPIO.setup("P8_8",GPIO.OUT)

GPIO.output("P8_8",GPIO.LOW)

# wunderground api key

key = 'xxxxxxxxxxxxxxxx'

# build string using hard coded web address & api key variable
ApiUrl = 'http://api.wunderground.com/api/' + key + '/geolookup/forecast/q/UK/Bembridge.json'

while True:

    # get the weather forecast from wunderground and store in variable
    r = requests.get(ApiUrl)

    # take response and parse it into python dictionary object
    forecast = r.json

    # extract relevant data.
    # use variable to collect day of the week
    day = forecast['forecast']['txt_forecast']['forecastday'][0]['title']
    # display next day
    nextDay = forecast['forecast']['txt_forecast']['forecastday'][2]['title']

    # chance of rain
    rain = forecast['forecast']['txt_forecast']['forecastday'][0]['pop']
    rain = int(rain)

    # display current day
    print day

    #directly display the required info
    print forecast['forecast']['txt_forecast']['forecastday'][0]['fcttext']


    print nextDay
    # TEST CODE
    # print rain

    #directly display the required info
    print forecast['forecast']['txt_forecast']['forecastday'][2]['fcttext']

    if rain >= 60:
        GPIO.output("P8_8",GPIO.HIGH)
    else:
        GPIO.output("P8_8",GPIO.LOW)

    time.sleep(180)


# TEST CODE #
# prints entire json document
#print forecast

The data I need for the forecast is held in fcttext in 2 key / value pairs and this is displayed.

root@beaglebone:~# python text_forecast_v3.py

Monday

Mostly cloudy. Lows overnight in the low 40s.

Tuesday

Cloudy and becoming windy. Periods of light rain early. Turning colder. High 46F. Winds N at 20 to 30 mph. Chance of rain 40%.

Monday

Mostly cloudy. Lows overnight in the low 40s.

Tuesday

Cloudy and becoming windy. Periods of light rain early. Turning colder. High 46F. Winds N at 20 to 30 mph. Chance of rain 40%.

Monday

Cloudy. Lows overnight in the low 40s.

Tuesday

Light rain early. Then becoming windy in the afternoon. Turning colder. High 47F. Winds N at 20 to 30 mph. Chance of rain 40%.

 

I am displaying this in the console at the moment, I might use some kind of GUI at a later date; my son odion is often telling me that I should put stuff into GUIs but A console is good enough for me for now

The code to get the forecast could be run on any machine that can run python 2.7 but now we come to the reason for running this on the BBB. There is a single LED connected to P8-8 and when the value of the precipitation chance in percentage is over  60% this LED lights up. The whole check is done every 3 minutes at the moment but I will be playing with the timings later. It is likely that I can get away with every 6 hours or so but I will see.

text_forecast_v3.py_bb.jpg

I have taken the idea for this from the "Getting Started with Raspberry Pi" book and made a few changes as well as converting it to the BBB; I will probably set this up on the Pi next and see if there are any differences in the way it works.

The Weather Underground api looks very wide ranging and I will see what else I can get out of it, I think that as we in the UK head into winter something that pulls the expected maximum and minimum temperatures will be useful. I have found where this info is held in the json document:

"period":1,

"high": {

"fahrenheit":"48",

"celsius":"8"

},

"low": {

"fahrenheit":"41",

"celsius":"5"

}

Will have to play around with this info and see how I can make use of it.

 

I will be using my BB_VIEW display to see how I can display the info, not sure what or how yet, this will be in another blog. I am going to be writing about my experiences with my new Pi B+ so check out my blogs on there.

Bye for now, off to check if my LED is alight yet!

 

Beaglebone Black

BB View 4_3 LCD Display

bbb-web-gpio-banner.jpg

 

In my last tutorial I covered the installation of Drupal onto the BeagleBone Black and how to setup an Apache-based web server. In this tutorial, I am going to continue building on that foundation and cover the basics of using that Drupal-based website to control the GPIO pins on the BeagleBone Black using PHP to run bash scripts. This will, in turn, allow you to use the internet to control anything that is connected to the BeagleBone Black's GPIO pins, and will further the foundation for some basic home automation tutorials I will write in the coming months.

 

Prerequisites: What you need to know to be able to complete this project.

  • Understand how Drupal-based websites work.
  • Understand how PHP can be used to parse commands to the web server's terminal.
  • Understand how LEDs work, and what the terms Anode and Cathode mean.
  • Understand the basics of how Transistors work, and why they should be used for applications like this.
  • Understand how the BeagleBone Black accesses its GPIO Pins.
  • Basic knowledge of soldering.

 

Hardware Required: What hardware is needed to complete this project.

  • BeagleBone Black (Rev C recommended) BeagleBone Black (Rev C recommended) running the latest Debian image.
  • 5mm Green LED
  • 1x 460Ω 1/4w Resistor
  • 1x 3.3kΩ 1/4w Resistors
  • 1x 100Ω 1/4w Resistors
  • 1x 2n3904 General Purpose NPN Transistors
  • Female to Male Jumper Wires
  • Male to Male Jumper Wires
  • 5V Power Source for BeagleBone Black
  • 5V Power Source for BeagleBone Black (Optional without BB View cape, Required if BB View Cape is used.)
  • Solder
  • Flux
  • Soldering Iron

 

Getting started: Soldering the resistor to the LED



For the purpose of this tutorial we are going to use an LED to indicate when a specific GPIO pin has been toggled on and off. As I am sure many of you reading this already know, Light Emitting Diodes (or LEDs) are one of the most revolutionary electronic components to have ever been created. In fact, this year's Nobel Prize in Physics was awarded to the team of scientists who created the efficient blue LED, which has revolutionized the way humans light the world. Since LEDs are so efficient, and sip very little power, the 3.3v coming out of the BeagleBone Black's GPIO pins would fry the LED if we tried to connect it without a current limiting resistor. While this is old-hat stuff for most of you, there will be some readers who will find this section interesting and helpful, and that is why I am including it. Below is a diagram that shows exactly what makes up your typical 5mm LED.

 

led-anatomy.jpg

Since the LED is a diode, electricity will only flow one direction. This is why a LED is polarized, unlike a resistor that works in any orientation. In the diagram above, you will notice that the Anode (+ side) is the smaller element inside the LED, and that the Cathode is actually the leg that houses the crystal that emits the light. Another way to tell the Anode from the Cathode is that the Anode will usually be longer than the Cathode. Finally, the Cathode is usually closest to the flat spot on the LED's base ring.

 

Placing the resistor on the Anode or Cathode will work, but I prefer to place it on the Cathode. This is just personal preference, but I find it to be considered best practice in several textbooks and guides. There is also no set standard for attaching a resistor directly to the leg of the LED, but I generally tend to go for the "wrap it around neatly" method. I also like to trim the Cathode down so that the resistor's lead matches up with the Anode leg length. For breadboard work I like to build easily reusable LED modules that include the resistor and are soldered to a 2-pin male header.

 

LED-Breadboard.jpg

 

With that finished, we can now move on to setting up the transistor circuit on a breadboard. The transistor circuit is needed because the BeagleBone Black is only able to supply about 8mAh to each of its GPIO pins and connecting something that draws more than 8mAh can damage the board's ARM chip. We can turn on a general-use PNP transistor with just a few mAh which will let us power the LED externally, and prevent any damage to the board. This is also handy for controlling relays and other components that can be triggered via the GPIO pins.

 

bbb_breadboard_led.jpg

 

Here is a quick diagram of how I wired up the transistor circuit and attached the LED.

 

Breadboard_actual.jpg

 

You will notice that I have a 9Volt battery powering the LED via the transistor. You do not have to use a 9V battery, and anything above 5V will work, but I would not use a power supply over 12v for this application.


bbb_circuit_breadboard.jpg

 

With the Transistor Circuit wired up, lets connect the BeagleBone Black. Basically we simply need to connect one of the GPIO Pins to the Transistor, and carry over the BeagleBone Black's ground circuit to our bread board. With all of this connected, we can now test the LED using the BeagleBone Black's terminal.

 

Testing The Circuit: Using the terminal to trigger the GPIO Pin.

 

To test the circuit we need to access our BeagleBone Black via SSH. I covered how to do this in the BeagleBone Black RSS News Reader tutorial, but will post it here as well.

 

To access the BeagleBone Black via SSH I will be using a terminal for Windows called Putty, as well as an add-on called MTPutty, which allows me to run multiple putty instances from within a single tabbed interface. Both Putty and MTPutty are available for free, and take just a few moments to download and install. Chances are, if you are reading this, you already know how to use Putty. If you are using a Mac you can simply use the built-in Terminal to access your Black Via SSH. To connect to your Black, you need to enter the following credentials.


Putty-Config.jpg

With these settings configured, click ok and then double click the BeagleBone Black name in the server list. This will open up a new terminal tab and you will be prompted to enter a username. Unless you have modified the root user, you should enter root as the user name.

 

Putty-connect-2.jpg

 

BeagleBone has made it easy here as there is no password and after entering the username, the connection will finish, and you will be placed in your "home" directory.

Putty-connect-3.jpg

 

Now that you are SSHed into the BeagleBone Black we will need to prepare GPIO 67 (P8:08). The pinout diagram can be seen below.

 

bbb-pinout.jpg

 

Before we get started with testing, lets take a moment and talk about how the BeagleBone Black's GPIO pins are addressed by the Linux-based Debian operating system. The BeagleBone Black addresses its GPIO Pins by reading the contents of files which are located in the sys/class/gpio directory in the board's operating system. The most basic functionality is to write the pin high or low, and is what we will be doing in this tutorial.

 

To use a GPIO Pin you first need to tell Debian that you are going to use a particular pin in a specific GPIO header. The following code uses GPIO 8.8 as an example, but any GPIO Pin can be accessed by creating these files. Enter the following commands into the BeagleBone Black's terminal.

 

The first thing we need to do is create a new directory called gpio67 in the /sys/class/gpio/sys/class/gpio directory.

echo 67 > /sys/class/gpio/export







































































































 

At this point you will need to let the BeagleBone Black know whether or not the specified GPIO pin is input or output.

echo out > /sys/class/gpio/gpio67/direction







































































































 

With this command, the BeagleBone Black no longer supplies 2.3V to the header and it is considered to be turned off. In order for us to turn on GPIO Pin 67 we need to set its value to 1. To turn it back off again, the value needs to be 0. We can do that with the following commands.

 

Set the GPIO Pin High

echo 1 > /sys/class/gpio/gpio67/value







































































































 

Set the GPIO Pin Low

echo 0 > /sys/class/gpio/gpio67/value







































































































 

Remove control of the GPIO Pin when finished.

echo 67 > /sys/class/gpio/unexport







































































































 

With those basics out of our way, let's move on to testing. Since we already have GPIO Pin 67 setup, and the rest of the circuit above is in order, we just need to give our breadboard power via a 9-volt battery. Connect the 9-volt to the breadboard as shown in the image below.

 

9-volt-power.jpg

 

With everything connected, we should be able to use the command line to set GPIO Pin 67 high, which should in turn activate the transistor and allow the LED to light up.

Set the GPIO Pin High

echo 1 > /sys/class/gpio/gpio67/value

































































































 

If everything was followed correctly, you will see the LED light up

 

LED-Illuminated.jpg

 

Now set the GPIO Pin to low to turn off the circuit.

Set the GPIO Pin Low

echo 0 > /sys/class/gpio/gpio67/value
































































































 

Configuring The Website: Using the internet to control the GPIO Pin.


If you have been following along in my BeagleBone Black series you will recall that my last tutorial demonstrated how to install an apache-based web server on the BeagleBone Black, and how to install and configure a Drupal-based website on top of that web server. For this next part, you will need to follow the steps in that tutorial and get a Drupal 7 website up and running on your BeagleBone Black before continuing with this tutorial.

 

Pull up the previously created website, and login as the administrator by visiting the (my_website_url)/user.

 

There are a few different ways that we can build functionality into our website to control the GPIO pins on the BeagleBone Black. Note that the following methods only work when the website is hosted on the BeagleBone Black. We are going to begin with the two simplest methods. Method one will create two separate pages that run a php script when visited, while method two creates toggle buttons within a single page or block. While these methods work, they are highly vulnerable to security breaches, and should only be used on sites that are not directly open to the public.

 

 

Method One: Controlling the GPIO via separate web pages.

 

Since the BeagleBone Black GPIO Pins are accessible using the command line, we can write a simple PHP script that turns any of the pins on and off using the commands listed above. First, we need to turn on the PHP filter in Drupal. (Note that turning this filter on in Drupal exposes your website to security vulnerabilities, and as such it should only be done on sites not publicly available) Navigate to (my_website_url)/admin/modules/ and scroll down until you see the PHP Filter module under the Core heading. Enable this module by ticking the box to the left, then scroll to the bottom of the page and click save.

 

phpfilter.jpg

Creating the LED On Page

 

With the PHP filter enabled create a new basic page by navigating to (my_website_url)/node/add/page. Fill out the page with the following information, or watch the video embedded below and follow along.

  • Title: LED ON
  • Body:
    • <?php
      exec("/bin/echo \"1\" > /sys/class/gpio/gpio67/value");
      ?>
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
  • Text Format: PHP Code
  • Menu Settings:  Tick the box for Provide Menu Link
    • Menu Link Title: LED On
    • Parent Item: <Main Menu>
    • Weight: 1
  • Publishing Options:  Tick the box for "Published" and make sure the other two options are not checked.

 

Now click the "Save" button at the bottom of the page. If everything was entered correctly, you can return to the home page and there will be a new main menu link called "LED On."

LED ON Menu.jpg

 

Creating the LED Off Page

Now we need to create a web page that turns the LED off. Create a new basic page by navigating to (my_website_url)/node/add/page. Fill out the page with the following information, or watch the video embedded below and follow along.

  • Title: LED Off
  • Body:
    • <?php
      exec("/bin/echo \"0\" > /sys/class/gpio/gpio67/value");
      ?>
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
  • Text Format: PHP Code
  • Menu Settings:  Tick the box for Provide Menu Link
    • Menu Link Title: LED Off
    • Parent Item: <Main Menu>
    • Weight: 2
  • Publishing Options:  Tick the box for "Published" and make sure the other two options are not checked.

 

Now click the "Save" button at the bottom of the page. If everything was entered correctly, you can return to the home page and there will be a new main menu link called "LED Off."

LED Off Menu.jpg

Setting Permissions

With both control pages created, we need to modify the permissions on the gpio67/value directory so that the www-data user (Apache) can write to it. Run the following command from within the terminal.

chmod 666 /sys/class/gpio/gpio67/value






















































 

With this done, we are able to test that everything works. With the transistor's base pin connected to GPIO67 and the 9-volt battery powering the breadboard, you should be able to click on the LED On menu link and the LED will turn on. Clicking the LED Off Menu Link will turn the LED Off. If your LED is not turning on and off, revisit the steps above. Alternatively, you can watch the video below and follow along.

 

 

Method Two: Controlling the GPIO via toggle buttons on a single page or block.


While turning the LED on and off with separate web pages works, it is not the most efficient or best way to do things. This method could come in handy if you wanted to trigger a GPIO event whenever someone visits a webpage, but for general user triggered On and Off use, buttons would be a far better method. To trigger the GPIO pins via web buttons, we will utilize some existing code that I found during a quick search. This PHP code creates two basic buttons that fire off php scripts when pressed. You can view the original code at http://www.berriman.co.uk/beaglebone-black-bbb-simple-web-io/.

 

To make the code work we will need to modify two lines to point to the specific GPIO pin we are using to turn our LED circuit on and off. I have pasted the code you will need to use in the Page Building section below.

 

Creating the LED On / Off Toggle Button Page

Now we need to create a web page that turns the LED off. Create a new basic page by navigating to (my_website_url)/node/add/page. Fill out the page with the following information.

  • Title: LED On and Off Buttons
  • Body:
  • Text Format: PHP Code
  • Menu Settings:  Tick the box for Provide Menu Link
    • Menu Link Title: LED On and Off Toggle Buttons
    • Parent Item: <Main Menu>
    • Weight: 3
  • Publishing Options:  Tick the box for "Published" and make sure the other two options are not checked.

 

Now click the "Save" button at the bottom of the page. If everything was entered correctly, you can return to the home page and there will be a new main menu link called "LED On and Off Toggle Buttons." Click on that page and click the LED On button and then the LED Off Button. The LED should illuminate and then turn off. If this is correct, we can move on, otherwise revisit the steps above.

 

LED bittons.jpg

 

Creating the LED On / Off Toggle Button Block

Create a new block by navigating to (my_website_url)/admin/structure/block/add. Fill out the block with the following information, or watch the video embedded below and follow along.

  • Title: Access LED
  • Block Description: GPIO67 LED Buttons
  • Body:
  • Text Format: PHP Code
  • Region Settings:
    • Bartic (Default Theme)
      • Sidebar First

Now click save block. You can change the weight of this block by visiting the Block Administration page, and navigating to  (my_website_url)/admin/structure/block. Now you will see the LED Toggle buttons when visiting any page on the website. The beauty of this block / button method is that you can now place your GPIO buttons anywhere on the website, and not have to display them as a page.

 

button block.jpg

 

There are many ways to do this that are specific to Drupal, but the PHP code used in this last example will work on any web framework, and can be used independently as well. One of the safer ways to execute this code would be to set up a rule and use a flag to control when each script is run. That is more advanced Drupal development work than I want to get into in this tutorial, but I would be glad to write a separate tutorial on it if there is enough interest. For the advanced Drupal developers out there, you can head over to my Github and download a feature module with this functionality built in. You will still have to create the node, and install some modules though.  In the mean time, I urge everyone to play around with modifying this code, and making some awesome stuff.

 

 

My next tutorial will involve modifying this code to trigger a set of relays, and notification LEDs that can be used to control anything from a basic lamp to a more full featured home automation system.

Banner.jpg

 

When the BeagleBone BlackBeagleBone Black was first released, I was one of the first journalist in the country to receive one, and impressed did not begin to describe how I felt about the little black board. At the time, I was still riding a high from my experiences with the Raspberry Pi, and while the Black lacked the camera and LCD connectors, it made up for it in on-board flash and processing power. Unfortunately I was very disappointed in the Angstrom Linux distro that shipped with the Black, but did manage to flash the board to Ubuntu with the help of a friend at my local MakerSpace. Over the next several months, I played with the Black here and there, and made a few small projects here and there. When revision C of the BeagleBone Black came out running Debian from the factory, I knew I had to have one. It was also around this time that I made a major career change, and left tech journalism for a more lucrative position as a Drupal developer at a friends web development firm. While playing around with my new BeagleBone Black one night, I began wondering how hard it would be to get a web server up and running and if the Black would be able to handle MySQL and Apache2 along with a Drupal Install.

 

Prerequisites: What you need to know to be able to complete this project.

  • Understand how to install packages from the terminal.
  • Understand how a LAMP-based web server works.
  • Understand how Drupal is installed and configured.
  • Understand how RSS feeds work.
  • Understand basic HTML and XHTML.

 

SSHing into the BeagleBone Black via Putty

 

To access the BeagleBone Black via SSH I will be using a terminal for Windows called putty, as well as an addon called MTPutty which allows me to run multiple putty instances from within a single tabbed interface. Both Putty and MTPutty are available for free, and take just a few moments to download and install. Chances are, if you are reading this, you already know how to use Putty. If you are using a Mac you can simply use the built-in terminal to access your Black Via SSH. To connect to your Black, you need to enter the following credentials.


Putty-Config.jpg

With these settings configured, click ok and then double click the BeagleBone Black name in the server list. This will open up a new terminal tab and you will be prompted to enter a username. Unless you have modified the root user, you should enter root as the user name.

 

Putty-connect-2.jpg

 

BeagleBone has made it easy here as there is no password and after entering the username, the connection will finish, and you will be placed in your "home" directory.

Putty-connect-3.jpg


To get things started, I first needed to get MySQL installed and running on the BeagleBone Black, and I will be perfectly honest in saying that it was no easy task starting off. Since revision C of the Black runs Debian Wheezy from the factory, I knew that apt-get install would be used to install new packages now where as opkg was used with the Angstrom distro on earlier models. Unfortunately that is where I began running into problems. When I would run anything via apt-get install the whole install process would run, but then quickly error out due to a script called led_aging.sh causing an error. After almost an hour of pulling my hair out, and searching the web, I found a thread in a mail archive where someone was having the same problem. As it turns out the script was missing some of its functions, and that was causing the dkpg error, but why a seemingly random script was causing apt-get install to fail is beyond my pay-grade. If you are interested in seeing the original mail archive with the information, it can be found here. I am going to cover this fix below for convenience though.


If you get an error surrounding the led_aging.sh script when running apt-get install on your BeagleBone Black, or during any terminal process, you will need to modify that script to include some missing functions. The process to do this is found below, but you will need a basic understanding of the Linux file structure and how to modify files via the terminal to complete this. You can also check out this code on github.

 

  • From your home directory navigate to /etc/init.d and then nano the led_aging.sh file that is inside the init.d directory.
  • Replace all of the code inside the led_aging.sh file with the following code.
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: led_aging.sh
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start LED aging
# Description: Starts LED aging (whatever that is)
### END INIT INFO

x=$(/bin/ps -ef | /bin/grep "[l]ed_acc")
if [ ! -n "$x" -a -x /usr/bin/led_acc ]; then
  /usr/bin/led_acc &
fi


























































































 

  • Then exit out of nano, keeping the filename the same as it was.

 

This should have fixed the issue that pops up when trying to run an apt-get install command. Now that we have that error taken care of, lets move on to the rest of the project.

 

Installing and Configuring the Web Server

 

There are a few packages we need to install in order to get our web server up and running to be able to serve a Drupal installation. The packages we need to install are listed below.

  • MySQL Server
  • MySQL Client
  • Apache2

 

Before we get started, we need to make sure that Debian is up to date with the latest libraries, and doing that is as simple as running the following command.

 

apt-get update


























































































 

This will automatically download and install the latest update for the version of Debian that is running on the BeagleBone Black.

 

With the distro updated, we can now install MySQL Server and MySQL Client with a single command. For those of you following along at home, MySQL is the database of choice for Drupal installations, but you could run MariaDB, postgresql, or another variant of MySQL. To keep things simple and standardized, we will be running MySQL. To install both packages, use the command below.

apt-get install mysql-server mysql-client


























































































 

This will run through the install process. You will be prompted with some password creation prompts and you can set the passwords to whatever you wish, but make sure to write them down as they will be needed later.

 

With MySQL installed, its time to install Apache2 run the following command

apt-get install apache2

























































































 

Let the install process finish, and grab something to drink in the meantime. When the install finishes, install the following packages.

apt-get install php5
apt-get install php5-mysql
apt-get install php5-gd
apt-get install libapache2-mod-php5 
apt-get install php5-curl

 

With those packages installed, we can move on to building a Drupal-based website on the BeagleBone Black.

 

Installing and Configuring a Drupal-based Website

 

In the terminal, navigate to the srv/www directory, and create the directory in which we will install the Drupal instance too. We will need to create several sub-directories as well, including backup and error log directories as well as the website doc root.

cd /srv/www
mkdir bbb.news
cd /srv/www/bbb.news























































































 

Now create the sub directories using the commands located below

mkdir backup
mkdir download
mkdir logs























































































 

While only two of these directories are really needed, I prefer to follow what I consider to be best practice when installing drupal on any server. The backup directory is used to backup the website's database, making life much easier when things go bad. We will use the download directory to download the Drupal install tarball to. The logs directory will house two required error log files, and the htdocs directory will be where our website resides.

 

While we are at this level of the file structure, lets go ahead and create two files that apache will need later. Navigate to the logs directory and enter the two touch commands below.

cd logs
touch access.log
touch error.log























































































 

This creates the needed log files that will help troubleshoot issues if they occur.

 

With these files created we can navigate back to the main bbb.news directory and then into the download directory.

cd ../download























































































 

Once inside the download directory, we can use the wget feature to grab a fresh copy of the latest version of Drupal 7. While Drupal 8 is right around the corner, I chose to go with Drupal 7 because it is the most widely adopted version at the moment and has the most module support currently. Follow the commands below to download Drupal and untar it into the htdocs directory.

wget http://ftp.drupal.org/files/projects/drupal-7.32.tar.gz
tar -zxvf drupal-7.32.tar.gz
mv drupal-7.32 ../
mv drupal-7.32 htdocs

 

Now verify that the files were successfully extracted to the htdocs directory by entering the following commands and matching up your directory with the screenshot below.

cd ../htdocs
ls























































































 

drupal-root1.jpg
If the extraction was successful, you should see something similar to this.

 

Now we need to navigate to the sites/default directory and copy the default.settings.php file and rename it to settings.php, then set the permissions on the settings.php file to 777.

cd sites/default
cp default.settings.php settings.php
chmod 777 settings.php















































































 

To finish getting our Drupal site ready we need to build a database for it to store things in. You will need the MySQL username and password that you set up earlier in the tutorial for this. Use the following commands (with your unique credentials) to build the database we will use for the Drupal installation.

mysql -u (username) -p (password)














































































 

That should drop you into the MySQL terminal and from here you can create the database with the following commands.

create database (database_name);
grant all on (database_name).* to '(database_username)' identified by '(database_password)';














































































 

If everything was entered correctly, then you should see a line returned with the following command Query OK, 0 rows affected (0.00 sec) .  Be sure to write down the database name, database user name, and database password as you will need them shortly. If things are correct, you can now exit the MySQL terminal using the following command.

exit









































































 

Now lets set up the vhost file for our newly installed website. Navigate to the apache2/sites-available directory using the following command.

cd /etc/apache2/sites-available









































































 

Now we need to create a new virtual host file (vhost) for our newly installed drupal website. To do this, we are simply going to use the touch command to create the file. If you want to be able to access the website you are building from an external network, you will need to configure a new A-record on a domain name that you own, and point it to your home's IP address, then forward the ports in your router to the BBB for that domain name. I wont cover those aspects in this tutorial, but the internet is full of valuable resources that will help you along the way. For the purpose of this tutorial, I have already completed these steps, and that is why you see the charlesjgantt.com domain attached to the vhost. When doing this on your own, simply replace my domain name with yours. I will post some screen shots of what my setup looks like, to help you along though.

touch bbb.news.charlesjgantt.com




































































 

Now run an ls command to verify that the file was created.

ls



































































 

vhost1.jpg

If the file was created correctly, you should see it here.

 

Now we need to edit the file and paste in a few lines of text. Nano into the bbb.news.(your_domain.com) and paste the following text. Remember to remove the (your_domain) and replace it with your domain url.

nano bbb.news.(your_domain.com)


























































 

<VirtualHost *:80>

    ServerAdmin webmaster@(your_domain).com

    ServerName bbb.news.(your_domain).com

    DocumentRoot /srv/www/bbb.news/htdocs

    ErrorLog /srv/www/bbb.news/logs/error.log

    CustomLog /srv/www/bbb.news/logs/access.log combined

</VirtualHost>

 

Now save and exit out of nano by pressing ctrl+x and y when prompted then saving with the same name.

 

You have successfully created a proper Virtual Host file for the new Drupal site. Now we need to enable that site using the following command. Once enabled, apache will need to be restarted.

a2ensite bbb.news.(your_domain).com
service apache2 reload























































 

Below are the screenshots I promised of my A-Record entry in my DNS settings for charlesjgantt.com as well as the port forwarding settings in my router.

a-record settings.jpg

Your A-Record can be found in the DNS settings of your domain. Simply give it the sub-domain name you wish to use, and then point it towards your home IP address. (Mine has been blurred out for security purposes.)

portforwarding3.jpg

 

Now enter your router's settings and find the port forwarding settings. You want to point the port you set in the V-Host file (80) to port 80 on your router. After saving this, you may need to reboot your router depending on its model.

 

In preparation for the BB View_70 LCD we will cover later in this tutorial, we need to disable a few services on the BBB to ensure that port 80 is free to serve our new website.

systemctl disable bonescript.service  
systemctl disable bonescript.socket
systemctl disable bonescript-autorun.service
systemctl disable avahi-daemon.service 
systemctl disable cloud9.service  
systemctl disable gateone.service 




















 

With these items finished, we are ready to test the website and see if it works. From within your local network, open up a browser such as Chrome and visit http://bbb.news.(your_domain).com:80 and if everything is correct, you should be prompted with the drupal install page as seen below. You will have to select your preferred language, and then if the steps above were followed, you will be taken to the Database configuration tab. Select MySQL, and then enter the correct Database Name, Database Username, and Database Password that you set up a few minutes ago.

dbconfig.png

Now click save and continue, and proceed to fill out the requested information on the final few pages. When finished you should be prompted to visit your new website which should look something like this!

bbb.button.jpg

 

Now that we have the news website up and running on the BeagleBone Black, we need to begin importing "News" content to it. Before we can do that, we need to install a few modules and to make life easier, we are going to install a utility called Drush (Drupal Shell) that will make life much easier moving forward. While seasoned Drupal Developers will certainly cringe at the method I am about to use to install Drush, it will work fine for this tutorial. To install Drush using the preferred method, visit the install instructions found at https://github.com/drush-ops/drush

apt-get install drush




































 

Before we can install any modules we need to modify the permissions on the modules directory, and then create two new directories.

chmod -R 777 sites/all/modules
cd sites/all/modules
mkdir contrib
mkdir features




































 

When the Drush install finishes, navigate to the websites root, and then use the drush pm-install and pm-enable commands to install the needed modules. The final command we will run in this set will clear all of Drupal's various caches.

cd /srv/www/bbb.news/htdocs
drush dl admin_menu adminimal_admin_menu module_filter features feeds feeds_tamper feeds_imagegrabber job_scheduler strongarm context
drush en admin_menu adminimal_admin_menu module_filter features feeds feeds_tamper feeds_imagegrabber job_scheduler strongarm context -ydrush cc all




































 

With those modules installed and enabled, hard-refresh the webpage and then visit the modules page to verify that everything we needed was properly enabled. Go through the list and make sure that Context, Context UI Features, Feeds Admin UI, Feeds Import, Feeds News Feeds Tamper Admin UI, Feeds Tamper, Feeds, Feeds Image Grabber, Job Scheduler, Job Scheduler Trigger, and Strongarm are enabled.

modules_page.jpg

 

With all the necessary modules enabled, we can move forward and build a feed importer that will allow us to pull in news from any website with an RSS feed. For the purpose of this tutorial, I am going to pull new content from Element14's All Content RSS Feed which can be found at http://www.element14.com/community/groups/feeds/allcontent. I am also going to pull in a feed of the newest 3D models uploaded to httphttp://www.thingiverse.com. To keep all of this organized, I need to create a new content type for the Thingiverse feed. Before I decided what I would be importing, I named this new content type "Tech News" but its sole purpose is to import from Thingiverse, so ignore the name and make yours whatever you want.

 

To get started creating the new content type and feed, follow along with the videos below.

 

 

 

 

 

I apologize for not being able to show the Thingiverse Feed creation. At the time of recording, the Thingiverse RSS feed had a bug that prevented me from mapping the elements correctly, but basically it is the same as creating the previous feed, but involves using Feeds Tamper, and Feeds Image Importer to get the images displaying correctly. A quick good search will show you the best way to utilize these extension modules.

 

Now that we have the feeds importing, and the site is up and running as it should, lets take a moment and look at how we can add the BB View_70 7-inch Touchscreen LCD CapeBB View_70 7-inch Touchscreen LCD Cape to create a desktop rss news reader.  For those of you who are new to the BeagleBone Black, the BB View_70 is a 7-inch 18-bit, 800x480 resolution LCD screen with a 4-wire resistive touchscreen digitizer on top. The Cape features two user-defined LEDs, and five tactile switches of which 4 can be user defined.

c8bd85ad871e36df5647ba9f3588e75c.png

 

Originally, the BB View_70 ran on the Angstrom distro, but with Debian being added as the default OS in revision C of the BeagleBone Black, the BB View_70 cape is easier than ever to get up and running. I could cover that entire process here, but it is actually very thoroughly covered in the BB View User Manual beginning at page 23. Note that if you run the BB View_70, you will need to supply an external 5V 1amp power source to the BeagleBone Black before the screen will turn on.

 

bbb-stand-2.jpg

 

For those of you with access to a 3D Printer, you can head over to Thingiverse and download the BBVIEW 7 LCD + Beaglebone Black Stand by Chumsize. This stand provides a clean way to securely and safely mate the BeagleBone Black and the BB View_70 together. The stand holds the screen at the perfect angle for both viewing and touch screen navigation. The stand takes about 35 minutes to print on a decent printer running at about 80mm/sec and uses hardly any ABS filament. I did find that the holes designed to capture the standoffs need a bit of cleaning, and you will need to heat the standoffs with a cigarette lighter or soldering iron and then press them into the holes for a more secure fit. Overall I think this stand is one of the coolest things I have ever printed, and it has made my development time with the BB View_70 much easier.

 

bbb-stand-1.jpg

 

I'm a screen junky and at my home office, I have tripple 24" monitors, with about 30 tabs open in each at any given time. I know this is excessive, but having this little news reader on my desk really does make life easier. As an additional bonus, since it only imports the latest 10-items every hour, I spend less time down a news rabbit hole, and more time working. I hope this tutorial was as informative as I hoped it would be, and I would love to hear from anyone who makes their own news reader, or takes these instructions and builds something completely different. I have a few more tutorials coming out in the next couple of weeks that will build upon this basic starter, such as learning how to control the BeagleBone Black's GPIO pins via the internet using Drupal. Until then #HackTheWorld & #MakeAwesome!

 

final.jpg

Hello,

 

I've got a Sensor Connection Cape (GVS) for the Beaglebone Black up on Kickstarter. Here is a picture of the card:


BBB-GVS-X3-cca-01B.jpg


Here is a video demonstration of the card.



Thanks,


Doug Gilliland.

logo.pngstachedog.png

 

Intro

This Demo will take a fresh from the box element14 BeagleBone Black with the preinstalled Debian system and configure it to work with BB-View. Subsequently we will use this new setup to attach virtual moustaches to passers-by

 

Equipment Required

e14 BeagleBone Blacke14 BeagleBone Black

BB-View 4.3"4.3" or 7"7"

5v PSU5v PSU

UART8000-UUART8000-U (Optional QOL improvement)

USB memory stick

Playstation 3 camera

 

Downloads

Debian patch files

Linux tools

BeagleStache

 

Setup

 

Extract the files from the Debian Image archive to a USB stick

 

Connect the BeagleBone black to your PC via either the UART8000-U or the included USB cable

USB.pngUART.PNG

 

Connect the 5V PSU

PSU.png

 

While the board is booting, ensure PuTTY is installed on your computer and start the software. The settings for each connection type vary:

Ethernet over USB: uses an SSH connection via the default IP address of 192.168.7.2

UART8000-U: The COM port will vary, the correct port can be found in the Windows Device Manager (for more information on this please see the UART8000-U guide). The other settings are shown in the image to the right.

serial settings.PNG

 

Once the board has had time to boot you can go ahead and click "Open" on the main screen of PuTTY to open a connection to the board. From here on all the commands are uneffected by your chosen connection method. There is a slight inconveniance when connecting via SSH using the Ethernet over USB as the connection will need to be re-established each time you reset the board

SSH error.PNG

BB-View Patches

 

In the terminal window enter the following commands (as per the BB-View user manual):

mkdir /media/udisk
mount /dev/sda1 /media/udisk
cp -f /media/udisk/zImage /boot/uboot
cp -f /media/udisk/*.dtb /boot/uboot/dtbs
tar -xvf /media/udisk/kernel_modules.tar.gz -C /
cp -f /media/udisk/xorg.conf /etc/X11/
sync












If you are using the 4.3" screen with your BB-View than you are good to go! However the 7" screen requires a little more configuration, enter the following commands into PuTTY:

cd /boot/uboot/dtbs
cp am335x-boneblack-lcd7.dtb am335x-boneblack.dtb
rm /etc/pointercal*
sync












Now shut down the BeagleBone and connect the BB-View along with the screen, then supply power.

You should now have a working BB-View & BeagleBone Black system running Debian

Ethernet

 

After applying the BB-View patch the ethernet is disabled by default to improve boot times. If required, the Ethernet can be re-enabled with a simple edit, use nano to edit the following file:

nano /etc/network/interfaces












Then find the lines:

#auto eth0
#iface eth0 inet dhcp












and uncomment them by removing the # to read:

auto eth0
iface eth0 inet dhcp












After this save and exit then:

sync
reboot












Moustache Time!

(From my list of titles I never thought I would write)

 

A full set of instructions for adorning people with virtual moustaches can be found at BeagleBoard.org - BeagleStache however they are repeated below, with slight modifications to make the project BB-View compatible.

    1. Clone the GitHub repository and build the code with the following commands
      git clone git://github.com/jadonk/stache
      cd stache
      make && make install
    2. Because the BB-View by default operates as the user "Debian" instead of root, the following commands are required to operate BeagleStache:
      mkdir /home/debian/stache
      cp -r /root/stache/* /home/debian/stache
    3. To make the running of BeagleStache a little easier you can create a shellscript on your desktop containing the following:
      #!/bin/bash
      sudo /root/stache/runstache
    4. Now plug in the camera ,doubletap your new desktop script and enjoy your moustachey exploits!
bs.png

openrov 1.jpg

OpenROV open-source submarine (via OpenROV)

 

What happens when an entire community comes together to help one man discover underwater treasure? Quite possibly one of the best maker projects ever devised is born, that’s what. Meet OpenROV, an open-source exploration submarine created for the DIY community, powered by a BeagleBone!

 

The OpenROV project began when Eric Stackpole wanted to explore a cave near his home that was rumoured to have buried treasure. When neighbors got wind of his idea, everyone was willing to help (go figure). The real magic, however, began when scientists heard about the idea of creating a tiny, open-source submarine and got to thinking.

 

Makers, engineers and scientists from more than 50 countries banded together to make Stackpole’s dream a reality. Why? Because an open-source robot can be programmed to do just about anything. Scientists believe they can program the OpenROV to do everything from monitor pollution under the sea to discovering new aquatic species. Plus, Stackpole gets to hunt for gold too. It’s a win-win.

 

openrov 2.jpg

(via OpenROV)

 

The robot is 30cm long, 20cm wide and 15cm tall and it looks just like what you always hoped Scuba Steve would use during his underwater explorations. It weighs in at 2.5kg and was designed to withstand depths of up to 100m, although its only been tested at 20m.

 

openrov 3.jpg

OpenROV in action underwater (via OpenROV)

 

The DC-powered design features a single 10cm by 18cm waterproof tube that protects all electronics and equipment from water damage and it can move horizontally, vertically and diagonally with the help of three 800kv brushless motors, two horizontal thrusters and one vertical thruster. It’s also fully controllable via computer keyboard or USB controller.

 

At its heart is a BeagleBone single board computer and their OpenROV BeagleBone Cape. Does that mean they want you to experiment with their cape? It looks like it.

 

The robot is fully functional in both fresh and saltwater and moves at 1m/s. It is still, unfortunately, an energy guzzler, as it takes 8 on-board C batteries for every 60-90 minutes of activity, but improvements are in the works.

OpenROV successfully completed its Kickstarter campaign on Friday and is looking to make several improvements to the design in the near future, including more efficient propellers and better resistance to rusting caused by salt water.

There’s no word on what the final product will retail ─ it is still largely an experiment. Once the kinks are worked out it should launch for the general public, but for now if you’re lucky enough to find one you’ll have to tinker with it yourself. This does, however, grant you the freedom to program it to do your evil bidding. There’s no underwater lair you won’t be able to discover. Fight evil responsibly.

 

 

C

See more news at:

http://twitter.com/Cabe_Atwell

Filter Blog

By date:
By tag: