Automated Window Blinds - Spark Core

No problem. I personally prefer the photon over arduino + SmartThings Shield. Although theoretically the later combination could afford you local control. If that doesn’t make any sense read up on that too.

Local control… With the Smartthings hub version 2? Instead of requiring a connection to the internet it handles it locally on the V2 hub?

…sometimes. And I think the verdict is still out on the ST shield as far as possibility. It’s all a bit messy but would definitely be more difficult with the photon. Something I wouldn’t even think of tackling.

Im trying to get this working with the Photon…
So far I have added the Photon to my Spark/Particle device list.
Flashed the code from Github on the Photon.
Created a device in smarthtings and added the smarttings side of the code.

The Photon is showing up in the smartthings app but everytime try the simulator I get the following error… “error groovyx.net.http.HttpResponseException: Forbidden @ line 91”

This is 88 thru 96…
private put(level) {
//Spark Core API Call
sendEvent(name:“level”,value:level)
sendEvent(name:“switch.setLevel”,value:level)
httpPost(
uri: “https://api.spark.io/v1/devices/${deviceId}/setstate”,
body: [access_token: token, command: level],
) {response -> log.debug (response.data)}
}

What am I missing?
What is a Spark access token?

It’s been a while since my last update, I hadn’t been working on the project too much but now that I had some spare time here is a short update.

I purchased a Futaba S3305 ($35 on amazon) which delivers a torque of 8.9kg-cm vs 4.1 kg-cm of the S3003.
Unfortunately even with more than twice the torque, there are still points where the motor will stall.
I tested it with an external power supply to provide 6v vs 4.8v on the Photon voltage input to make sure the current wasn’t an issue. At points where it cannot turn, I see current draw of up to 1.2 A.

So far I’ve only tried it on one blind which was not that big size-wise.
I’m pretty frustrated now at the lack of torque to turn the blinds and I’m not sure what else could be the problem. All of my other blinds are bigger which will make this project even more difficult to realize.

I’ve posted some photos of my setup. If there are any tips on mechanically what could be snagging the shaft from spinning then please let me know. Do any of you have the similar type of blind? Thanks!


1 Like

You have to enter your unique deviceId and token in order to speak with the device.
It should be in your particle dashboard (dashboard.particle.io), enter that in your smartthings photon device settings (use the smartthings ide web-page).

I found the device ID but where do I put it in smartthings IDE? In the code portion or when I create the device? If in the code portion, Where?

Thanks!

Do you think the pull cord mechanism is causing some drag? Can oyu remove the pull cord and the silver square box just to the right of the servo and go directly on the shaft?

So I found the Device ID and placed it in the preferences section of the Smartthings IDE for the device I created. I also found the access token and placed it in the preferences section of the smartthings IDE for the device I created.

Still nothing is working… I know Im doing someting wrong. does anyone have any ideas on what?

Thanks!

Man, this has been a frustratingly exciting adventure! Shipping delays, computer problems and a lot of unfamiliarity with the particle.io environment caused me quite a bit of angst. I was finally able to flash the code to the device (after editing it for pin A4) and control my two prototype servos. @jjhtpc and @hawesg have collaborated on a terrific Particle App and ST Device Handler. Thank you!

I had another question for this community before I begin tackling the task of mounting the servos to the blinds: "What exactly is meant by Open Threshold, Open and Closed? What are the appropriate values and/or where can I find them? I randomly entered some numbers into the preferences but I honestly don’t know the definition of these parameters nor their relationship to each other and the operation of the servos. Any advice/feedback you may have would be greatly appreciated!

Edit: I wanted to upload a video of my project, but apparently I’m not yet trusted for such an action, so please settle for this static picture! :slightly_smiling:

1 Like

I had a devil of a time with this… The installation instructions as specified at the start of this thread I’m sure are great if you really know what you are doing. Unfortunately, I didn’t. I tried to install the particle CLI and really, really turned myself around sideways. However, once I figured out I needed to download the app for my iPhone (per instructions at docs.particle.io, my confusion quickly disappeared (I thought I had to use command line instructions using the particle CLI). I used to app to connect to the device successfully, tested it by flashing a simple LED lighting program, then went build.particle.io to flash the code to the photon. So, after hours of trying to install the particle CLI, worry about entering command line functions and instructions, the Particle App saved me. You can find it at docs.particle.ioguide/getting-started/start/core. You may already know all of his, but I didn’t. Now, my servos are moving, but I still need to figure out what the Open/Close and Open Threshold parameters mean.

Brian - Im glad you got yours working! That’s awesome! Im still having a hard time on my end… I did download the app on my phone and added the photon successfully. I went to build.particle.io and flashed the code to the photon successfully. I added a device in Smartthings… added a device handler in Smartthings and downloaded the smartthings code mentioned in this thread from Github. I then assigned the device handler to the device I created. Then edited the preferences for the device and copy pasted the device ID and access token from the Particle application. Oh yeah I also edited the photon code and changed all A7 listed to A4. Below is a picture of how I have my Servo wired to the Photon. This isn’t the servo im going to use… Its just for a test.

I feel like i am missing a step… Does all that sound right? My servo wont move…

Thanks!

I finally figured it out! I have servo movement!

I ended up deleting everything and starting over from scratch and it worked!

No im off to a better servo and mounting in my blinds. Ill keep you guys posted.

Thanks!

1 Like

Excellent news, @MrSrBeale ! I feel like we’ve jumped the first of many more hurdles on this project (supplying power to the device in a clean, professional way is another one). If you figure out the definitions for Open/Close and Open Threshold and how to accurately set those values, please let me know!

Yes sir! Now the fun part begins…

I was messing with the code in the Photon PCI…
Servo myservo;
int state;
int open=0;
int closed=85;

I adjusted the 150 value to 85 and the put my servo right at 90 degrees form 0… I imagine that value is going to be a little different per servo motor?

I also adjusted the code in smartthings…
def on() {
put’00’
sendEvent(name: ‘switch’, value: ‘on’)
}
def off() {
put’99’
sendEvent(name: ‘switch’, value: ‘off’)

I changed the def on value from 20 to 00 that allowed the slider on the app go all the way to 0 rather than stop at 20.

Is this what your talking about?

I think so. In the Device Handler, Open, Close and Open Threshold are preferences that can be entered. I just wasn’t sure of the relationship. I think I’ve got it now!

I checked out my blinds tonight… They look the exact same as yours. I couldn’t move the rod by hand while the pull string pulley and gear box were connected to the rod. Once I removed the gearbox and pulley it moved freely.

Give that a try. Let me know if it helps… I’m working on the same step except I still have to find a couplet to mount the servo to the rod

Thanks!

2 Likes

@a6pack Sorry I have been very busy for the past few months I just now saw this, open and closed threshold relate to the point at which the code changes from open to closed when you are using the analog slider

@hawesg - no need to be sorry! Thanks for the reply and helping to shape the code! So far so good on my project and I certainly appreciate your efforts! Right now I’m trying to figure out a way to bring power to my windows (not all have outlets nearby) as well as the best way to add your switching capability (hide the switch or make it more accessible and therefore viable). I can’t wait to install it in a blind later today in its first operational test. Thanks again!

Another thing to think about, I just use a continuous rotation servo, then I don’t have to worry about that nonsense. My only concern then is How long does it take it to travel fully open then closed in milliseconds.