Interfacing with Arduino

  • 2,719 views
Uploaded on

Slides from the TinkerSoc Interfacing with Arduino session.

Slides from the TinkerSoc Interfacing with Arduino session.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,719
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Omer Kilic | omer@tinkersoc.org
  • 2. Interfacing?
    A
    B
  • 3. Standard Computer Interfaces
    Wired
    USB
    Serial Port
    Parallel Port
    Firewire
    Ethernet
    And others…
  • ‘Embedded’ Interfaces
    SPI
    I2C
    1-Wire
    UNI/O
    And others…
  • 7. RS232 – The Serial Port
    Asynchronous serial communications protocol
    No clock is sent - the receiver must provide the clock signal
    Data rate must be known by transmitter and receiver
    Arduino implements a ‘virtual’ serial port via USB
    http://arduino.cc/en/Reference/Serial
  • 8. Voltage Levels
    Different devices may have different voltage levels
    Example: RS232
    Voltage levels specified as +12/-12 volts in the standard
    Hooking these levels up to the micro will FRY it!
    Solution: Use a level converter
  • 9. RS232 Level Converter
  • 10. Virtual COM Ports
    Serial port via USB
    Applications think they are talking to a serial port, which is emulated by the drivers
    No need to have a physical serial port!
    Most new machines don’t have them anyway
    A LogicalChoice(tm) !
  • 11. Example Project: Thermometer
    A temperature sensor is connected to an analog input on the Arduino
    Arduino periodically reports the temperature back to PC
    PC uses this data to plot graphs etc.
  • 12. It’s an analog world…
    Digital – only has two values: on/off
    Analog – has many (infinite) values
    Computers don’t really do analog
    So they fake it, with quantization
    From Tod E. Kurt’s ‘Spooky Projects’ notes - http://todbot.com/blog/spookyarduino/
  • 13. Thermometer: Arduino Code
    intsensorPin = 0; // the analog pin that the sensor is connected to
    void setup(){
    Serial.begin(9600);
    }
    void loop(){
    //getting the voltage reading from the temperature sensor
    int reading = analogRead(sensorPin);
    // converting that reading to voltage, for 3.3v arduino use 3.3
    float voltage = reading * 5.0 / 1024;
    // print out the voltage
    Serial.print(voltage); Serial.println(" volts");
    // now print out the temperature
    floattemperatureC = (voltage - 0.5) * 100;
    // converting from 10 mV per degree with 500 mV offset
    // to degrees ((voltage - 500mV) times 100)
    Serial.print(temperatureC); Serial.println(" degress C");
    delay(1000); // wait a second
    }
    From Ladyada’s TMP36 Tutorial - http://www.ladyada.net/learn/sensors/tmp36.html
  • 14. Thermometer: PC Side
    Read the incoming data every X seconds (cron)
    Collect and plot temperature graphs (rrdtool)
    Example: thermostat-graph
    http://www.anders.com/projects/thermostat-graph/
    Not an Arduino project but easily hackable!
  • 15. Example Project: OrangeMessenger
    (demo)
  • 16. Thank you for listening Any questions?
    Further questions/comments to omer@tinkersoc.org please…