CC3000 WiFi chip
To see if your WiFi chip is correctly wired and operational, I recommend to use the test sketches that come with the Adafruit library that you need to get from GitHub. I used for example the one called WebClient. Just open it from the library’s folder, and save it to a new file (you need to be able to modify the sketch to enter your WiFi network name & password).Then, modify the sketch with the correct data for you WiFi network, and upload to the board. You can then open your serial monitor, and if everything was wired correctly (and your Internet connection is working!) you should see your Arduino connecting to the web, then connecting to the Adafruit’s website, and printing some information:
Hello, CC3000!
Free RAM: 1141 bytes
Initializing...
Started AP/SSID scan
Connecting to yourNetwork...Waiting to connect...Connected!
Request DHCP
IP Addr: 192.168.0.2
Netmask: 255.255.255.0
Gateway: 192.168.0.254
DHCPsrv: 192.168.0.254
DNSserv: 192.168.0.254
www.adafruit.com -> 207.58.139.247
Connect to 207.58.139.247:80
-------------------------------------
HTTP/1.1 200 OK
Date: Tue, 17 Sep 2013 09:23:39 GMT
Server: Apache
Access-Control-Allow-Origin: http://learn.adafruit.com
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Accept-Encoding, Authorization, Referer, User-Agent
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 1728000
Last-Modified: Thu, 27 Jun 2013 14:13:27 GMT
Accept-Ranges: bytes
Content-Length: 74
Connection: close
Content-Type: text/html
This is a test of the CC3000 module!
If you can read this, its working :)
-------------------------------------
Disconnecting
DHT11 sensor
To use the DHT11 sensor, you need to download the corresponding library first and put it into your /libraries folder inside your Arduino folder. You can use the following sketch to test the DHT11 sensor, update it for DHT22 or AM2302 if you end up using one of those instead// Include required libraries #include <SPI.h> #include <string.h> #include "DHT.h" // DHT11 sensor pins #define DHTPIN 7 #define DHTTYPE DHT11 // DHT instance DHT dht(DHTPIN, DHTTYPE); void setup(void) { // Initialize DHT sensor dht.begin(); Serial.begin(115200); } void loop(void) { // Measure the humidity & temperature float h = dht.readHumidity(); float t = dht.readTemperature(); // Transform to String String temp = String((int) t); String hum = String((int) h); Serial.print("Temperature: "); Serial.println(temp); Serial.print("Humidity: "); Serial.println(hum); Serial.println(""); }
Upload this sketch to the Arduino board, open the serial monitor and select 115200 baud, and this is what you should see:
Temperature: 21
Humidity: 23
Temperature: 21
Humidity: 23
Temperature: 21
Humidity: 22
Temperature: 21
Humidity: 23
Temperature: 21
Humidity: 23
Temperature: 21
Humidity: 23
Temperature: 21
Humidity: 23
If you can't communicate with the sensor, or the data looks really wrong, check your wiring and code until it works. It has to work before we continue!
Page last edited September 17, 2013
Text editor powered by tinymce.