Wireless Arduino Control Using the BeagleBone Black or Arduino

Hey Guys!! Today my topic is on Wireless Arduino Control using Beaglebone Black. Before beginning with the steps, we will first go through what beaglebone black is. In simple words, it is a low-cost credit-card-sized development platform with good support from a fast growing community. The Beaglebone Black differs slightly from the regular version by providing you with an onboard micro HDMI port, 512MB of DDR3L DRAM, 4GB onboard flash memory, an AM3358 processor at 1GHz, and making JTAG optional with a user supplied header. Ultimately, the Beaglebone Black is still perfect for physical computing and smaller embedded applications.

beaglebone-black-robomart

Features of Beaglebone Black:

  • AM3358 1GHz ARM Cortex-A8 Processor
  • 4GB 8-bit eMMC Onboard Flash
  • 3D Graphics Accelerator
  • NEON Floating-Point Accelerator
  • 2x PRU 32-bit Microcontroller
  • Connectivity: USB Client for power and communications, USB Host, Ethernet, micro HDMI, 2×46-pin headers
  • Software Compatibility: Angstrom Linux, Android, Ubuntu, Cloud9 IDE on Node.js with BoneScript and still many more…

For wireless Arduino control, parts requisite for assembling are:

  1. BeagleBone Black Microcontroller with the image installed.
  2. Arduino.
  3. HC-06 Bluetooth Slave Module.
  4. A Plugable USB-BT4LE Bluetooth 4.0 USB Adapter.
  5. Three 1k Ohm resistors.
  6. A copy of the PyMata Software Library, version 1.58 or greater
  7. An external 9 volt power source for Arduino.
  8. An external 5 volt power source for BeagleBone Black

Step 1: Using the Arduino to Program the HC-06 for 57600 BPS

interfacing-hc-05-module-with-arduino

We are running PyMata on the beaglebone black to control the arduino. Therefore, in that case we need to change the speed of the HC-06 to 57600. The HC-06 has a default baud rate of 9600 bps.

Prepare connections to program the HC-06

  1. The blue wire that’s connected to pin 1 (TxD) of the Arduino in the diagram, should be moved to Pin 4.
  2. The yellow wire connected to pin 0 (RxD) of the Arduino, should be moved Pin 3.

AS Make sure that you connect the HC-06 VCC pin to the 3.3 volt pin of the Arduino, since the HC-06 is a 3.3 volt device. Also, make sure that you create the voltage divider using the three 1k Ohm resistors. The divider is needed because Arduino output pins provide 5 volts and not the 3.3 volts the HC-06 require. If you were to connect the Arduino TxD pin to the HC-06 RxD pin without the divider, you might damage the HC-06.

Once the programming is complete and you are satisfied with its success, return the blue and yellow wires to their original positions as shown in the illustration. Also, disconnect the USB cable from the Arduino and power the Arduino with an external 9 volt power source. This is to prevent having a signal conflict between the USB interface and the HC-06 device for Arduino pins 0 and 1.

Step 2: Configuring the BBB or RPi for Bluetooth Operation

Let’s get started:

I will use the word device to mean either the BBB or RPi in the following discussion

  • Disconnect the USB cable and/or power from the device.
  • Plug the USB Bluetooth Dongle into the device.
  • Connect an Ethernet cable to the device.
  • Power the device using an external 5 volt supply.
  • “ssh” into the device from your PC by typing the following:

  • Make sure the Dongle is recognized by entering the following command:

  • You should see an entry that looks something like the following for the Dongle:

  • Do an apt-get update.

  • Install the bluez package.

  • After installation, the bluetooth service should have started and you will see a screen that looks like:

  • Make sure that the HC-06 is powered up. Its LED should be blinking.
  • To find the HC-06 MAC address, type the following (this may take a few moments):

Write down the mac address. We will need it for the next step.
Using you favorite text editor, open up /etc/bluetooth/rfcomm.conf and modify it as follows:

  • Save and close the file.
  • Pair the Dongle with the HC-06. This command is being issued in the background by the “&” appended at the end of the command. 1234 is the default pairing address used by the HC-06.

  • Finally connect your device to rfcomm, using the mac address you wrote down above. Notice that this command is run in the background, as was the previous command:

  • You are now ready to use Bluetooth.
  • From this point forward, to start Bluetooth, you only need to type the rfcomm connect.

Step 3: Installing PyMata on the BeagleBone Black or Raspberry Pi and a Firmata Sketch on the Arduino

pymata-setup-01

 Installing PyMata on the BeagleBone Black or Raspberry Pi :

  • Download the latest version of PyMata onto your BBB or RPi.
  • Unzip the file, and install the library described in PyMata_Install_Instructions.pdf, located in the PyMata documentation directory.

Installing a PyMata Compatible Sketch on the Arduino :

  • Temporarily remove the HC-06 leads from pin 0 and 1 of the Arduino and reconnect the USB cable to the Arduino.
  • On your PC, install the Arduino libraries located in the PyMata ArduinoSketch directory as described in PyMata_Install_Instructions.pdf
  • Upload FirmataPlus to the Arduino.

Note For Leonardo Users :

  • You must upload FirmatPlusLBT for Bluetooth operation instead of FirmataPlus.
  • Remove the USB cable and reattach the leads to pin 0 and 1.

Step 4: Running A Quick “Hello World” LED Blink Test

led-blinking-using-hc-05-

On the BBB or RPi, go to the PyMata examples directory and using your favorite editor, open pymata_blink.py. Modify the existing code from:

to:

pymata-setup-01

And finally, to start the script, on the BBB and blink the LED on the Arduino, type: python ./pymata_blink.py

There are some time delays involved, so be patient while this script runs. You may see some exceptions after PyMata close(). If you do, these can be ignored.

BUY HC-05 BLUETOOTH MODULE

For any assistance or Query regarding Beaglebone Black Project, Viewers can Log on to Our Website : www.robomart.com & Receive all essential information.

Thanks,

RoboMart Team