BBBK Programming Notes Rudra Dutta CSC , Fall, 2013
Beyond Hello LEDs More general purpose programming on the BBBK Communication with other platforms – sockets Compiling remotely and pushing Sensor reading – Using pins and modes – General analog sensor strategy General starting point: When all else fails, read the manual – Black/blob/master/BBB_SRM.pdf?raw=true Black/blob/master/BBB_SRM.pdf?raw=true
Virtual Box, Ubuntu VM Step1: Install Ubuntu LTS on VirtualBox ( Ubuntu disk image and VirtualBox software from the following links has been tested by TA): – VirtualBox: ( VirtualBox Win.exe) from storage/virtualbox/downloads/index.html#vbox VirtualBox Win.exe storage/virtualbox/downloads/index.html#vbox – Ubuntu LTS from: Step2: Enable USB in Guest Machine i. Install Ubuntu GuestAdditions: (In Guest Machine: Devices->Install Guest Additions ) ii. Install Install Virtualbox Extension Packs (Oracle_VM_VirtualBox_Extension_Pack ) from Download and save extension pack software in your computer(host machine) In VirtualBox: File->Preferences->Extensions Then click the add package button and provide path 3
Socket programming on BBBK WiFi Socket programming on BBBK WiFi – Enable WiFi on BeagleBone Black Step1: Power the BBB with power supply that is able supply at least 2A and ssh into it via usb or Ethernet Step2: On the BBB, Create a directory named rtlwifi under /lib/firmware/ (go to the /lib/firmware/ directory and type mkdir rtlwifi) Step 3: Go to you should be able to see the following fileshttp://nordicgroup.us/bbb/wireless/rtlwifi/ Download all of them(10 files ) to the folder created on step2( /lib/firmware/rtlwifi/ ) 4
Socket programming on BBBK WiFi – Enable WiFi on BeagleBone Black…cont Step 4: Plug in the Wi-Fi dongle Step 5: Enable WiFi in /var/lib/connman/settings Example: 5
Socket programming on BBBK WiFi Socket programming on BBBK WiFi – Enable WiFi on BeagleBone Black…cont Step 6: Create /var/lib/connman/wifi.config and edit configuration file as shown in the example below Save and close file 6
Socket programming on BBBK WiFi – Enable WiFi on BeagleBone Black…cont Step 7: Restart connection manager service, using following command systemctl restart connman.service Example: Step 8: Reboot the BBB, the LED on the WiFi dongle should light up. : Step 9 : The wired ssh connection to the beagle bone will get broken when you reboot. Give it about a minute or so after the wifi dongle lights up and ssh again using wired connection. Run ifconfig to see if the wireless interface has been connected If not connected, press the reset button on bbb and repeat step 9 above again Example: 7
Socket programming on BBBK WiFi – Enable WiFi on BeagleBone Black…cont For more details, – – 8
BBBK programming – push from Ubuntu Eclipse Video tutorial Additional Resource: 9
BeagleBone Black Expansion Connectors The BeagleBone Black provides two 46-pin dual row expansion connectors “P9” and “P8”, which are also known as “Expansion A” and “Expansion B” respectively Location and pinout of these connectors are as shown
Pinout Tables for Expansion Headers The pinout tables for P8 and P9 show functions offered by each of the pins The functions vary based on the mode setting for each pin. Pin modes can be changed if required (this is an advanced task) The function associated with a pin and a mode changes the maximum voltage at each pin Be careful! If you send higher voltage than the maximum listed for that pin and mode, you will damage the BeagleBone Black!!
Pinout Tables for Expansion Headers The PROC column is the pin number on the processor The PIN column is the pin number on the expansion header The MODE columns are the mode setting for each pin – Setting each mode to align with the mode column will give that function on that pin Pinout tables can be found on the BeagleBone Black System Reference Manual Useful GitHub Resource:
P8 Pinout
P9Pinout
Power Limitations Power limitations on the pins for different modes Note that Analog Input (AIN) pins are 1.8V, while GPIO pins are 3.3V
Checking and Selecting Pin Modes Check Pin Statuses To control digital input/output, and read values from different pins, you can use facilities in the /sys/class/gpio directory. For further details: Setting Pin Modes – In general, it should be possible to use default pin modes. For some cases you may need to set the modes. You would have to write and compile a Device Tree Overlay. Details can be found at:
Reading sensors : Alcohol Gas Sensor Alcohol Gas Sensor: Schematic diagram For more details:
Reading sensors : Alcohol Gas Sensor Wiring Diagram for connecting with BeagleBone Black Maximum voltage to AIN (analog input) in BeagleBone Black is 1.8V, therefore values of R1 and R2 must be selected to ensure that the voltage at the AIN does not exceed 1.8V
Reading sensors : Alcohol Gas Sensor Mapping to BBB pins and values of R1 and R2 used in testing: For more options on pin mapping please refer to expansion header specifications from BeagleBone Black Specifications Reference Manual. From BeagleBone Black Wiki ( R110K R24.7K GNDPin 1 of expansion header P9 5VPin 5 of expansion header P9 AIN0Pin 39 of expansion header P9
Reading sensors : Alcohol Gas Sensor After connecting the sensor to the BBBK, sensor readings can be obtained by reading the corresponding device files Path to device files can be found at: values-on-beaglebone-black/ values-on-beaglebone-black/ Additional resources: Note: This YouTube tutorial is for the BeagleBone (not “Black”), so the path to the device files are different. But the general approach is similar
Reading sensors :Triple Axis Accelerometer Triple Axis Accelerometer Breakout - MMA8452Q Schematic diagram(from -Breakout-v11-fixed.pdf): -Breakout-v11-fixed.pdf
Reading sensors :Triple Axis Accelerometer Wiring Pin 3 on P9 Header Pin 20 on P9 Header Pin 19 on P9 Header Pin 1 on P9 Header
Reading sensors :Triple Axis Accelerometer Testing: – Install IC2 tools, run the following commands – opkg update – opkg install i2c-tools – detect or probe IC2 bus, run the following commands – ic2detect – ic2detect –l – check functionalities ic2 bus, run the following commands – ic2detect -F 1 – detect or probe devices on a particular bus, run the following commands – ic2detect -r -n, where n the ic2 bus adapter number Sample output after a ic2 device is connected. => Device is at address 40 now Sample output before a ic2 device is connected.
Reading sensors :Triple Axis Accelerometer Testing..cont: – View data(readings) from the i2c device, run following command – i2cdump n address - where bus= i2c bus number, address HEX address of the connected device, we get by running icmpdetect –r -n Example: for the example in previous page, where n = 3 and the device address in at x40, run : i2cdump 3 0x40 Sample output : When we move the sensor, we observe some values of the displayed registers change. Detailed description of register address maps and content of those registers can be found in the data sheet of MMA8452Q accelerometer starting page 18.
Additional Resources – Using i2c-tools with Angstrom Linux on the BeagleBone Black with-angstrom-linux-on.html – Beaglebone: An I2C Tutorial: