Arduino Shield Suggestions?

Chris,

Glad to hear it is working for you. Let me know if you have any questions.

I made some improvements to the main “ST_Anything” library today. You may want to grab the latest code just to be up to date.

Dan

Hey Dan,

I was going to follow up. The Arduino is behaving quirky, like not communicating at all with the ST base. I’m thinking it’s due to it being low on memory. Your package and associate libraries ring in at 79% of the device’s memory. Any ideas about how to slim some of the bits you contributed down?

Christopher

@scordinskyc

Hi Christoper,

Something seems to be amiss… Here is what I get on an Arduino UNO R3 which only has 2K of SRAM (versus the YUN with 2.5K of SRAM) I wonder if the YUN uses more SRAM by default for the libraries it needs to include to communicate between the Linux CPU and the Arduino CPU?

Sketch uses 19,974 bytes (61%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,252 bytes (61%) of dynamic memory, leaving 796 bytes for local variables. Maximum is 2,048 bytes.

Did you download my version of the SmartThings library for the ThingShield from my Github repository? The orginal one from ST was not optimized for memory usage. We reduced it compile-time SRAM usage by ~150 bytes, and eliminated another 255 bytes of SRAM that was temporarily allocated every time a message was sent to the hub. That’s about a 400 byte savings at peak usage times.

I’ll take a look at the code to see if it can be optimized further… FYI - Program space can be basically used to its mazimum. The real issue is the dynamic memory. Please let me know how much you have free at compile time, and how much the sketch reports as Free Ram in the Serial Monitor window when it is running.

Dan

Hey Dan,

This is what I get when I compile it for the Yun:

Sketch uses 22,534 bytes (78%) of program storage space. Maximum is 28,672 bytes.
Global variables use 1,221 bytes (47%) of dynamic memory, leaving 1,339 bytes for local variables. Maximum is 2,560 bytes.

As far as I know, the bridging libraries have to be called specifically, include Bridge.h and such.

Christopher,

When the sketch is running, how much “Free Ram” is reported periodically in the Serial Monitor window of the Arduino IDE?

Your YUN has a ton a SRAM free at compile time, especially compared to my UNO due to the YUN having 2.5K versus 2K for the UNO. I’d really like to know how much is free when the sketch is running. My UNO has ~500 bytes of free RAM while the sketch is running, versus 835 bytes free at compile time.

Sketch uses 19,962 bytes (61%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,213 bytes (59%) of dynamic memory, leaving 835 bytes for local variables. Maximum is 2,048 bytes.

I have made some minor improvements to my PS_TemperatureHumidity sensor code to reduce memory usage at runtime. Also, the author of the DHT library had a minor improvement in his code. I have uploaded these changed files to my GitHub repository.

Grab the following files:

  • dht.h, and dht.cpp and place in your DHT library folder
  • PS_TemperatureHumidity.h and PS_TemperatureHumidity.cpp and place in your ST_Anything_TemperatureHumidity library folder

I was able to squeak another ~38 bytes of SRAM by making these changes.

Hi Andrew, it would be great if you could make one shield compatible with the Wino board (https://www.kickstarter.com/projects/krom/wino-board-the-tiny-10-arduino-with-wifi/description) or make a similar board using M0 or M3 chip compatible with the arduino wiring language and the build in zigbee chip.

I would really like to see a beaglebone black OR Raspberry Pi add-on.

But does it have to be hardware? Both of these platforms will run a number of different operating systems, and both have great support for networking. So really all you need is a network API, right?

What about an RS232 based interface with loadable support modules, so I could do things like plug one into my Roomba’s serial port and execute commands using my smartthings app. I think all you need to do this is a zigbee to RS232 module, and some software. For the developers, an expect-like scripting environment would allow this interface to be adaptable to just about anything with an RS232 serial port. I know a lot of people that would buy that… It might be outside of your home-user consumer market, but a cloud based wireless RS232 interface could be interesting. You could certainly do a lot of weird things with it. And RS232/usb is an easy compatibility layer that you could use to connect to a LOT of different products including just about every thing with a CPU.

So while I like the idea of a shield, that limits you to one small family of target devices. If you use a standards based interface in wide distribution, like usb/rs232, you can connect THAT to ANYTHING almost.

The ThingShield is essentially a Zigbee to Serial communications device already. By connecting it to an Arduino, you can then interface it to anything you’d like, including RS232 devices. Some folks have created a SmartThings to X10 bridge using this setup, which uses an RS232 shield along with the ThingShield.

Can you use this as an alternative for the TAPT Phillips Hue remote ?

I doubt you’d want to use the ThingShield to try and replicate the Phillips Hues Tap Remote. I don’t have a Hue setup, just GE Link and Cree Connected light bulbs, which are paired directly to my SmartThings hub.

You could use an Arduino + ThingShield as a multiple button remote control to send SmartThings commands directly, which would then in turn be handled by a SmartApp. But packaging would be challenging. The Minimote would handle this same method pretty easily, as that is exactly what it is designed to do.

What is your end-goal that you have in mind?

I need a physical button to turn the Hue bulbs in a room on/off… if the Minimote can do the same function, i will use it

thanks for the suggestion

Assuming your Hue bulbs are somehow integrated with SmartThings already, I would think the Minimote would probably suit your needs. (Note: I have neither the Hue bulbs or Minimote, so no first hand experience.)

Check out the discussion about it here:

If you haven’t already, check out this topic:

Anyone know where else I can buy the smart things Arduino shield? I have tried 3 times to buy it here from the store with a “failed to update cart” error.

I would like to mess around with this but it seems you cant purchase one.

I just tried it using IE11 and it was added to my cart with no issues. Perhaps try a different browser? Empty your cache? Use a different computer? Just a guess…

I can add to the cart as well, it’s when you click on the “pay for my order” button it give the “cant update my cart” error.

Cant use IE, dont have a windows computer.

@Timgray please contact support. That is a weird issue but I get it too. I am also following up.

There are a few things i would like to see.

  1. The thingshield officially available in the UK.
  2. The Meshconnect module available on its own (with the smarthings firmware installed) again available over here.
  3. More example code and proper drivers for the Arduino, Pi Beagle Bone Black and .NETMF and Windows IOT Core for the PI
  4. More info on Using Xbee S2B. There are some great examples out there for Propeller and a great tutorial on at least linking an Xbee (which works) to ST.
    I’ve looked at writing a driver for .NETMF which is my preferred device but the Zigbee HA profile is very complex and i’m only a hobbyist coder and don’t really have much time available to spend on it.

I would love to be able to just get the meshconnect module and then integrate it into my own PCB’s. I’ve got a storm lamp made with an Adafruit NeoPixel ring and a custom STM32 .NETMF board ready to have an ST Implant waitng on the bench at the moment. I don’t want to have to de-solder my Thingshield’s module off :smile: Oh and cobble some sort of driver together :worried:

1 Like

from CHRISTOPHER SCORDINSKY’s programming

Parts of a Groovy program

capability “Polling”

standardTile(“refresh”, “device.poll”) {
state “default”, label:‘Refresh’, action:“device.poll()”, icon:“st.secondary.refresh”
}

main (["tempOven", "tempBroiler", "tempFridge", "tempFreezer","tempMoistcrisp", "tempOthercrisp","humidityFridge", "humidityFreezer", "humidityMoistcrisp", "humidityOthercrisp"])
details(["tempOven", "tempBroiler", "tempFridge", "tempFreezer","tempMoistcrisp", "tempOthercrisp","humidityFridge", "humidityFreezer", "humidityMoistcrisp", "humidityOthercrisp"])

def poll() {
zigbee.smartShield(text: “poll”).format()
}

I am trying to understand how the Polling works, from the Smart Phone to the Arduino

I assume the above sections enable polling, and that the Refresh tile, when pushed, would send the word"poll" to
the serial port of the Arduino via Smartthings Cloud, ethernet to the Hub, then wirelessly to the Arduino Smartthings shield,
then to the Arduino’s serial port, receiver buffer.

In the above code, I dont see the word “refresh” in the details line of the tiles
If I add the word “refresh” to ther details() line, a Refresh icon/button appears on the phone
But pressing it does not show a corresponding entry to the Arduino Debug screen


Part of Arduino code

//*****************************************************************************
void messageCallout(String message)
{
// if debug is enabled print out the received message
if (isDebugEnabled)
{
Serial.print(F(“Received message: '”));
Serial.print(message);
Serial.println("’ ");
}

// if message contents equals to 'on' then call on() function
// else if message contents equals to 'off' then call off() function
if (message.equals("on"))
{
    on();
}
else if (message.equals("off"))
{
    off();
}

else if (message.equals("poll"))
{
    reportData();
}  

I would assume the Reciver buffer is read by the
void messageCallout(String message)

and should be printed out to the Arduino Debug screen

What am I missing?

Thanks

Ben