background preloader

Raspberry Pi and Arduino

Raspberry Pi and Arduino
Note. There is now a followup to this post here. The Raspberry Pi is creating quite a storm of interest. .. and you know what? Arduino Let's start with the Arduino end. Here is the sketch - paste it into a new Arduino IDE window and load it up onto your Arduino using your regular computer. const int ledPin = 13;void setup(){ pinMode(ledPin, OUTPUT); Serial.begin(9600);}void loop(){ Serial.println("Hello Pi"); if (Serial.available()) { flash( - '0'); } delay(1000);}void flash(int n){ for (int i = 0; i < n; i++) { digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW); delay(100); }}Raspberry Pi There is a Python library for serial communications called 'pySerial' which has history with Arduino. Step 1. Step 2. Step 3. Step 4. Step 5. Thats it! You type the parts after >>> import serialser = serial.Serial('/dev/ttyACM0', 9600) Note that the second argument here (9600) is the baud rate and should match whatever you put in your Arduino sketch. ls /dev/tty* When you type Related:  Arduino

Connect Raspberry Pi and Arduino with Serial USB Cable There are many ways of connecting the Raspberry Pi and Arduino, such as using the GPIO and Serial pins and using I2C. But this could be one of the easiest way to get them talking, because hardware that required is minimal: all you will need is a micro USB cable that comes with the Arduino. To Setup your Raspberry Pi, check out this article. To Demonstrate how this works, I will be doing two little projects, one for data going to Raspberry Pi from Arduino, the other one for the opposite. First of all, make sure you have installed pySerial, which gives you the ability to read from and write to the serial port with Python Programming language. Arduino Talking to Raspberry Pi via USB cable We will send ‘Hi’ from the Arduino to the Raspberry Pi every 2 seconds. void setup(){ Serial.begin(9600); } void loop(){ Serial.println("Hello Pi"); delay(2000); } Run Python 2 on Raspberry Pi. Type the following after >>> import serial ser = serial.Serial('/dev/ttyACM0', 9600) ls /dev/tty* ser.write('3')

Raspberry Pi and Arduino Connected Over Serial GPIO One way to connect the Raspberry Pi and Arduino is by connecting the GPIO on the Raspberry Pi and the Serial Pins on the Arduino. Because there is a voltage difference between the two device on these interface, a voltage divider or logic level converter would be required. Check my article about connecting the two using I2C if you haven’t already seen it. Before we start, we need to set up the Raspberry Pi so it’s ready for serial communication. 0. if you have not seen my article on how to remote access your Raspberry Pi, take a look here: 1. T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 And comment it out by adding # in front of it #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 2. console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 3. reboot the Raspberry Pi using this command: sudo reboot 4. sudo apt-get install minicom And that’s the end of the software configuration. Load this program on your Arduino first: To exit, press CTRL + C

Raspberry Pi and Arduino Connected Using I2C With Raspberry Pi and I2C communication, we can connect the Pi with single or multiple Arduino boards. The Raspberry Pi has only 8 GPIO’s, so it would be really useful to have additional Inputs and outputs by combining the Raspberry Pi and Arduino. There are many ways of Linking them such as using USB cable and Serial Connection. Why do we choose to use I2C? One reason could be it does not use your serial, USB on the Pi. In this article I will describe how to configure the devices and setup Raspberry Pi as master and Arduino as slave for I2C communication. In the next article I will be doing some Voice Recognition, if you are interested see here Raspberry Pi Voice Recognition Works Like Siri The Raspberry Pi is running at 3.3 Volts while the Arduino is running at 5 Volts. The reason it works is because the Arduino does not have any pull-ups resistors installed, but the P1 header on the Raspberry Pi has 1k8 ohms resistors to the 3.3 volts power rail. Remove I2C from Blacklist: i2c-dev

