SlideShare a Scribd company logo
HANDS ON EMBEDDED LINUX WITH
BEAGLEBONE BLACK
Daniele Costarella

Ex Carcere Borbonico (Avellino) – October 25th, 2013
October 25th, 2013

Linux Day 2013

2

What is BeagleBone Black?
BeagleBone Black is a $45 MSRP community-supported development
platform for developers and hobbysts. Boot Linux in under 10 seconds
and get started on development in less than 5 minutes with just a single
USB cable.
October 25th, 2013

Hardware
Processor: AM335x 1GHz ARM® Cortex-A8
•  512MB DD3 RAM
•  2GB 8-bit eMMC on-board flash storage
•  3D graphics accelerator
Connectivity
•  USB client for power and communications
•  USB host
•  Ethernet
•  HDMI
•  2x46 pin headers
Software Compatibility
•  Ångström Linux
•  Android
•  Cloud9 IDE on Node.js w/ BoneScript Library
and more…

Linux Day 2013

3
October 25th, 2013

Linux Day 2013

4

Embedded Linux for Makers
•  Embedded Linux System blur the definition between

computer and device
•  Powerful tools in the hands of “regular” people, not just those who

design electronics for a living
•  More powerful and capable than a “simple” microcontroller like
ATMEGA 328 (Arduino)
•  Perfect for those projects too complex to be executed on a MCU
October 25th, 2013

Linux Day 2013

5

Advantages?
Built-in
networking

Remote
access
Timekeeping

Multitasking
Linux
software

Filesystem

Size
USB

Community
October 25th, 2013

Linux Day 2013

BeagleBone Black: Ready to use

6
October 25th, 2013

Browsing Your BeagleBone
•  Firstly, just test that the

connection is active by trying
to connect to the BBB with a
browser.
•  Connect to the URL
http://192.168.7.2
•  You should see a helful
introductory web page
served by the BeagleBoard
itself

Linux Day 2013

7
October 25th, 2013

Linux Day 2013

Go with SSH
•  On Linux or Mac simply open a terminal window and

type the following command:
ssh 192.168.7.2 –l root

8
October 25th, 2013

Using Python
Using GPIO, PWM and more with Python!
Available functionality:
•  7 Analog pins
•  65 Digital Pins at 3.3V
•  2xI2C
•  2xSPI
•  2x CAN Bus
•  4 Timers
•  4x UART
•  8x PWM
•  A/D Converter

Linux Day 2013

9
October 25th, 2013

Expansion Headers

Each digital I/O pin has 8 different modes that can be selected, including GPIO

Linux Day 2013

10
October 25th, 2013

Linux Day 2013

Install Adafruit_BBIO
Commands needed to install the library.
Access via SSH and execute (on Angstrom Linux):
opkg update && opkg install python-pip python-setuptools python-smbus
pip install Adafruit_BBIO

You can test your installation simply trying to load one of
the modules:
import Adafruit_BBIO.GPIO as GPIO; print GPIO
#you should see this or similar:
<module 'Adafruit_BBIO.GPIO' from '/usr/local/lib/python2.7/dist-packages/
Adafruit_BBIO/GPIO.so'>

11
October 25th, 2013

Linux Day 2013

12

Using the library
Open a Python console and import the library.
Example:
import Adafruit_BBIO.GPIO as GPIO

You can access the channels by either referencing the pin
“key” or the name.
import Adafruit_BBIO.GPIO as
GPIO
GPIO.setup("P8_10", GPIO.OUT)
GPIO.output("P8_10", GPIO.HIGH)

GPIO.setup("P8_14", GPIO.IN)
if GPIO.input("P8_14"):
print("HIGH")
else:
print("LOW")
October 25th, 2013

LED blinking: wiring
Positive to pin 10 and negative to GND

Linux Day 2013

13
October 25th, 2013

Linux Day 2013

LED blinking: writing the program
Back to the Linux/Mac prompt and create the executable
file
# nano blink.py

Write the simple program:
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO.setup("P8_10", GPIO.OUT)
while True:
GPIO.output("P8_10", GPIO.HIGH)
time.sleep(0.5)
GPIO.output("P8_10", GPIO.LOW)
time.sleep(0.5)

14
October 25th, 2013

Linux Day 2013

LED blinking: writing the program
…and execute it
# python blink.py

Easy!

15
October 25th, 2013

Linux Day 2013

Measuring Temperature: wiring

16
October 25th, 2013

Linux Day 2013

Measuring Temperature
…and write the program
# nano temperature.py

Write the simple program:
import Adafruit_BBIO.ADC as ADC
import time
sensor_pin = 'P9_40'
ADC.setup()
while True:
reading = ADC.read(sensor_pin)
millivolts = reading * 1800 # 1.8V reference = 1800 mV
temp_c = (millivolts - 500) / 10
temp_f = (temp_c * 9/5) + 32
print('mv=%d C=%d F=%d' % (millivolts, temp_c, temp_f))
time.sleep(1)

17
October 25th, 2013

Using a Push Button

Energy Harvesting Demoboard

18
October 25th, 2013

Writing the code
…and write the program
# nano button.py

Write the simple program:
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO.setup("P8_12", GPIO.IN)
old_switch_state = 0
while True:
new_switch_state = GPIO.input("P8_12")
if new_switch_state == 1 and old_switch_state == 0 :
print('Do not press this button again!')
time.sleep(0.1)
old_switch_state = new_switch_state

Linux Day 2013

19
October 25th, 2013

Fade Effect with PWM: wiring

Linux Day 2013

20
October 25th, 2013

PWM?

Linux Day 2013

21
October 25th, 2013

Fade Effect with PWM: code
…and write the program
# nano led_fade.py

import Adafruit_BBIO.PWM as PWM
import time
led_pin = "P9_14"
PWM.start(led_pin, 0)
while True:
for i in range(0, 100):
PWM.set_duty_cycle(led_pin, i)
time.sleep(0.05)
for i in range(0, 100):
PWM.set_duty_cycle(led_pin, 100-i)
time.sleep(0.05)

Linux Day 2013

22
DEMO
October 25th, 2013

Linux Day 2013

Recommended readings
Getting Started with BeagleBone Black
Make
By Matt Richardson
Building Embedded Linux System
O’Reilly
By Karim Yaghmour, Jon Masters, Gilad Ben
Yassef, and Philippe Gerum
Embedded Linux System Design and
Development
By P. Raghavan, A. Lad, S. Neelakandan,
Auerbach

24
October 25th, 2013

Linux Day 2013

Thank you

@dcostarella
danielecostarella.com

25

More Related Content

What's hot

Introduction to beagle board
Introduction to beagle boardIntroduction to beagle board
Introduction to beagle board
Amit Karpe
 
BeagleBone black
BeagleBone blackBeagleBone black
BeagleBone black
Raja Vedula
 
Beagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009bBeagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009b
Michael Hallak-Stamler
 
Asus Tinker Board
Asus Tinker BoardAsus Tinker Board
Asus Tinker Board
Niyazi Saral
 
Raspberry Pi Gaming Rig
Raspberry Pi Gaming RigRaspberry Pi Gaming Rig
Raspberry Pi Gaming Rig
Duc Le
 
Polstra 44con2012
Polstra 44con2012Polstra 44con2012
Polstra 44con2012
Philip Polstra
 
A2 Video Streamer
A2 Video StreamerA2 Video Streamer
A2 Video Streamer
Andrew Roughan
 
Pi Is For Python
Pi Is For PythonPi Is For Python
Pi Is For Python
Brad Fortner
 
Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry PiLentin Joseph
 
Single Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi BasicsSingle Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi Basics
Eueung Mulyana
 
Exploring the ABC's of Raspberry Pi with Python
Exploring the ABC's of Raspberry Pi with PythonExploring the ABC's of Raspberry Pi with Python
Exploring the ABC's of Raspberry Pi with Python
Shahed Mehbub
 
Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and Arduino
Chad Mairn
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry pi
HusainBhaldar21
 
Exploring the abc's of raspberry pi and python(day 2)
Exploring the abc's of raspberry pi and python(day 2)Exploring the abc's of raspberry pi and python(day 2)
Exploring the abc's of raspberry pi and python(day 2)
Shahed Mehbub
 
Putting an Apple IIgs BBS on the internet
Putting an Apple IIgs BBS on the internetPutting an Apple IIgs BBS on the internet
Putting an Apple IIgs BBS on the internet
Andrew Roughan
 
