Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Software Development with Python and the Raspberry Pi

Similar presentations


Presentation on theme: "Embedded Software Development with Python and the Raspberry Pi"— Presentation transcript:

1 Embedded Software Development with Python and the Raspberry Pi
Class 4: Controlling Raspberry Pi Peripherals with Python August 21, 2014 Jacob Beningo, CSDP © All Images and content in this presentation may not be used or copied without express written permission of the owner.

2 Course Overview Introduction to Python Python Fundamentals
An Overview of the Raspberry Pi Controlling Raspberry Pi Peripherals with Python An Internet of Things Weather Station Example

3 Session Overview Controlling Raspberry Pi Peripherals with Python
The Raspberry Pi Ecosystem Library Setup GPIO Setup and Example I2C UART SPI Analog Sensors Pi Camera

4 Ecosystem

5 Library Setup Python Raspberry Pi Libraries Installation Steps
Provide code modules to easily access hardware Easy to Install Installation Steps Update Packages Install GPIO Library Install git Install optional Adafruit Python Libraries

6 Library Setup – Update Packages
sudo apt-get update

7 Library Setup – Install Python 2.7
sudo apt-get install python-dev

8 Library Setup – Install GPIO
sudo apt-get install python-rpi.gpio

9 Library Setup - Optional
Adafruit Libraries Useful interfaces for experimentation Install git sudo apt-get install git Clone Adafruit repository git clone cd Adafruit-Raspberry-Pi-Python-Code ls

10 Library Setup - Optional

11 A GPIO Example Goals Setup Toggle an LED using Python
Adjustable blink rate Use of ctrl-c to exit application Setup Use nano GPIO18 as an output Use python sleep()

12 A GPIO Example

13 Setting Up I2C Add I2C modules sudo nano /etc/modules
Don’t forget to reboot after this step! sudo reboot

14 Setting Up I2C Install I2C tools
sudo apt-get install python-smbus sudo apt-get install i2c-tools Modify /etc/modprobe.d/raspi-blacklist.conf Don’t forget to restart after saving sudo reboot

15 Setting Up I2C sudo i2cdetect –y 1

16 Setting Up the UART UART0 by default is setup for Kernel Debugging

17 Setting Up the UART Run the UART Script Steps
Disconnects the UART from Kernel Steps sudo wget -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console rpi-serial-console status Rpi-serial-console disable sudo reboot The script modifies the entries for ttyAMA0 in /boot/cmdline.txt /etc/inittab

18 Setting Up the UART Install python-serial
Most likely already installed and up to date sudo apt-get install python-serial

19 Setting Up SPI Install Spi Wrapper mkdir python-spi cd python-spi
wget wget sudo python setup.py install

20 Setting Up SPI

21 Reading Analog Sensors
Model: A / B / B+ Model: B+ Only

22 Reading Analog Sensors
MCP3008 ADC Chip

23 Pi Camera Enable Camera Sudo raspi-config Reboot Python Test Script

24 Going Further Download Template Materials for Web Tutorials YouTube
Python Doxygen Script Template Personal Weather Station Python Script Raspberry Pi Example Python Scripts Web Tutorials YouTube From under Blog and Articles > Software Techniques > Embedded Software with Python

25 Contact Information P.O. Box 400 Linden, Michigan 48451 : : : Jacob_Beningo : Beningo Engineering : JacobBeningo : Embedded Basics Jacob Beningo Principal Consultant © All Images and content in this presentation may not be used or copied without express written permission of the owner.


Download ppt "Embedded Software Development with Python and the Raspberry Pi"

Similar presentations


Ads by Google