Raspberry Pi + Arduino + Tornadoniltoid. Tornado is a great open source, Python based web framework. It is designed to be light-weight, easily scalable, non-blocking and it supports websockets and some other nice features. What’s more, it runs smooth and quick on the Raspberry Pi. Thus far, my experiments with the Raspberry Pi have involved running Node.js on it to serve web pages and to interact over serial with an Arduino. Here are some posts on how to do that: 1. I wanted to try accomplishing something similar using Python. Tornado Setup First things first, install Tornado on your Raspberry Pi: 1. 2. 3. 4. 5. 6. 7. To make sure everything works, create a file named “” containing the following code (taken from Tornado’s site), and run it from terminal using the command “python” Now on a separate computer on the same network, navigate your browser to (or use the IP address for example Adding Websockets Adding websockets to your Tornado app is easy. 1.

Control your Arduino board with Raspberry Pi and Python Introduction An Arduino board can communicate with the Raspberry Pi via a serial over USB connection. This creates a virtual serial interface, which it uses like a normal interface, reading and writing to the serial device file. To begin, attach your Arduino board and type: $dmesg | tail [..]usb 1-1.2: Manufacturer: Arduino[..][..]cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device[..] My Arduino Uno board device is /dev/ttyACM0 and its driver is cdc_acm. $ls -l /dev/ttyACM* crw-rw---T 1 root dialout 166, 0 Nov 5 00:09 /dev/ttyACM0 Ok, now you should add your user to the ‘dialout’ group to give the required read/write access, then logout and login again for this to take effect: $sudo usermod -a -G dialout YOURUSERNAME This is important because Nanpy works using this device file. $sudo apt-get install arduino from nanpy import ArduinoArduino.pinMode(13, Arduino.OUTPUT)Arduino.digitalWrite(13, Arduino.HIGH) Arduino provides all of the main functions, delay, analog/digital write and read.

nanpy 0.9.2 Use your Arduino board with Python. Description ----------- The main purpose of Nanpy is making programmers' life easier, giving them something to create prototypes faster and use Arduino in a simpler way, thanks to a simple and powerful language like Python. Also Nanpy can run on RaspberryPi (tested with Raspbian so you can use it for communicating with Arduino :) Let's start with a classic example, turn on a led placed in the 13th pin.. from nanpy import (ArduinoApi, SerialManager) connection = SerialManager() a = ArduinoApi(connection=connection) a.pinMode(13, a.OUTPUT) a.digitalWrite(13, a.HIGH) NOTE: you can also use the old serial_manager global object There are a lot of projects able to do that. Nanpy can do more! Nanpy is easily extensible and can theoretically use every library, allowing you to create how many objects you want. We started supporting OneWire, Lcd, Stepper and Servo library and they're still incomplete.

Informer and server fan control / Smart house / Blog This device was developed for: 1. Monitoring temperature in outdoor, server room, garage, etc. 2. Controlling fans of server. 3. Showing information about date and time, usage CPU and RAM, internet traffic, date and time on 20x4 LCD. 1. 1.1. 1.2. 2. The main program I wrote on Python. 2.1. git clone nanpy-firmware && . 2.1.2. #pragma once #define BAUDRATE 115200 #define USE_Servo 1#define USE_Tone 1#define USE_LiquidCrystal 1#define USE_Stepper 1#define USE_EEPROM 1#define USE_RAM 1#define USE_Define 1#define USE_ArduinoCore 1#define USE_Watchdog 1#define USE_Register 1#define USE_Info 1#define USE_Counter 0#define USE_Wire 1 // external libraries should be installed for the following features:#define USE_OneWire 0#define USE_DallasTemperature 1#define USE_CapacitiveSensor 0#define USE_DHT 1 // USE_LiquidCrystal_I2C 0 2.1.3. 2.2. 2.3. Usage very simple, by GET requests, for examples: 1.

Arduberry For The Raspberry Pi and Arduino Shields Product Description Arduberry For The Raspberry Pi and Arduino Shields connects Arduino shields and the Raspberry Pi with a simple, inexpensive hardware solution. Slide it on, copy your code, and go. The Arduberry is compatible with the new Raspberry Pi B+. What’s Arduberry? The Arduberry is a simple and inexpensive way to bring Arduino shields to the Raspberry Pi. The Arduberry brings the Raspberry Pi and Arduino together, uniting the two greatest hacking systems ever. More Information See our Arduberry page for more detailed information on this system and how to use it! Get Started With the Arduberry Example Projects With the Arduberry Programming the Arduberry

OpenProcessing - Share your sketches! Arduino and Atmel launch the Arduino Wi-Fi Shield 101 Following an exciting two days of MakerCon and on the eve of Maker Faire, the team of Atmel and Arduino have announced the launch of the Arduino Wi-Fi Shield 101, a shield that enables rapid prototyping of Internet of Things (IoT) applications on the highly-popular open-source platform. The cost-effective, secure Arduino Wi-Fi Shield 101 is an easy-to-use extension that can seamlessly be connected to any Arduino board enabling high-performance Wi-Fi connectivity. This new shield gives the design community more opportunities to securely connect IoT applications, ranging from consumer goods to wearables, robotics, high-tech devices and more. The Arduino Wi-Fi Shield 101 is powered by Atmel’s wireless network controller, part of the Atmel SmartConnect family, and also includes the CryptoAuthentication device which allows users to easily incorporate hardware authentication capability in their design. Since 2005, a worldwide community of Makers has gathered around this open source platform.

Référence Arduino français Main/Mini Reference Référence : Langage Arduino : [ Mini | Standard | Etendue | Maxi ] Librairies : [ Vue d'ensemble | Synthèse ] Infos : [ Comparaison | Changements ] Nouveau : Découvrez nos kits de machines opensource et notre nouveau site dédié ! Cette page est faite pour les débutants complets avec le langage Arduino et présente les instructions vraiment utiles pour débuter sans s'embrouiller la tête... On pourra ensuite passer à la référence standard pour davantage de fonctions du langage Arduino et à la page des librairies pour interfaçage avec des types de matériel particuliers (afficheur LCD par exemple). Les programmes Arduino peuvent être divisés en trois parties principales: la structure, les valeurs (variables et constantes) et les fonctions. NOUVEAU : Toutes les instructions de la référence "Mini" sur une seule page ! Commentaires utilisateurs Pour commencer avec le langage Arduino, la connaissance d'une dizaine d'instructions suffit amplement pour faire ses premières armes !

Tutoriel : LEDs et Arduino De Wikidebrouillard. À propos de ce tutoriel Ce tutoriel traite de ces magnifiques petites choses lumineuses que sont les LED. Nous en avons déjà parlé dans la leçon n°3 quand nous nous sommes amusés à faire clignoter des LED, mais aussi à jouer avec des LED multicolores pour former une orbite lumineuse à variation de couleur dynamique. Si vous n'avez pas encore abordé cette leçon, nous vous invitons à la suivre jusqu'au bout, d'accord ? Ainsi, nous pourrons commencer par quelques expériences. Ce tutoriel sera utile pour approfondir vos connaissances sur les LED. Aucun codage n'est employé pour les besoins de l'exercice et bien que les images soient en Arduino, vous n'en avez pas besoin pour suivre la leçon. Les LED ! Qui n'aime pas les LED ? C'est parti pour une leçon d'anatomie... Les composants d'une LED Les LED sont très courantes dans la vie de tous les jours et se déclinent en dizaines de tailles et de formes différentes. Ce qu'il y a de bien avec les LED, c'est leur simplicité.