background preloader

Tutorial: How to use your Raspberry Pi like an Arduino

Raspberry Pi, Python & Arduino | We Saw a Chicken … After the other night’s wonderfully slow detour into Processing, I thought I’d try the Raspberry Pi’s “native” language of Python to control an Arduino. This worked rather well, though I don’t have a slick GUI for it yet. pyFirmata is the magic that allows an Arduino running Firmata to talk to Python. It’s fairly easy to install under Raspbian: Get the required packages:sudo apt-get install python-serial mercurialDownload the pyFirmata code:hg clone cd pyfirmata sudo python setup.py install (If this succeeds, you can delete the pyfirmata folder.) Using pyFirmata is a bit different from other Arduino applications: Here’s some code that uses the same hardware as before, but simply reports the temperature and ramps the brightness of the LED up in 10% steps. The output from this might look like: If this doesn’t work, check the output of dmesg to see if you’re using the right port. which should generate something like Send the author to the moon!

RaspberryPi @Homelabs » RaspberryPi the Arduino Development Tool Not really too much to say here. There has been much talk on the forums about using arduino and similar systems to provide additional IO capabilities for the RaspberryPi. So I decided to take things a little further and discover whats needed to use the RaspberryPi itself as a development platform using the Arduino IDE. Following the simple steps below, it is possible to install, and run the arduino IDE, and then re program your USB connected arduino. I’m not going to go into too much detail, but simply provide you with the recipe to replicate my success Firstly log on using the pi user (I did it over ssh). wget tar zxvf arduino-1.0-linux64.tgz sudo apt-get install avr-libc sudo apt-get install libftdi1 sudo apt-get install avrdude sudo apt-get install openjdk-6-jre sudo apt-get install librxtx-java cd arduino-1.0 for i in $(find . pi@rasp:~$ cd arduino-1.0/ pi@rasp:~/arduino-1.0$ .

bcm2835: C library for Broadcom BCM 2835 as used in Raspberry Pi This is a C library for Raspberry Pi (RPi). It provides access to GPIO and other IO functions on the Broadcom BCM 2835 chip, as used in the RaspberryPi, allowing access to the GPIO pins on the 26 pin IDE plug on the RPi board so you can control and interface with various external devices. It provides functions for reading digital inputs and setting digital outputs, using SPI and I2C, and for accessing the system timers. It is C++ compatible, and installs as a header file and non-shared library on any Linux-based distro (but clearly is no use except on Raspberry Pi or another board with BCM 2835). The version of the package that this documentation refers to can be downloaded from You can find the latest version at Several example programs are provided. Tested on debian6-19-04-2012, 2012-07-15-wheezy-raspbian, 2013-07-26-wheezy-raspbian and Occidentalisv01, 2016-02-09 Raspbian Jessie. . make

Raspberry Pi + Arduino + SPI This tutorial will show you how to communicate from your raspberry pi to your arduino using 3-wire SPI. Requirements 1 Raspberry pi (running Raspbian)1 Arduino4 wires Your raspberry pi should be running the newest version of Raspbian. To ensure your system is up-to-date please download and run rpi-update. Wiring Arduino Open your Arduino ide and flash the below code to your Arduino. Arduino code Raspberry Pi With your updated rasbian system you should have the drivers that you need. modprobe spi_bcm2708 modprobe spidev Check to be sure the modules loaded: lsmod Module Size Used by spidev 5944 0 spi_bcm2708 5350 0 snd_bcm2835 21681 0 snd_pcm 81170 1 snd_bcm2835 snd_seq 59528 0 snd_timer 21602 2 snd_seq,snd_pcm snd_seq_device 6924 1 snd_seq snd 57427 5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835 snd_page_alloc 5343 1 snd_pcm i2c_bcm2708 3822 0 Raspberry Pi Code Save the below code as spidev_test.c on to your Raspberry Pi and compile it gcc spidev_test.c -o spidev_test Running sudo . Debugging

Dr. Monk's DIY Electronics Blog: raspberry pi The Raspberry Pi has some competition, in the shape of the BeagleBone Black. I thought it might be useful to compare these two boards and highlight their relative advantages. Both boards are Linux-based single board computers about the size of a credit card. About the Raspberry Pi The Raspberry Pi, managed to create a huge amount of interest around the world, even before its release. While the project started in the UK as a platform for getting kids to learn to program, the board has been adopted around the world as a platform for hobbyists and educationalists. About the BeagleBone Black Historically, the BeagleBone Boards have been around for a while selling at around the $85 mark. Features Lets start comparing some of the features of these two boards. Operating System Both devices have a number distributions available for them. The 'standard' and most used distribution for Raspberry Pi is 'Raspbian' which is based on Debian. Processor and Memory Connectors Expansion Boards Power Consumption

GPIO Library Update: 14th May, 2013 wiringPi version 2 has been released and now has its own website ( to look after it. Most of the documentation on the projects site has been copied over to it the new site, but there may still be 1 or 2 pages that are still missing. WiringPi is an Arduino wiring-like library written in C and released under the GNU LGPLv3 license which is usable from C and C++ and many other languages with suitable wrappers (See below) You may be familiar with the Arduino… Briefly; Arduino is really two things; one is a hardware platform, the other software, and part of the software is a package called Wiring. The Raspberry Pi has a 26-pin General Purpose Input/Output (GPIO) connector and this carries a set of signals and buses. The Revision 2 Raspberry Pi has an additional 4 GPIO lines on a separate connector which you have to solder onto the board. WiringPi includes a command-line utility gpio which can be used to program and setup the GPIO pins. Pin numbering

Raspberry Pi Raspberry Pi OpenCV Pan & Tilt Face Tracker Create your own face tracking, pan and tilt camera on the Raspberry Pi! This tutorial will demonstrate use of the OpenCV (computer vision) library to identify and track faces on the raspberry pi using two servos and a USB webcam. This project is based on the OpenCV face tracking example that comes along with the source-based distribution. Using the coordinates of the rectangle vertices, my script calculates the (X,Y) position of the center of the face. Hardware Parts needed: 512 MB raspberry pi2x Hobby servos (Turnigy 9g fom Hobby King)Pan & tilt bracket (from Foxtech FPV)USB webcam (Microsoft LifeCam Show from Amazon)Power supplyHook-up wireRaspberry Pi enclosure (from Built to Spec) Assembly Connect the red, power lines of the servos to +5v, the black ground lines to GND, and the yellow signal lines to the desired output pins, GPIO pins 22 and 23 in the example. And here is how it looks all put together: Software Get the source. Software Hardware

0.3.1a A module to control Raspberry Pi GPIO channels Latest Version: 0.5.4 This package provides a class to control the GPIO on a Raspberry Pi. Note that this module is unsuitable for real-time or timing critical applications. Downloads (All Versions): 281 downloads in the last day 2327 downloads in the last week 9880 downloads in the last month Raspberry pi – Setting up auto-login and auto-loading the gui | Frustrated IT Engineer Home > How To, Raspberry pi, Technology > Raspberry pi – Setting up auto-login and auto-loading the gui Setting up Auto-Login In the GUI left click in the bottom left hand corner on the blue cross to display the options menu (Like the start button in windows) Go up to “other” and then scroll down the list until you get to “terminal” and left click You should now see the “terminal” window which is just like a cmd box in windows and enter the following command Sudo nano /etc/inittab This will open up the boot time system configuration script. Scroll down the file until you reach the line ’1:2345:resoawn:/sbin/getty 115200 tty1′ When you see that line, put a hash # in front of it to disable that line then scroll to the end of line and hit enter. In the blank line that appears add the following command 1:2345:respawn:/bin/login -f pi tty1 / dev/tty1 2>&1 Don’t forget to add the spaces and double check that the line enter is correct. Press Ctrl+X to exit followed by Y to accept the changes. Startx

Raspberry Pi and Arduino via GPIO UART | andremiller.net In an attempt to get my Raspberry Pi talking to my Arduino I’m exploring various different options. The first was to just use the USB connection, but that was too simple. So, here is how to connect the two using the UART on the GPIO pins of the Raspberry Pi. To make testing easier I wanted to keep the Arduino’s serial connected via USB to my PC so I can print messages there and read it with the Serial Monitor. To show how this works the Arduino is running a small program that reads from the Raspberry Pi’s and copies this to my PC via USB. By default the Raspberry Pi uses the UART in two ways: Console Messages (including bootup messages)A getty so you can login via serial To use this serial port for your own uses you need to disable these two services. To change the console baudrate, edit /boot/cmdline.txt to look like this (this is all one line): dwc_otg.lpm_enable=0 console=ttyAMA0,9600 kgdboc=ttyAMA0,9600 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait Connected to PC

Hacking a Raspberry Pi into a wireless airplay speaker - Jordan Burgess The raspberry pi is fully functional credit card-sized computer that is cheap enough ($25) that it can be used just for a single purpose. With this hack the computer imitates an airplay speaker, making it possible to send songs over to an old stereo wirelessly from your phone. The Raspberry Pi generated massive hype in nerdy circles this summer when it came out and we’re beginning now to see some amazing hacks from this tiny computer now. I’ve had mine for a few months now but I hadn’t got around to using it yet. So I’ve now decided to try to make something that I’ve wanted for a while: a product to bring my good but dated speaker system into the 21st century by enabling wireless streaming of music to it. A possible way to do this would be to buy an Airport Express or an Apple TV and connect the audio out to the stereo. Here’s a video of it in action. How to fake airplay compataility To get a Raspberry Pi looking like an airplay receiver I made use of Shairport. Raspberry Pi Graphical method

Format SD Card Firstly, you need to install the Debian image onto an SD card (2GB or more). (The image can be downloaded from You can do this using the Win23DiskImager tool for Windows (downloaded from Insert your SD card. Once the write process has finished, you can remove the SD card, then the fun begins. Bald Wisdom » Blog Archive » Introducing Raspbery Pi à la mode Our first prototypes are back, and working quite well! SeeedStudio fabricated the prototype boards and quickly sourced the parts. The boards were of excellent quality. If you haven’t been following, Anool Mahidharia, Justin Shaw and I from the Wyolum.com OSHW collaborative have been developing a stackable Arduino compatible for the Raspberry Pi. While there are lots of emerging examples of interfacing hardware to the Pi, it’s just not as easy as the Arduino, and the Arduino already has hundreds of libraries for interfacing with motors, sensors, and displays. Here are the features including a few extra goodies: Flexible power. We’re in limited Beta right now, but as soon as it’s thoroughly tested, we hope to produce them for sale as soon as we can! share

Hacker uses Kindle as Raspberry Pi screen High performance access to file storage A hacker named Gef has rigged up his Raspberry Pi to use a Kindle e-reader as its monitor. “Hacker” may not quite be the word, actually, as the individual responsible identifies himself as an “eclectic yogi discovering the world of computational art and new media” on the blog post where the recipe for the KindleBerry Pi is revealed. Names aren't the guy's long suit either: his Twitter account says he's called “Gef” although his handle is @damarusama. We'll nonetheless proceed on the basis this is the work of a human, not a canine, and report that the way to achieve the feat of using a Kindle as a Pi's monitor requires you to: "Jail break the Kindle, install this terminal emulator … and then install UsbNetwork. At this point it is apparently possible to use the Kindle's keyboard to control the Pi, but as the display operates in landscape mode the keyboard is at a 90 degree angle to the screen.

Related: