Single UART with I²C/SPI Interface with Arduino

 '''' This is a Breakout board of SC16IS750 chip.
The SC16IS740/750/760 is a slave I2C-bus/SPI interface to a single-channel high performance UART.
It offers data rates up to 5 Mbit/s and guarantees low operating and sleeping current.
The SC16IS750 and SC16IS760 also provide the application with 8 additional programmable I/O pins.
Here there is a collection of examples for connect the SC16IS750 Breakout with Arduino.


The Adobe Flash Plugin is needed to display this content.

Wiring (SPI Mode)

 ''''

  • Breakout IRQ to Digital pin 7
  • Breakout MOSI to Digital pin 11
  • Breakout MISO to Digital pin 12
  • Breakout CS to Digital pin 10
  • Breakout SDA to Arduino GND
  • Breakout SCL to Digital pin 13
  • Breakout 3V3 to Arduino 3V3
  • Breakout I2C to Arduino GND
  • Breakout GND to Arduino GND


Wiring (I²C Mode)

..coming soon..

How to use with Wifly


Connect to WiFly breakout

 ''''

  • Breakout RX to Wifly UART-TX
  • Breakout TX to Wifly UART-RX
  • Breakout CTS to Wifly GPIO-13
  • Breakout RTS to Wifly GPIO-12
  • Breakout GPIO0 to Wifly GPIO9
  • Breakout GPIO1 to Wifly RESET
  • Breakout GPIO2 to Wifly FORCE-AWAKE


Connect SHT15 to Arduino

In this image the sensor is connected on pin 10 and 11 but in the sample code we use pin 5(SCL) and 6(SDA), otherwise you can choose your favorite pins


Source Code Simple Example

  1. Download the library “WiFly” and unzip it in your Arduino Library directory
  2. Download the library “sth1x” and unzip it in your Arduino Library directory
  3. Flash your Arduino with this sketch (assumed that your wifi network has an WPA or WPA2):
WiFly_RemoteTemperature.pde
/*
 * Web Server
 *
 * (Based on Ethernet's WebServer Example)
 *
 * A simple web server that shows the value of SHT15 I2C sensor
 * and print it on html page.
 */
 
 
#include "WiFly.h"
#include "Credentials.h"
#include <SHT1x.h>
 
#define dataPin  6
#define clockPin 5
 
SHT1x sht1x(dataPin, clockPin);
 
Server server(80);
 
void setup() {
  WiFly.begin();
 // WiFly.sendCommand("set wlan ext_antenna 1");
 
  if (!WiFly.join(ssid, passphrase)) {
    while (1) {
      // Hang on failure.
    }
  }
 
  Serial.begin(9600);
  Serial.print("IP: ");
  Serial.println(WiFly.ip());
 
  server.begin();
}
 
void loop() {
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          client.println("<html><body bgcolor='#000000;' text='white'>");
          client.println("<meta http-equiv='refresh' content='5'>");
          client.println("<center>");
          client.println("<img src='http://wiki.madefree.eu/dokuwiki/lib/exe/fetch.php?w=120&h=64&media=logo.png' />");
          client.println("<br />");
          client.println("<br />");
 
          client.print("Temperature: ");
          client.print(sht1x.readTemperatureC());
          client.print(" C");
          client.println("<br />");
 
          client.print("Relative humidity: ");
          client.print(sht1x.readHumidity());
          client.print(" %");
          client.println("<br />");
 
          client.println("</center></body></html>");
          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(200);
    client.stop();
  }
}
Credentials.h
#ifndef __CREDENTIALS_H__
#define __CREDENTIALS_H__
 
// Wifi parameters
char passphrase[] = "passphrase";
char ssid[] = "ssid";
 
#endif

Now, if the WiFi module is associated well, the DHCP server has registered a new address, to know it you can look in your router's configuration page, or if you are connected with it via usb, by opening the serial communication from the Arduino software.


Open browser and type in the ip address….


Troubleshooting

If the connection seems poor then close your browser and connect via telnet

$ telnet 10.10.10.106 80

enter in command mode

$$$

set the parameter ext_antenna to 1

<2.21> set wlan ext_antenna 1

then save and reboot

<2.21> save
<2.21> reboot

For some strange reason, activating the external antenna, rather than the onchip one, the signal improves.

Link

 
sc16is750_arduino.txt · Last modified: 2011/01/04 13:19 by daniele.sdei
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki