Monday, February 1, 2016

Programming Arduino





  • Fill in the parts below and provide any references to outside resources that you pulled in:

    • Which laptop OS are you testing to program from:
              Lenovo Ideapad - Windows8 64-bit.
           
              References:
    • https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/installing-the-esp8266-arduino-addon
    • https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/overview 
    • What is the PI you are using and which OS is it setup with?
              Arduino Software (IDE) - v1.6.7 and it is setup with Windows Operating System.

              References:
    • https://www.arduino.cc/en/Main/Software
    • What is the hardware that is needed?
    • ESP8266MOD 
    • MicroUSB charger
    • LED
    • DHT11 Sensor
    • 10K Ohms Resistor
    • Jumper wires 
               References:
    • https://learn.adafruit.com/wifi-weather-station-arduino-cc3000/connecting-the-cc3000-breakout-board 
    •  https://learn.adafruit.com/home-automation-in-the-cloud-with-the-esp8266-and-adafruit-io/hardware-and-software-requirements
    • What is the software that is needed?
    • Arduino Software (sketch)
    • Libraries and dependencies
    • Programming to interact with hardware (device)
               References:
    • http://playground.arduino.cc/Main/DHT11Lib
    • https://github.com/adafruit/DHT-sensor-library 
    • How do you wire it together?
              References:
    • https://learn.adafruit.com/adafruit-cc3000-wifi-and-xively/connections
    • http://www.hobbyist.co.nz/?q=documentations/wiring-up-dht11-temp-humidity-sensor-to-your-arduino 
    • What is the logical first test?

    • a. LED
                            Test1:
                         
                         

                            Code:

                           void setup() {
                                 pinMode(13, OUTPUT);
                           }

                           void loop() {
                                digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
                                delay(1000);              // wait for a second
                                digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
                                delay(1000);              // wait for a second
                           }

                           Test2:


                            
                           Code:

                           void setup() {
                                 pinMode(16, OUTPUT);
                           }

                           void loop() {
                                digitalWrite(16, HIGH);   // turn the LED on (HIGH is the voltage level)
                                delay(1000);              // wait for a second
                                digitalWrite(16, LOW);    // turn the LED off by making the voltage LOW
                                delay(1000);              // wait for a second
                           }
    • b. humidity, temperature sensor

                          Code:

                           // Include required libraries
                           #include <SPI.h>
                           #include <string.h>
                           #include "DHT.h"

                           // DHT11 sensor pins
                           #define DHTPIN 13
                           #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("");
                            delay(1000);
                            }

                             Results:


                   References:
    • https://www.arduino.cc/en/Tutorial/Blink
    • http://playground.arduino.cc/Main/DHT11Lib 
    • https://learn.adafruit.com/downloads/pdf/dht.pdf
    • https://learn.adafruit.com/cloud-connected-weather-station-with-the-arduino-yun-and-temboo/connections 

    • --- What were the problems that you had to solve?
    •  Basic tests completed without any problems.
    • Arduino programming is easy to understand and implement. 
    • Built-in libraries are very helpful with examples. 
    • --- How far did you get.
    • Completed two basic tests on LED
    •  One basic test of DHT11 temperature and humidity sensor.

    No comments:

    Post a Comment