How to use WiringPi2 for Python on the Raspberry Pi in Raspbian part 1 What is WiringPi2 and why do I need it? WiringPi2 for Python is an excellent GPIO handling system written by Gordon ‘Drogon’ Henderson and packaged for Python by Phil ‘Gadgetoid’ Howard. It uses Arduino-like scripting language. One of the reasons (I think) the take-up for WiringPi-Python has been a bit slow, despite its richer feature set, is the lack of documentation. If you’ve used my Gertboard Python software, you may well have used both the original WiringPi AND RPi.GPIO. All the basic features still work the same way, but Gordon has added a lot more capabilities. WiringPi2 is written in C, but has been packaged for Python, Ruby and PERL as well. WiringPi2 for Python is not installed in the standard Raspbian image, so you will have to install it before you can use it. So, once installed, how do you use it? Near the top of the your Python script you need to import the wiringpi2 module import wiringpi2 as wiringpi Then, before you do anything else with wiringpi2, you need to initialise it.
Tutorial_Devices - webiopi - Internet of Things framework Programmable Heater with Temperature Sensor and GPIO Expander WebIOPi include several drivers to directly control over 30 electronic devices. It provides a consistent and common abstraction for most used sensors, analog converters, and GPIO expanders. See the supported devices pages for a complete listing. All supported devices can be used in your Python script, from the REST API, the Javascript library, or even from the Python or Java Client. Function provided depend on the devices type. Digital GPIOPort (I/O Expanders) Analog ADC (Analog to Digital Converter, ie. analog inputs) DAC (Digital to Analog Converter, ie. analog outputs) PWM (Pulse Width Modulation outputs) Sensor Temperature Pressure Luminosity Distance Prerequisites Testing Devices Before using devices in your Pythons script or custom UI, you may need to debug your circuitry and at least, verify it works well with the WebIOPi environment. WebIOPi handles by itself linux modules loading to support I2C, SPI, and 1-Wire. <! <!
Home History Linux is built around the Linux kernel originally released by Linus Torvalds in 1991. It was developed further by volunteers and started to be used with software from the GNU project, a suite of programs that form a complete operating system. Linux continues to be maintained by communities of volunteers. It is an open source project, meaning it's source code is publicly available and can be downloaded for free. GNU/Linux software is modelled on the Unix operating system, developed in the early 1970s by Dennis Ritchie and Ken Thompson at Bell Labs. Where is Linux used? Many mainframe manufacturers have also adopted Linux as their operating system of choice. As processing power got cheaper, the processors used in devices like set top boxes and mobile phones got more powerful. Linux Distributions There are many different versions, or distributions, of Linux. Linux is free, but there are still some restrictions on what can be done with it. Not all software that runs on Linux is free.
Gertboard - DEV-11773 Except for the most proficient and well-equipped hardware engineers, the Gertboard is a MUST-HAVE piece of kit, just as important as the Raspberry Pi itself. The board’s design is inspired by a brilliant concept - several independent pieces of equipment on the one board, which can be linked exactly as the user desires. LEDs and buttons help with the ‘Hello, world" programming stages, an abundance of open collector outputs are on tap for driving those mains power relays, and an on-board ATMega microcontroller, easily programmed from the RPi, and linked to the RPi via TTY or SPI. takes care of any pin shortages. The documentation is wonderful as well, and puts a lot of other hardware documentation to shame!
Quick Start Guide – The Pi Hut This guide is a simple setup guide for beginners; for more information on setting up the Raspberry Pi, or if you have any problems – Google is your friend. Required Items Micro USB power supply - Make sure you use a good quality one! Do not attempt to power your Raspberry Pi by plugging it into a computer.microSD card - Loaded with the operating system of your choice (use an SD card adaptor if you have the older Raspberry Pi Model A or B)USB keyboard and mouse or a Mini Keyboard with TouchpadHDMI Cable, or HDMI to DVI cable, or HDMI to VGA, or a Composite cable, depending on the connector on your screenNetwork cable or a compatible WiFi adaptor (optional, if you want to connect to the internet) Hardware Setup It is recommended that you connect the power supply to the Pi last, so follow these steps in order: Using the Raspberry Pi What you see first will depend on the operating system you have on your (micro)SD card. Raspbian will then run through its installation process as shown below.
1: Getting Started with Raspberry Pi GPIO and Python 1: Getting Started with Raspberry Pi GPIO and Python Details Category: Raspberry Pi Last Updated on Friday, 06 March 2015 12:37 1. Overview 2. 3. 4. 5. 1 Overview This is the first of two articles showing basic GPIO on the Raspberry-Pi using the prototype area of the Slice of Pi. 2 GPIO Basic's The R-Pi has 17 GPIO pins brought out onto the header, most have alternated functions other than just I/O, there are two pins for UART, two for I2C and six for SPI. Using any of the pins will require extra care, than most Arduino users maybe be used to. There will also be an issue with trying to draw to much power form the pins, according to the data-sheet each pin programmed to current drive between 2mA and 16mA, and it has been warned that trying to draw 16mA from several pins at once could also lead to a damaged Pi. Anyway enough about power theres still plenty to try driving some basis LED's and use the UART to talk to an XRF. So how does one go about talking to the GPIO's? 3 Installing RPi.GPIO
K002 - Slice of PI/O K002 - Slice of PI/O Details Category: Raspberry Pi Last Updated on Tuesday, 28 August 2012 10:29 1. Overview 2. 3. 4. 5. 6. 7. 1 Overview Slice of PI/O is an MCP23017 breakout, adding 16 I/O pins to the Raspberry Pi via the I2C bus. Silk Screen Error There was a mistake on the silk screen for the first batch of boards. 2 Power Options The slice of PI/O has 3 power options 3v3, 5v or external. 3 Interrupt Pins Two Interrupt Pins A & B have been broken out to pads, these can be wired back the Raspberry Pi's normal GPIO's. 4 Address Selection On the underside of the PI/O there are 6 solder pads used for the 3 address selection pins on the MPC23017. Soldering all 3 pins low as shown will give an address of 0x20. 5 I2C Extenstion header There are an optional 4 pads to allow extenion of the I2C bus, this could allow daisy chaining of multiple MCP23017 or any other I2C device 6 Build Steps Parts laid Out Solder the IC Socket Solder the IO and GND headers Solder the capacitor and jumper 7 Testing It i2c-dev
FrontPage - Raspbian Running A Python Script At Boot Using Cron There maybe times when you want to run a Python script when your Raspberry Pi boots up. There are a number of different techniques to do this but I prefer the method that uses “cron”. Cron is a job scheduler that allows the system to perform tasks at defined times or intervals. It is a very powerful tool and useful in lots of situations. You can use it to run commands or in this case, a Python script. Step 1 – Create A Python Script The first step is creating your Python script. Double check you’ve got the correct path by typing : cat /home/pi/MyScript.py This should show the contents of your script. Make sure your script works and does what you expect it to. Step 2 – Add A New Cron Job To create a new job to Cron we will modify the “crontab”. sudo crontab -e Each user of the system (ie “pi”) can have its own Crontab but in this case we want to add it as an admin so we prefix our “crontab -e” command with “sudo”. Using your cursor keys scroll to the bottom and add the following line :
How To Autorun A Python Script On Boot Using systemd With the latest release of Raspbian I started to struggle to autorun Python scripts on bootup using Cron or rc.local. It appears that the Raspbian boot sequence has changed and these processes run at different points in that sequence. How much of an issue this is depends on what your Python script is trying to do and what resources it needs. The point at which your Python script is run in the startup sequence is vital if your script relies on any system features being available at that point in time. Network is connected and availableThe /home/pi directory is mounted and read for useSystem time has been updated by NTP I decided to use “systemd” as this seems to the recommended way of launching custom features and lots of Linux distributions are adopting it. systemd is a software suite for central management and configuration of a Linux system and aims to replace other popular tools that previously fulfilled this role. systemd is quite scary. Step 1 – Your Python Script sudo reboot
python - Communicating between Raspberry Pi and Arduino over LAN Raspberry Pi Network Chat in Python » blog.whaleygeek.co.uk Myself and @ryanteck (Mr Rastrack) ran some Raspberry Pi workshops this week. I put together a simple network chat application between two Pi’s to demonstrate how easy it can be to build a network aware application. We ran some workshops this week at a College, to train up students to be facilitators at an event we will soon be running for school children. One of the workshops we want to run is a “networking” workshop, to give kids the building blocks to connect bits of hardware over the network (and potentially the internet). It’s relatively simple to use network sockets from a program if you know how. However, I wanted something non object based (as we don’t specifically teach python classes and inheritance to kids at an early age) and something that could be used as a simple building block for all sorts of programs. Network Chat My use-case for a simple networking module, was to enable kids with limited python knowledge to write a chat application. Network Configuration (Dynamic) Ping
Python with Arduino LESSON 16: Simple Client Server Configuration over Ethernet | Technology Tutorials In the previous lessons we have seen that powerful analytic and graphic programs can be written that allow data taken from the arduino to be displayed on a PC via Python. We have shown how the arduino can be connected to a PC by either a serial cable or Xbee radios. To fully unleash the power of the arduino, it can be set up as a server, and connected to a network via Ethernet. In this lesson, we will show how to set the arduino up as a server which is controlled and queried by clients on PC’s on the same network. In order to complete this tutorial, you will need an Arduino Uno and an Ethernet shield. In order to get the arduino to work over Ethernet, you must first assign an IP address to the arduino in your router. Once you have the IP address and mac address sorted out, you will need to set up the arduino as a server. This is the code developed in the video to set the arduino up: Simple Arduino Server Code Once you can ping the arduino, you are ready to set up a client in Python.
Setting Up Your Raspberry Pi For Headless Use With SSH The Raspberry Pi is – as we’ve seen in several previous articles – an extremely flexible piece of hardware. Once you’ve installed an operating system, got to grips with the small dimensions, and found a case for it, you’ll be able to install media centre software and perhaps even begin programming software (after all, that’s what it was designed for!). However, you might find that the business of plugging the Raspberry Pi into your big screen plasma TV – the only device in your house with a HDMI connection – is a bit tiresome while your family is watching their favourite show. Alternatively, you might have more than enough HDMI displays but not enough keyboards. Benefits of SSH Fortunately, the Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up. Using the Pi as a NAS interface? This is where SSH comes in! Setting Up the Raspberry Pi for SSH Connecting to Your Raspberry Pi Issuing Remote Commands to the Pi ps ax