Raspberry Pi and Amateur Radio
Raspberry Pi and Amateur RadioRaspberry Pi and Amateur Radio
Raspberry Pi and Amateur Radio
Kevin Hooke
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
Shahed Mehbub
 
Hardware Hacks
Hardware HacksHardware Hacks
OzKFest 2015 - (Solid) State of the Nation
OzKFest 2015 - (Solid) State of the NationOzKFest 2015 - (Solid) State of the Nation
OzKFest 2015 - (Solid) State of the Nation
apple2europlus
 
Interfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the WorldInterfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the World
Omer Kilic
 

What's hot (20)

Introduction to beagle board
Introduction to beagle boardIntroduction to beagle board
Introduction to beagle board
 
BeagleBone black
BeagleBone blackBeagleBone black
BeagleBone black
 
Beagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009bBeagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009b
 
Asus Tinker Board
Asus Tinker BoardAsus Tinker Board
Asus Tinker Board
 
Raspberry Pi Gaming Rig
Raspberry Pi Gaming RigRaspberry Pi Gaming Rig
Raspberry Pi Gaming Rig
 
Polstra 44con2012
Polstra 44con2012Polstra 44con2012
Polstra 44con2012
 
A2 Video Streamer
A2 Video StreamerA2 Video Streamer
A2 Video Streamer
 
Pi Is For Python
Pi Is For PythonPi Is For Python
Pi Is For Python
 
Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry Pi
 
Single Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi BasicsSingle Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi Basics
 
Exploring the ABC's of Raspberry Pi with Python
Exploring the ABC's of Raspberry Pi with PythonExploring the ABC's of Raspberry Pi with Python
Exploring the ABC's of Raspberry Pi with Python
 
Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and Arduino
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry pi
 
Exploring the abc's of raspberry pi and python(day 2)
Exploring the abc's of raspberry pi and python(day 2)Exploring the abc's of raspberry pi and python(day 2)
Exploring the abc's of raspberry pi and python(day 2)
 
Putting an Apple IIgs BBS on the internet
Putting an Apple IIgs BBS on the internetPutting an Apple IIgs BBS on the internet
Putting an Apple IIgs BBS on the internet
 
Raspberry Pi and Amateur Radio
Raspberry Pi and Amateur RadioRaspberry Pi and Amateur Radio
Raspberry Pi and Amateur Radio
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
 
Hardware Hacks
Hardware HacksHardware Hacks
Hardware Hacks
 
OzKFest 2015 - (Solid) State of the Nation
OzKFest 2015 - (Solid) State of the NationOzKFest 2015 - (Solid) State of the Nation
OzKFest 2015 - (Solid) State of the Nation
 
Interfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the WorldInterfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the World
 

Similar to Hands On Embedded Linux with BeagleBone Black

Hands on Embedded Linux with BeagleBone Black
Hands on Embedded Linux with BeagleBone BlackHands on Embedded Linux with BeagleBone Black
Hands on Embedded Linux with BeagleBone Black
Open Makers Italy
 
Introduction To The Beagleboard
Introduction To The BeagleboardIntroduction To The Beagleboard
Introduction To The Beagleboard
NeHal VeRma
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
Sulamita Garcia
 
Pre meetup intel® roadshow london
Pre meetup intel® roadshow londonPre meetup intel® roadshow london
Pre meetup intel® roadshow london
Hugo Espinosa
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
Codemotion
 
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldCloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldOmer Kilic
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
Intel® Developer Zone Россия
 
Abc beagleboard Getting To Know It
Abc beagleboard Getting To Know ItAbc beagleboard Getting To Know It
Abc beagleboard Getting To Know It
rviolachurch
 
LAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George GreyLAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George Grey
96Boards
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome Keynote
Linaro
 
pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014
Jingfeng Liu
 
Efabless Marketplace webinar slides 2024
Efabless Marketplace webinar slides 2024Efabless Marketplace webinar slides 2024
Efabless Marketplace webinar slides 2024
Nobin Mathew
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
Vasily Ryzhonkov
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
Intel® Software
 
Tac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PITac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PI
Cliff Samuels Jr.
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
GR Techno Solutions
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universeNewbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
Ofer Rosenberg
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
Akshat Bijronia
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
Marcus Tarquinio
 
Arduino
ArduinoArduino
Arduino
Jerin John
 

Similar to Hands On Embedded Linux with BeagleBone Black (20)

Hands on Embedded Linux with BeagleBone Black
Hands on Embedded Linux with BeagleBone BlackHands on Embedded Linux with BeagleBone Black
Hands on Embedded Linux with BeagleBone Black
 
Introduction To The Beagleboard
Introduction To The BeagleboardIntroduction To The Beagleboard
Introduction To The Beagleboard
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Pre meetup intel® roadshow london
Pre meetup intel® roadshow londonPre meetup intel® roadshow london
Pre meetup intel® roadshow london
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldCloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Abc beagleboard Getting To Know It
Abc beagleboard Getting To Know ItAbc beagleboard Getting To Know It
Abc beagleboard Getting To Know It
 
LAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George GreyLAS16 100 K1 - Keynote George Grey
LAS16 100 K1 - Keynote George Grey
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome Keynote
 
pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014pcDuino tech talk at Carnegie Mellon University 10/14/2014
pcDuino tech talk at Carnegie Mellon University 10/14/2014
 
Efabless Marketplace webinar slides 2024
Efabless Marketplace webinar slides 2024Efabless Marketplace webinar slides 2024
Efabless Marketplace webinar slides 2024
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
 
Tac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PITac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PI
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universeNewbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
 
Arduino
ArduinoArduino
Arduino
 

More from Daniele Costarella

Fondamenti di GNU/Linux: FileSystem e Partizioni
Fondamenti di GNU/Linux: FileSystem e PartizioniFondamenti di GNU/Linux: FileSystem e Partizioni
Fondamenti di GNU/Linux: FileSystem e Partizioni
Daniele Costarella
 
Arduino e stampa 3D - Le nuove frontiere della robotica homemade
Arduino e stampa 3D - Le nuove frontiere della robotica homemadeArduino e stampa 3D - Le nuove frontiere della robotica homemade
Arduino e stampa 3D - Le nuove frontiere della robotica homemade
Daniele Costarella
 
energy-harvesting-pres-final-std
energy-harvesting-pres-final-stdenergy-harvesting-pres-final-std
energy-harvesting-pres-final-stdDaniele Costarella
 
Linux Embedded per l'automazione
Linux Embedded per l'automazioneLinux Embedded per l'automazione
Linux Embedded per l'automazione
Daniele Costarella
 
Development of a Wireless Sensors Network powered by Energy Harvesting techni...
Development of a Wireless Sensors Network powered by Energy Harvesting techni...Development of a Wireless Sensors Network powered by Energy Harvesting techni...
Development of a Wireless Sensors Network powered by Energy Harvesting techni...
Daniele Costarella
 
Electronics LAB [with Arduino] | DAY 2
Electronics LAB [with Arduino] | DAY 2Electronics LAB [with Arduino] | DAY 2
Electronics LAB [with Arduino] | DAY 2Daniele Costarella
 
Electronics LAB [with Arduino] | DAY 1
Electronics LAB [with Arduino] | DAY 1Electronics LAB [with Arduino] | DAY 1
Electronics LAB [with Arduino] | DAY 1Daniele Costarella
 
Electronics LAB [with Arduino] | DAY 3
Electronics LAB [with Arduino] | DAY 3Electronics LAB [with Arduino] | DAY 3
Electronics LAB [with Arduino] | DAY 3Daniele Costarella
 
Development of a wireless sensor network powered by energy harvesting techniques
Development of a wireless sensor network powered by energy harvesting techniquesDevelopment of a wireless sensor network powered by energy harvesting techniques
Development of a wireless sensor network powered by energy harvesting techniques
Daniele Costarella
 
Software libero nei sistemi embedded
Software libero nei sistemi embeddedSoftware libero nei sistemi embedded
Software libero nei sistemi embeddedDaniele Costarella
 

More from Daniele Costarella (10)

Fondamenti di GNU/Linux: FileSystem e Partizioni
Fondamenti di GNU/Linux: FileSystem e PartizioniFondamenti di GNU/Linux: FileSystem e Partizioni
Fondamenti di GNU/Linux: FileSystem e Partizioni
 
