Change Raspberry Pi Hostname. By default the Raspberry Pi has its hostname set to “raspberrypi”.
This appears as part of the command prompt when you open a terminal window. You can change it by editing a few system files. This process only takes a minute. Open a terminal window from your program list. For example “LXTerminal” under “Accessories”. Change Raspberry Pi Hostname. Install RPi.GPIO Python Library. The RPi.GPIO Python library allows you to easily configure and read-write the input/output pins on the Pi’s GPIO header within a Python script.
Thankfully this library is now including in the standard Raspbian image available from the Foundations Download Page. If you are using a fresh image you don’t need to install it but I’ve kept the instructions here in case you ever want to try a manually installation. Method 1 – Install from repository If the package exists in the Raspbian repository is can be installed using apt-get. Ntrol LED Using GPIO Output Pin. The circuit below shows to turn an LED on and off using a Raspberry Pi GPIO pin configured as an output.
It uses the output pin to turn on a transistor which allows the LED to draw current from the 5V supply. The following header pins are required : Header Pin 2 : 5VHeader Pin 6 : GroundHeader Pin 11 : GPIO. Raspberry Pi Speakers & Analog Sound Test. I decided to attach some speakers to my Raspberry Pi.
I didn’t want to spend much so I picked up a pair of stereo speakers from my local Poundworld. They cost £1 exactly. They aren’t exactly the sort of speakers you would hook up to your HiFi system but for experimenting you can’t beat the value. They have a 3.5mm jack which plugs into the Pi’s analog audio connector. In time I want to play sound files from my Python programs to provide audio notifications. Install the Sound Drivers Update : The newer Debian “Wheezy” image enables the sound driver by default so this section can be ignored. In the Debian “Squeeze” image the ALSA sound drivers are considered experimental and have been disabled by default.
Sudo apt-get install alsa-utils That will install the required sound driver files and tools. Reading Analogue Sensors With One GPIO Pin. Unlike some other devices the Raspberry Pi does not have any analogue inputs.
All 17 of its GPIO pins are digital. They can output high and low levels or read high and low levels. Getting Your Raspberry Pi Serial Number Using Python. Raspberry Pi P5 Header. The Raspberry Pi Revision 2.0 introduced a new header to the PCB.
This header is called P5 and consists of 8 pins. It is located directly underneath the standard 26 way P1 GPIO header. It was intended that this header is populated on the underside of the PCB so any connectors or cables do not interfere with the P1 header. Pin 1 has a square pad whereas the other 7 have circular pads. The P5 pins provide : +5V, 3V3 and GroundGPIO28GPIO29GPIO30GPIO31. How to change the Raspberry Pi password. The default Raspbian SD card image configures a default user account called ‘pi’ with a password of ‘raspberry’.
Every device using this image will therefore have the same username and password combination. This is great for quickly getting starting but isn’t very good practice from a security point of view. You should therefore consider changing the default password as soon as possible. It’s easy to do and only takes a minute. Macro Photography With The Raspberry Pi Camera Module. In a recent article I mentioned how you can add cheap interchangeable lenses to your Raspberry Pi camera to make it more versatile.
I’ve now played around with the macro lens and thought I’d show you a set of photos I took. My son is really interested in insects so I decided to take some macro photos of whatever I could find behind the sofa. The lucky subjects were a moth and some sort of fly which we found in the conservatory (someone had vacuumed under the sofa!). 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. PiPan Pan And Tilt Mechanism For Raspberry Pi Camera. Analogue Sensors On The Raspberry Pi Using An MCP3008. The Raspberry Pi has no built in analogue inputs which means it is a bit of a pain to use many of the available sensors.
I wanted to update my garage security system with the ability to use more sensors so I decided to investigate an easy and cheap way to do it. The MCP3008 was the answer. The MCP3008 is a 10bit 8-channel Analogue-to-digital converter (ADC). It is cheap, easy to connect and doesn’t require any additional components. Quick Guide To nano Text Editor On The Raspberry Pi. If I need to edit text files directly on my Raspberry Pi my text editor of choice is nano. There are other text editors available but I prefer nano’s relatively straightforward interface. As a command line based utility it may feel strange for users who are more familiar with a graphical interface but it is easy to learn the basics. Syntax colouring is available which makes reading and reviewing scripts easy. Launching nano To start nano you can simply type nano at the command prompt. In order to launch an existing text file you type nano followed by the file name : nano berryclip_01.py.
Ultrasonic Distance Measurement Using Python – Part 1. LEDs, buzzers and switches are the most common items people attempt to interface to their Raspberry Pi’s. Something I found in eBay that is a little bit different is an ultrasonic measurement module. Cheap PIR Sensors and the Raspberry Pi – Part 1. A great little sensor you can add to your Raspberry Pi projects is a PIR module. These 5V “Passive Infra Red” sensors are available for a few pounds from eBay. They can be powered from 5V and output 3V so can be connected directly to pins on the Pi’s GPIO header without any other components. The module sets a single output pin high whenever it detects movement within its field of view. It holds this pin High (3.3V) for a minimum period of time.
If continuous movement is detected the output pin will stay High. I am currently using one in an alarm system and it works great for such a small and cheap device. PIR Connections. Gertboard – The Ultimate Raspberry Pi Add-on Board. The Gertboard is an add-on board designed by Gert van Loo who is also one of the hardware engineers involved in the original design of the Raspberry Pi. The board was originally sold by Farnell/Element14 in kit form but has just been re-launched as a fully assembled unit.
This may come as a disappoint to those people that wanted to solder their own boards but perhaps a relief to those that will be happy with a pre-built product. The Gertboard plugs directly onto the Raspberry Pi GPIO header and provides a range of features and interfacing possibilities including : Drive powerful motorsDetect switch pressesIlluminate LEDsDrive relays.Detect and output analogue voltagesRespond to external physical events Specifications & Features 12 x LED indicators12 x buffered I/O3 x momentary push buttons6 open collector drivers (50V, 0.5A)18V, 2A bi-directional motor controller28-pin dual in line ATmega microcontroller2-channel 8 bit Digital to Analogue converter Gertboard – Layout Diagram Photos User Manual.
Ultrasonic Distance Measurement Using Python – Part 2. Following on from my Ultrasonic Distance Measurement Using Python – Part 1 article I decided to make my Python script a little bit more sophisticated. In this example the script takes three measurements and calculates the average. Cheap PIR Sensors and the Raspberry Pi – Part 2. Raspberry Pi 1- Wire Digital Thermometer Sensor. Top 10 Things to Connect to Your Raspberry Pi. Berryclip 6 LED Board Testing in C. Raspberry Pi CPU Usage Monitoring With A BerryClip. The Official Raspberry Pi Camera Module. Pi Camera Module Mechanical Dimensions. Having played around with the Pi camera I quickly realised I needed to make some sort of stand for it. The module weighs almost nothing and is tiny so it can be quite hard to keep in one place when you are experimenting. How To Disable The Red LED On The Pi Camera Module. Installing The Raspberry Pi Camera Module.
Taking Hi-Res Photos With The Pi Camera Module. Capturing HD Video With The Pi Camera Module. Not only can the Raspberry Pi camera capture photos but it can also capture full HD video at 1920×1080. Creating Timelapse Videos With The Raspberry Pi Camera. Adding A Watermark Or Logo To A Timelapse Video Using Avconv. Raspberry Pi Command Line Audio.