Tuesday, November 18, 2014

Getting the Due to talk to the smartthings shield - Part 1

Smartthings shield requires the use of libraries.
I am following the directions here:
https://support.smartthings.com/hc/en-us/articles/200901320-SmartThings-Arduino-ThingShield

 Let's first download the files. (https://www.dropbox.com/s/8hon320qmuio8fz/Shield%20Library.zip) Copy the files to the "libraries" directory

 Windows: ‘My Documents\Arduino\libraries\SmartThings’ 
 OSX: ‘~/Documents/Arduino/libraries/SmartThings’

If you have the IDE running you might have to kill all the processes.

When you start it back up, the library is selectable from the menu now.


Smartthings has an example code that can do the same thing as the last program in the previous blog post.

In order to use the sample code another library is needed "SoftwareSerial" (http://arduino.cc/en/Reference/softwareSerial)

Here are the files for the actual software:
(https://github.com/arduino/Arduino/tree/master/libraries/SoftwareSerial)

Save all the files in the same location as above in a Software Serial directory.

So you directory should look like:



I had to copy the SoftwareSerial.h into the Smartthings directory.

I also edited line 25 in the Smartthings.h file to read:

"#define BOARD_TYPE BOARD_TYPE_DUE"

I saved the file and uploaded the program to the board. 
I could hear I high pitch sound from near the chip on the smarthing shield.

I selected the Maker icon, then connect now.



When I went to the app, I could not find it when I tried adding it. 
So I pressed the Reset and Switch button on the shield.
Then Reset button on the Arduino board and that was when it found the board.




Once it is connected you will see an Arduino icon like below.



You now can logon to: https://graph.api.smartthings.com/device/list

When you click on Device button we will see it in the list.




On the next post I will talk about the server side programming you have to do to use the shield.






No comments:

Post a Comment