Tuesday, September 13, 2016

I just wanted to write a quick post about a project I got working with the ESP8266 and the Arduino IDE to read a DS18B20 temperature sensor.  Here's the quick version.  YouTube content coming...

  1. Installed Arduino 1.6.11
  2. Added 8266 Board Manager
  3. Cloned OneWire lib from GitHub
  4. Cloned DallasTemp library
    1. Run oneWireSearch (found device)
    2. Note the PIN.  I mistook GPIO4 for Pin 2
    3. Modify Dallas "Single" example with DeviceAddress

Serial Monitor:

Requesting temperatures...DONE
Temp C: 26.50 Temp F: 79.70
Requesting temperatures...DONE
Temp C: 28.50 Temp F: 83.30
Requesting temperatures...DONE
Temp C: 29.00 Temp F: 84.20

Saturday, August 29, 2015

Hall Effect Sensor Test

I purchased five Hall Effect sensors (3144) and was able to test their operation by connecting an LED to the "output" pin...only the output actually goes low when in the presence of a magnet.  This means you connect the LED cathode to the output.  When I held a fridge magnet close to the sensor, in the proper orientation, the LED illuminated.  Simple test!

Monday, August 17, 2015

Servos and Interrupts

I got my daily fix of eBay parts in the mail so I hooked up my shiny new limit switch to D2 and attached a CHANGE interrupt to it.  The interrupt stopped a servo that was running Sweep.


#include  
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
volatile int state = LOW;
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  attachInterrupt(0, pressed, CHANGE); 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
    while(state == HIGH) {
      delay(15);
    }
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
    while(state == HIGH) {
      delay(15);
    }
  } 
}

void pressed()
{
  state = !state;
}

Saturday, August 8, 2015

Added PiR and MQ-2 to the Arduino

Last night we did some more component testing.  First up, testing the DS18B20 with 20' of Cat-5 cable to see if remote communications would be a problem.  Sensor "Tom" performed flawlessly.  After that I connected up the MQ-2 and watched it stabilize after a couple of minutes of heating.  I do wonder how much current draw it has.  Finally we experimented with a passive IR motion sensor and it was able to spot us moving 20' away!

Wednesday, August 5, 2015

Connecting Arduino Uno to Bluemix via MQTT

After some fits and starts, I was finally able to get my new Ethernet shield connected to the IBM Quickstart by using one of big blue's receipes.  I'm not sure why my Netgear router wouldn't work, but once I switch to my ISP's router, I was able to get on the network.

Sunday, August 2, 2015

MQTT and the Big Blue IoT

I'm grateful to IBM for advertising on Google in the MQTT search results.  If they didn't, it might have taken far longer for me to discover their Bluemix offerings.  Following an IBM tut on getting an Arduino talking MQTT to their service.  So far I've only had time to setup the local Mosquito MQTT broker running.  Tomorrow, I hope to get my new Ethernet shield onto the network and providing temperature readings to the Bluemix service.

Thursday, July 30, 2015

DS18B20 and The Internet of Things (IoT)

Step 1 of 98 was completed tonight.  I successfully communicated with 3 1-wire DS18B20 temperature sensors thanks to a great tutorial on Hacktronics.com.  Also, I think I finally understand the "pull-up resistor" concept, and with the Ohms law I learned earlier this week, I might even be able to calculate the current flowing (V/R = I ) to the 1-wire bus.

I can't wait for the Ethernet shield to get here so I can start working on the next phase of the Arduino project...connecting the house sensors to the Interwebs.