Thank you @a6pack Yes, the Photon & mini breadboard are inside the headrail, plenty of room in there (mine are two inch blinds).
Right now I have it hooked up to a 15000 mAh battery. My previous tests on my desk (i.e. not hooked up to blinds) it would run for 6-7 days with 4 open/close cycles a day (that is not where near long enough, so something is sucking power, maybe photon code isnāt optimized).
This window blind in the video is really just for testing purposes. I will take this whole setup down in ~week if everything works reliably and go install it on 12 foot wide section of windows (3X Blinds) and likely run a hardwire to it behind drywall. When I take it all down/put back up I will take some better photos.
@keithcroshaw I am also experiencing the buzzing from the servo now periodically in the closed position. Can you help me understand where to put the above code? Is it in the photon code? Thanks.
@jotto - if your using Justinās Photon firmware code, using build.particle.io website, modify the firmware and simply add the following after time it says myservo.write(state);
delay(500);
analogWrite(A4,255);
You can increase the value in the delay. 500 worked for me, but you can increase it - Keith had suggested 3000.
@jotto & @a6pack my delays are actually just place holders for how long open or close rotations will take. I donāt have them attached to the blinds so I havenāt tested it.
A few notes from my tinkering with my blinds this weekend:
Using the vertical servo mount and the InstaMorph, I was able to mount the servos in two blind rails. Overall, the mounts were successful. Looking back, I probably wouldnāt use the vertical mounts again. The mounts were too small. They required two washers to be installed at the base to keep the servo at the right height to contact the rod. Additionally, only one of the two holes on the servoās tab were used, again because it was too small. I had to install the servo into the top screw hole rendering it less stable. The InstaMorph solved all that. It filled the space underneath the servo and provided rock-solid stability. I will probably just go with InstaMorph to mount the servos on my remaining window. It is also a fairly clean looking install once it hardens.
I tried to provide the servos with their own 9V DC power source. I was a bit concerned with the ability of the Photon to supply enough current to run two servos at the same time. I used a voltage regulator to set down the voltage from a 9V battery to 5V. It worked greatā¦ initially. Unfortunately, the battery quickly drained. It was clear that I would not be able to provide enough power to the system using a battery as designed and have gone back to drawing power from the Photon. Iāve not done further testing to determine if the circuit is bleeding current somewhere and causing the battery to drain. Iāll add that to my project backlog and revisit at a later date.
The code modifications as discussed earlier (adding analogWrite(pin,255) has indeed quieted the hum and is working great. I wonder, however, if use of the above command is somehow tied to #2 above. Iāll take a look at the circuit today with a multimeter to verify if, in fact, I am actually cutting power to the servo when it is not opening/closing.
Speaking of power, it is clear that the Photon must be connected to power via USB. The WiFi is always on and seems to be a power hog. Others have tried, and failed, to provide lasting power to the board via battery.
I discovered that no two blinds are alike when it comes to their tilting mechanics. My plan was to control two blinds with one Photon. When both servos were connected to the Photon, the tilt angles of the blinds were not the same. I attempted to manually adjust the coupler that connects the rod to the servo to better align the binds, but it didnāt work. It seems that the strings on my cheaply made, faux-wood binds donāt behave the same. So, I am modifying the firmware to control the servos independently. I have the blinds opening/closing in unison at the moment, but the programming effort is not yet complete. Link to my YouTube video of the blinds opening
I also installed a small switch into the endcap of one of the top rails. That way, I can open and close the blinds in the event that the Internet is down. It works, but because I donāt expect this to be a routinely used method, I chose small, unobtrusive momentary switches that are barely noticeable. Link to my YouTube video of the momentary switch in operation
Iām also adding a photoresistor to my circuit to measure the intensity of light coming through the window. My intent is to close the blinds when the bright summer sun is streaming inside the house in the late afternoon. This is particularly important in my dining area as it is hard to eat at the table while trying to squint into the bright sunlight. When it is overcast, however, the blinds will remain open. I know a photoresistor isnāt the most sensitive way to measure light, but my use case doesnāt require precision and I had a few lying around.
My goodness youāve been busy! This is awesome. Good idea with the moldable adhesive. Do you have any code / parts + wiring for the momentary push button? You guys got me started on my project again. I think Iām giving up on mounting my servo to the exterior of the blind housing and going back to the main shaft like I did the first time. @MrSrBeale How did you fix your groovyx.net.http.HttpResponseException: Forbidden error? I started getting that all of the sudden.
@keithcroshaw - Iāll post the info on the switch later tonight. Been busy today dealing with the aftereffects of a mild snowstorm here in the Wash DC area.
Let me know if anyone wants some 3d prints. I could send some out and see if they work for your frame. Mine work quite nice, but not āallā blinds are the same dimensions (many are though). Just message me and I can mail them to you. All of this activity makes me happy. It really is a nice setup once you have it running. Good work on killing off the buzzing. I had that happen on a few servos and had always just gone in and messed with my mapping.
Thanks, @jjhtpc. I did find one model you put on your github for the 3D printed servo mounts. I am tempted to send it to a printer just to see the fit.
@keithcroshaw. My wiring is below. It is pretty straight forward. Iām not sure if I need to tie both Grounds together (there is a Ground pin on each side of the board), but it works.
The code is from @jjhtpc with the addition of code from @hawesg for the switch. Just know that the code I have here doesnāt reflect that Iām driving two servos using separate PWM pins (A4 &A5) as indicated in the above schematic. Iāll publish that as soon as it is fully tested. Here it is he simple code with the If/Else function to enable the switch functionality:
Great work @a6pack . Love the idea of the small switch for āmanualā control w/out the need for internet/phone (I had to take out my blind cord tilt mechanism as it caused too much resistance).
Thanks for the quick response. I really got crackinā tonight, I think this pair of windows is pretty much done. Iāve also got it controlling a bunch of 433 mhz switches all out of one Particle Photon. Had some physical hurdles but nothing some electrical tape and a drill couldnāt handle.
Great work! I like the addition of the 433 mhz switches. As I am now focused on bringing powering the Photon, Iām assuming you are simply plugging the USB into a nearby outlet? Fortunately for me, most of my windows have outlets nearby. I cover the wire with a wire mold cover. Iād like to make the wiring completely disappear, but donāt know what to do about the 5v transformer that the USB must plug into.
Some of the windows in my house have a channel of blank space between the wood trim and the wall that I was able to snake a USB cable through. These windows do not, I drilled a hole in the back corner of the valence where the valence holder had a hole. I purposly bought really long white USB cables plus the curtains hide it well. Iām satisfied. Next step is to add the momentary toggle and maybe a temperature sensor and light sensor. to one of the two I will be installing in this room.
Should also mention I tried solar a while ago and that couldnāt even keep just the board itself afloat for more than 3 days.
I thought Iād share my latest progress on my blind project.
I removed my Photon and the mess of jumper cables from the mini breadboard and soldered everything to a small PCB circuit board. I used one from Radio Shack. Seems to work ok, but my soldering technique is very, very rusty. I had to re-do several of my solder joints.
I included a new option ā a photoresistor to measure the intensity of the sunlight hitting the window. My goal is to have the windows automatically close when the light gets above a threshold. Right now, the circuit works fine. The Photon sees the voltage difference between the two pins of the photoresistor and stores it in a variable which I can see via the Note.js command prompt or the https://api.particle.io/va/devices/deviceID/value?access_tolken=myaccesstolken. My only problem, however, is that I donāt know how to get the variable back into SmartThings so I can then trigger other actions. Iāve found a few bits and pieces of information on how to pull the variable out of the cloud and have it available for use in SmartThings, but Iām not that strong of a coder yet to figure out how to make it work. I hope soon that missing piece will be found (like a clean Device Handler example of a Photon controlling another type of sensor, like a thermometer. To get around this for now, I connected my Photon to SmartThings via IFFT. Now, when the light goes above some value (I arbitrarily set it to 3000 right now to test), I have it turning on a light in my living room.
In the meantime, I purchased more Photons, servoās, cables and electronic parts and connectors to begin to install the system on the other blinds in my home. It isnāt imperative to have it done now, but I hope to have them all installed before the heat of the summer kicks in.
A few lessons learned:
ā¢ About variables on the Photo - They can only be 12 characters long. I spend quite a bit of time wondering why my photoresister wasnāt registering any data. It was, it was just that variable name I chose was too long and it the value wasnāt stored (analogLightValue vs. LightValue).
ā¢ On Soldering ā check that youāve put the part in the right location before soldering. I was convinced that my pull-down resister for my momentary switch was connect to 5v. Turned out not to be the case. Turns out GND is not 5Vā¦ who knew?!
ā¢ On Soldering 2 ā I purchased a Photon without headers. Man, what a mistake that was for me. It was way too time consuming for someone with my limited skill set to have to deal with soldering headers as well. My second attempt was with a Photon with headers and it was a bit easier for me to solder it to the PCB.
ā¢ PCB screw terminal block connectors are quick and easy ways to connect the servos to the board. Assuming I may need to change out a servo, all it requires is to unscrew the cable at the board. I used the same connector type for the photoresistor (after adding a length of cable to the sensor so I could place it toward the middle of the window to best face the sun).
ā¢ I purchased Duplex USB Charger/120V-15A Outlets (Leviton T5632-W) to power the Photons. Now, I just have to run a cable along the window casing (or behind it) and plug it directly into the USB charger in the wall. I wonāt have a transformer sticking out and taking up one of the outlets.
I have installed three photons across 5 windows now and wanted to show the results. Although Iāve mounted all of the servos, I still have some installation work to do of the Photon in my kitchen as well as clean up of the wiring for several of the windows. However, this video should serve as a good demonstration. TODO: I suppose I can work on the delays built into the code so the windows open without as much pause as there is now between them. The delay could also be because Iām using a Routine to open/close the blinds. Havenāt experimented yet with other SmartApps to see if I can run them more or less at the same time. I also think I need to develop a SmartApp to capture the data coming from the photoresister as I think SmartThings is unable to do that in a Device Handler.
Anyway, here is the video: Photon Window Blind Video
Good job! Youāve come a long ways to get here I have two blinds left to install, I hope I can get around to them soon.
Regarding the delays - do you use Rule Machine? Iām not sure if thatāll fix the delay, but it might. Just have the routine as a trigger but not actually do anything at all. And when Rule Machine detects the routine as a trigger, it will open and close all your blinds simultaneously.