Hardware and Python Steve Granda. Why would I want to do this? You want to make something interactive. You want to recreate sputnik. You want to measure.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Lab7: Introduction to Arduino
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Lecture 8: Serial Interfaces
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
New Human Computer Interfaces Amnon Dekel HUJI – CSE, Spring 2007 Class 3 March
1 Arduino Board: Arduino UNO Arduino Programing Environment: Arduino 0022
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Serial Communications Standards (Partly Excerpted from Simpl Primer) Cabling Configuration Protocol.
RS232 Serial and Parallel Interfaces
Intel Do-It-Yourself Challenge Hello World with the Arduino IDE Nicolas Vailliet Intel.
Embedded Programming and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Smart Home for disabled people Students: Atara Gutman and Anastasia Logvinenko Instructor: Alexander Kinko Final Presentation Semester Spring part.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc.
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Intro to the Arduino Topics: The Arduino Digital IO
Ballooning Bundle. What is a Microcontroller? Small computer with a processor core, memory and programmable input/output Continuously repeats software.
Networks Types & Topologies. Objectives  To understand the two different setup of networks and their characteristics  Know the 3 different types of.
Ch Review1 Review Chapter Microcomputer Systems Hardware, Software, and the Operating System.
RC CAR CONTROLLER BASED ON INTEL GALILEO SOC PLATFORM Nadav Shiloach Sagi Sabag Supervisor: Idan Shmuel Spring 2014 One Semester Project PROJECT’S ENDING.
Bluetooth Controller Setting up the BT controller and Arduino with Processing.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
INTERFACING WEB SERVER WITH A ROBOT
Arduino 101 Instructors: Ted Markson / Jim Sweeney.
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Checking Zigbee network What to do if the system is not working…
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis.
Overview What is Arduino? What is it used for? How to get started Demonstration Questions are welcome at any time.
Information & Communication Technology (ICT) Books: 1. Management Information Systems James A. O’Brien & George M. Marakas 2. Introduction Of Information.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1.
Getting Started With the Arduino Uno
智慧電子應用設計導論(1/3) Arduino MEGA 2560
Who Are You, Arduino? Er. Sahil Khanna
Reading and Writing Text over USB A Colony Project Tutorial.
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
Microcontroller basics Embedded systems for mortals.
ICTWays workshop “Creativity and imagination in the classroom: Arduino and its application samples” LLP PT-COMENIUS-CNW
TV Remote As A Wireless Mouse For PC.
Istituto Tecnico Industriale A.Monaco EURLAB European Robotic LABoratory HOW TO Transmit and RECEIVE Datas.
Bluetooth Temperature and Barometric Pressure Sensor BY: TOM VANHOUDT.
Arduino.
Voice Controlled Robot by Cell Phone with Android App
Arduino Part 1 Topics: Microcontrollers
Getting Started: Building & Programming
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Lab 7 Basic 1: Game of Memory
Welcome to Arduino A Microcontroller.
European Robotic LABoratory
Overview What is Arduino? What is it used for? How to get started
Assist. Prof. Rassim Suliyev - SDU 2017
Scoutbotics Robot Testing
Arduino Part 1 Topics: Microcontrollers Programming Basics
Serial Communications
Roller Coaster Design Project
مقدمة في الاردنيو د فضل الاكوع.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
How To add a Printer to Mac or PC
Intro to Micro Controllers
Hardware Created by Ed, VE7ED, ver. 1.0.
Arduino Leonardo Setup
Introduction to Arduinos
Introduction to arduino
Presentation transcript:

Hardware and Python Steve Granda

Why would I want to do this? You want to make something interactive. You want to recreate sputnik. You want to measure data from hardware or sensor. You want to begin reverse engineering hardware. You want to create a robotic army of minions. Yeah, well, you know, that's just, like, your opinion, man.

What are we using today? Python FTDI Cable (Serial to USB) Arduino Duemilanove LEDs

Wired Hardware Communication

FTDI to Python

Wireless Hardware Communication

Programming the Arduino … //SETUP PINS and UART void setup() { //Begin Serial Communication Serial.begin(9600); … Serial.println("INITIALIZING "); Serial.print("\n"); Serial.print("\r"); Serial.println("BOARD WAS RESET"); You need to tell the Arduino how to interpret what it receives on the FTDI cable by Python. A few simple Serial Commands for the Arduino More can be found here: Serial port is set at 9600

Finally Python import serial, time #Different for Linux, Mac, Win port= '/dev/ttyUSB0 baud= 9600 #Remember this from Arduino times = 1 #The time we take to timeout (1 second) device = serial.Serial(port, baud, timeout = times) while 1 : input = raw_input(">> ") device.write(input + '\r\n') … On Linux/Mac machines, this will be a bit easier as most of the time youll just talk to the FTDI by opening a file: /dev/ttyUSB0 Windows users might have a bit more trouble as the port isnt a file and gets enumerated via Com 1, Com 3, etc. Make sure to set the baud correctly otherwise youll just see garbage printed out (if youre lucky).

Other Ways import serial #Different for Linux, Mac, Win port= '/dev/ttyUSB0 baud= 9600 #Remember this from Arduino times = 1 #The time we take to timeout (1 second) device = open(port, r+) while 1 : input = your input here device.write(input) … There are various ways of communicating with the device over serial since youre technically just writing out to a file. In the previous example we used the serial library and opened: /dev/ttyUSB0 Now try opening /dev/ttyUSB0 as a file and write something to it.

Oddities Sometimes you will: See garbage when reading the line. (Try wiggling the TX/RX cables while reading the /dev/ttyUSB0 file) (Baud Setting, cables are loose, or youre listening to dubstep next to the board) Words will get chopped off. (The hardware/file buffers arent full or got flushed early.) It will be very slow. (9600 baud man bits per second) (8 bits = 1 byte. An ASCII character is about 8 bits) It just wont work. (Solar Flares, Cables popped out, you dont have administrative rights to open the file, ???)

Where to go from here With this basic information you can now buy an FTDI cable and connect it to random devices that have UART/Serial pins. This means you can now read data from hardware or sensors and write it out to a file, parse it, or manipulate it. There are many protocols that you can also manipulate in a similar way requiring other hardware similar to an FTDI cable which can be read by python CAN BUS (Controller Area Network) -- Hack your cars sensors. I²C (Inter-Integrated Circuit) -- Read other sensors Devices in /dev/* -- Write py-scripts to annoy co-workers or just mess up your computer horribly