Arduino e stampa 3D - Le nuove frontiere della robotica homemade
Arduino e stampa 3D - Le nuove frontiere della robotica homemadeArduino e stampa 3D - Le nuove frontiere della robotica homemade
Arduino e stampa 3D - Le nuove frontiere della robotica homemade
 
energy-harvesting-pres-final-std
energy-harvesting-pres-final-stdenergy-harvesting-pres-final-std
energy-harvesting-pres-final-std
 
Linux Embedded per l'automazione
Linux Embedded per l'automazioneLinux Embedded per l'automazione
Linux Embedded per l'automazione
 
Development of a Wireless Sensors Network powered by Energy Harvesting techni...
Development of a Wireless Sensors Network powered by Energy Harvesting techni...Development of a Wireless Sensors Network powered by Energy Harvesting techni...
Development of a Wireless Sensors Network powered by Energy Harvesting techni...
 
Electronics LAB [with Arduino] | DAY 2
Electronics LAB [with Arduino] | DAY 2Electronics LAB [with Arduino] | DAY 2
Electronics LAB [with Arduino] | DAY 2
 
Electronics LAB [with Arduino] | DAY 1
Electronics LAB [with Arduino] | DAY 1Electronics LAB [with Arduino] | DAY 1
Electronics LAB [with Arduino] | DAY 1
 
Electronics LAB [with Arduino] | DAY 3
Electronics LAB [with Arduino] | DAY 3Electronics LAB [with Arduino] | DAY 3
Electronics LAB [with Arduino] | DAY 3
 
Development of a wireless sensor network powered by energy harvesting techniques
Development of a wireless sensor network powered by energy harvesting techniquesDevelopment of a wireless sensor network powered by energy harvesting techniques
Development of a wireless sensor network powered by energy harvesting techniques
 
Software libero nei sistemi embedded
Software libero nei sistemi embeddedSoftware libero nei sistemi embedded
Software libero nei sistemi embedded
 

