• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeBeagleboardUse Linker Kit on Beaglebone with Linker base shie ...
Previous Next

Use Linker Kit on Beaglebone with Linker base shield for Beaglebone

Posted by: Patrick Liu , August 12, 2014

[vc_row][vc_column][vc_column_text]Linker kit  is a set of LEDs, sensors, actuators, displays, etc modules that defined to have a common interface. It makes very convenient to conduct projects without the breadboarding or  soldering. In this post, we will look at how to use linker kit modules on beaglebone with the help of a linker base shield that is designed for beaglebone.

LB_BGL_2

 

There is a jumper header on the linker base shield for Beaglebone to select the logic level of the interface to be 3.3V or 5V.[/vc_column_text][vc_tour][vc_tab title=”Preparation ” tab_id=”1407893559-1-84″][vc_column_text]1. Software environment

 

We are going to use the Adafruit Beaglebone IO python by issuing the following commands on a terminal on Beaglebone:

$sudo apt-get update
$sudo apt-get install python-imaging python-imaging-tk python-pip python-dev git
$sudo pip install Adafruit_BBIO

To check if the installation is successful or not by typing:

$python 
$import Adafruit_BBIO

python

 

2. Hardware

  • 1  x Linker kit base shield for Beaglebone
  • 1 x Linker LED
  • 1 x Linker Button
  • 1 x Linker Potentiometer
  • 1 x Linker cable

 

 

 

 

[/vc_column_text][/vc_tab][vc_tab title=”GPIO: Output” tab_id=”1407893559-2-48″][vc_column_text]Connect Linker LED to Digital interface of Linker base shield:

 

GPIO_output

 

Python source code:

#!/usr/bin/python

import Adafruit_BBIO.GPIO as GPIO
import time

print 'linker led modle'
print 'linker led connected to digital port'
time.sleep(2)

led_pin = "P9_42"

GPIO.setup(led_pin,GPIO.OUT)

while True:
	GPIO.output(led_pin,GPIO.HIGH)
	time.sleep(0.2)
	GPIO.output(led_pin,GPIO.LOW)
	time.sleep(0.2)

After running the code, we can observe that LED is blinking:

LEDBlinking[/vc_column_text][/vc_tab][vc_tab title=”GPIO: Input” tab_id=”1407899811989-2-5″][vc_column_text]Connect Linker button to Digital interface of Linker base shield:

GPIO_input

Python code:

import Adafruit_BBIO.GPIO as GPIO
import time

value = 0

print 'linker button modle'
print 'linker button connected to digital port'
time.sleep(3)

GPIO.setup("P9_42",GPIO.IN)

while True:
	if GPIO.input("P9_42"):
		value += 1
		print 'Press the button %2d times'%(value)
	time.sleep(0.2)

After running the code, press the button multiple times, the following information will be displayed:

 

python_2[/vc_column_text][/vc_tab][vc_tab title=”ADC” tab_id=”1407900366657-3-7″][vc_column_text]Connect Linker Potentiometer/slider to Analog port A2:

ADC_connection

 

Python Sample code:

#!/usr/bin/python

import Adafruit_BBIO.ADC as ADC
import time

print 'linker potentiometer modle'
print 'linker potentiometer connected to Analog1 port'
time.sleep(3)

ADC.setup()

while True:
	value = ADC.read("AIN2")*5.0
	print round(value,2),'V'
	#print ADC.read("P9_39")
	time.sleep(0.1)

After running the code, when we slide the slider, the ADC value will be printed in the terminal:

 

ADC_python[/vc_column_text][/vc_tab][vc_tab title=”PWM” tab_id=”1407901156201-4-0″][vc_column_text]Connect Linker LED to PWM port of Linker Beaglebone base shield:

PWM_connection

Python Code:

#!/usr/bin/python

import Adafruit_BBIO.PWM as PWM
import time

value = 0

print 'linker led modle'
print 'linker led connected to digital port'
time.sleep(3)

PWM.start("P9_14",0,1000,1)

while True:
	for i in range(0,100):
		PWM.set_duty_cycle("P9_14",i)
		time.sleep(0.01)

	for i in range(100,0,-1):
		PWM.set_duty_cycle("P9_14",i)
		time.sleep(0.01)

PWM.stop("P9_14")
PWM.cleanup()

After running the code, we can observe the breathing LED.

breathing_LED

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Beagleboard

Share!
Tweet

Patrick Liu

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors