Omer Kilic | omer@tinkersoc.org
Interfacing?AB
Standard Computer InterfacesWiredUSBSerial PortParallel PortFirewireEthernetAnd others…Wireless
WiFi
Bluetooth
IrDA‘Embedded’ InterfacesSPII2C1-WireUNI/OAnd others…
RS232 – The Serial PortAsynchronous serial communications protocolNo clock is sent - the receiver must provide the clock signalData rate must be known by transmitter and receiverArduino implements a ‘virtual’ serial port via USBhttp://arduino.cc/en/Reference/Serial
Voltage LevelsDifferent devices may have different voltage levelsExample: RS232Voltage levels specified as +12/-12 volts in the standardHooking these levels up to the micro will FRY it!Solution: Use a level converter
RS232 Level Converter
Virtual COM PortsSerial port via USBApplications think they are talking to a serial port, which is emulated by the driversNo need to have a physical serial port!Most new machines don’t have them anywayA LogicalChoice(tm) !
Example Project: ThermometerA temperature sensor is connected to an analog input on the ArduinoArduino periodically reports the temperature back to PCPC uses this data to plot graphs etc.
It’s an analog world…Digital – only has two values: on/offAnalog – has many (infinite) valuesComputers don’t really do analogSo they fake it, with quantizationFrom Tod E. Kurt’s ‘Spooky Projects’ notes - http://todbot.com/blog/spookyarduino/
Thermometer: Arduino CodeintsensorPin = 0;	// the analog pin that the sensor is connected tovoid setup(){Serial.begin(9600);}void loop(){//getting the voltage reading from the temperature sensorint reading = analogRead(sensorPin);  // converting that reading to voltage, for 3.3v arduino use 3.3float voltage = reading * 5.0 / 1024; // print out the voltageSerial.print(voltage); Serial.println(" volts");// now print out the temperaturefloattemperatureC = (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
Thermometer: PC SideRead the incoming data every X seconds (cron)Collect and plot temperature graphs (rrdtool)Example: thermostat-graphhttp://www.anders.com/projects/thermostat-graph/Not an Arduino project but easily hackable!

Interfacing with Arduino

  • 1.
  • 2.
  • 3.
    Standard Computer InterfacesWiredUSBSerialPortParallel PortFirewireEthernetAnd others…Wireless
  • 4.
  • 5.
  • 6.
  • 7.
    RS232 – TheSerial PortAsynchronous serial communications protocolNo clock is sent - the receiver must provide the clock signalData rate must be known by transmitter and receiverArduino implements a ‘virtual’ serial port via USBhttp://arduino.cc/en/Reference/Serial
  • 8.
    Voltage LevelsDifferent devicesmay have different voltage levelsExample: RS232Voltage levels specified as +12/-12 volts in the standardHooking these levels up to the micro will FRY it!Solution: Use a level converter
  • 9.
  • 10.
    Virtual COM PortsSerialport via USBApplications think they are talking to a serial port, which is emulated by the driversNo need to have a physical serial port!Most new machines don’t have them anywayA LogicalChoice(tm) !
  • 11.
    Example Project: ThermometerAtemperature sensor is connected to an analog input on the ArduinoArduino periodically reports the temperature back to PCPC uses this data to plot graphs etc.
  • 12.
    It’s an analogworld…Digital – only has two values: on/offAnalog – has many (infinite) valuesComputers don’t really do analogSo they fake it, with quantizationFrom Tod E. Kurt’s ‘Spooky Projects’ notes - http://todbot.com/blog/spookyarduino/
  • 13.
    Thermometer: Arduino CodeintsensorPin= 0; // the analog pin that the sensor is connected tovoid setup(){Serial.begin(9600);}void loop(){//getting the voltage reading from the temperature sensorint reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3.3float voltage = reading * 5.0 / 1024; // print out the voltageSerial.print(voltage); Serial.println(" volts");// now print out the temperaturefloattemperatureC = (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 SideReadthe incoming data every X seconds (cron)Collect and plot temperature graphs (rrdtool)Example: thermostat-graphhttp://www.anders.com/projects/thermostat-graph/Not an Arduino project but easily hackable!
  • 15.
  • 16.
    Thank you forlistening Any questions?Further questions/comments to [email protected] please…