Hands On Embedded Linux with BeagleBone Black

  • 1. HANDS ON EMBEDDED LINUX WITH BEAGLEBONE BLACK Daniele Costarella Ex Carcere Borbonico (Avellino) – October 25th, 2013
  • 2. October 25th, 2013 Linux Day 2013 2 What is BeagleBone Black? BeagleBone Black is a $45 MSRP community-supported development platform for developers and hobbysts. Boot Linux in under 10 seconds and get started on development in less than 5 minutes with just a single USB cable.
  • 3. October 25th, 2013 Hardware Processor: AM335x 1GHz ARM® Cortex-A8 •  512MB DD3 RAM •  2GB 8-bit eMMC on-board flash storage •  3D graphics accelerator Connectivity •  USB client for power and communications •  USB host •  Ethernet •  HDMI •  2x46 pin headers Software Compatibility •  Ångström Linux •  Android •  Cloud9 IDE on Node.js w/ BoneScript Library and more… Linux Day 2013 3
  • 4. October 25th, 2013 Linux Day 2013 4 Embedded Linux for Makers •  Embedded Linux System blur the definition between computer and device •  Powerful tools in the hands of “regular” people, not just those who design electronics for a living •  More powerful and capable than a “simple” microcontroller like ATMEGA 328 (Arduino) •  Perfect for those projects too complex to be executed on a MCU
  • 5. October 25th, 2013 Linux Day 2013 5 Advantages? Built-in networking Remote access Timekeeping Multitasking Linux software Filesystem Size USB Community
  • 6. October 25th, 2013 Linux Day 2013 BeagleBone Black: Ready to use 6
  • 7. October 25th, 2013 Browsing Your BeagleBone •  Firstly, just test that the connection is active by trying to connect to the BBB with a browser. •  Connect to the URL http://192.168.7.2 •  You should see a helful introductory web page served by the BeagleBoard itself Linux Day 2013 7
  • 8. October 25th, 2013 Linux Day 2013 Go with SSH •  On Linux or Mac simply open a terminal window and type the following command: ssh 192.168.7.2 –l root 8
  • 9. October 25th, 2013 Using Python Using GPIO, PWM and more with Python! Available functionality: •  7 Analog pins •  65 Digital Pins at 3.3V •  2xI2C •  2xSPI •  2x CAN Bus •  4 Timers •  4x UART •  8x PWM •  A/D Converter Linux Day 2013 9
  • 10. October 25th, 2013 Expansion Headers Each digital I/O pin has 8 different modes that can be selected, including GPIO Linux Day 2013 10
  • 11. October 25th, 2013 Linux Day 2013 Install Adafruit_BBIO Commands needed to install the library. Access via SSH and execute (on Angstrom Linux): opkg update && opkg install python-pip python-setuptools python-smbus pip install Adafruit_BBIO You can test your installation simply trying to load one of the modules: import Adafruit_BBIO.GPIO as GPIO; print GPIO #you should see this or similar: <module 'Adafruit_BBIO.GPIO' from '/usr/local/lib/python2.7/dist-packages/ Adafruit_BBIO/GPIO.so'> 11
  • 12. October 25th, 2013 Linux Day 2013 12 Using the library Open a Python console and import the library. Example: import Adafruit_BBIO.GPIO as GPIO You can access the channels by either referencing the pin “key” or the name. import Adafruit_BBIO.GPIO as GPIO GPIO.setup("P8_10", GPIO.OUT) GPIO.output("P8_10", GPIO.HIGH) GPIO.setup("P8_14", GPIO.IN) if GPIO.input("P8_14"): print("HIGH") else: print("LOW")
  • 13. October 25th, 2013 LED blinking: wiring Positive to pin 10 and negative to GND Linux Day 2013 13
  • 14. October 25th, 2013 Linux Day 2013 LED blinking: writing the program Back to the Linux/Mac prompt and create the executable file # nano blink.py Write the simple program: import Adafruit_BBIO.GPIO as GPIO import time GPIO.setup("P8_10", GPIO.OUT) while True: GPIO.output("P8_10", GPIO.HIGH) time.sleep(0.5) GPIO.output("P8_10", GPIO.LOW) time.sleep(0.5) 14
  • 15. October 25th, 2013 Linux Day 2013 LED blinking: writing the program …and execute it # python blink.py Easy! 15
  • 16. October 25th, 2013 Linux Day 2013 Measuring Temperature: wiring 16
  • 17. October 25th, 2013 Linux Day 2013 Measuring Temperature …and write the program # nano temperature.py Write the simple program: import Adafruit_BBIO.ADC as ADC import time sensor_pin = 'P9_40' ADC.setup() while True: reading = ADC.read(sensor_pin) millivolts = reading * 1800 # 1.8V reference = 1800 mV temp_c = (millivolts - 500) / 10 temp_f = (temp_c * 9/5) + 32 print('mv=%d C=%d F=%d' % (millivolts, temp_c, temp_f)) time.sleep(1) 17
  • 18. October 25th, 2013 Using a Push Button Energy Harvesting Demoboard 18
  • 19. October 25th, 2013 Writing the code …and write the program # nano button.py Write the simple program: import Adafruit_BBIO.GPIO as GPIO import time GPIO.setup("P8_12", GPIO.IN) old_switch_state = 0 while True: new_switch_state = GPIO.input("P8_12") if new_switch_state == 1 and old_switch_state == 0 : print('Do not press this button again!') time.sleep(0.1) old_switch_state = new_switch_state Linux Day 2013 19
  • 20. October 25th, 2013 Fade Effect with PWM: wiring Linux Day 2013 20
  • 22. October 25th, 2013 Fade Effect with PWM: code …and write the program # nano led_fade.py import Adafruit_BBIO.PWM as PWM import time led_pin = "P9_14" PWM.start(led_pin, 0) while True: for i in range(0, 100): PWM.set_duty_cycle(led_pin, i) time.sleep(0.05) for i in range(0, 100): PWM.set_duty_cycle(led_pin, 100-i) time.sleep(0.05) Linux Day 2013 22
  • 23. DEMO
  • 24. October 25th, 2013 Linux Day 2013 Recommended readings Getting Started with BeagleBone Black Make By Matt Richardson Building Embedded Linux System O’Reilly By Karim Yaghmour, Jon Masters, Gilad Ben Yassef, and Philippe Gerum Embedded Linux System Design and Development By P. Raghavan, A. Lad, S. Neelakandan, Auerbach 24
  • 25. October 25th, 2013 Linux Day 2013 Thank you @dcostarella danielecostarella.com 25