Friday, December 12, 2014

Magical Motorized Stagelike Curtains of Awesomeness

This project is one that I've been building incrementally over the past 2 years.  In my apartment, I decided that I wanted my curtains to open like those you would see on a stage - where they pull up from the inner lower corners to the upper outer corners, bunching fabric as it goes, to end up with a nice framing of the window.

To do this, I started with plain, flat curtains on a standard static bar.  I sewed rings into the back of the curtain in line from the inner lower corners to outer upper corners, then ran a control line through them (dead-ending on the inner lower corners), through blocks on the curtain rod supports, then down the side.  To make it all controllable from one side, I have the right side running back across the top, then joining to the control line on the left side, resulting in a single point of control for both sides.  Since I'm using 2mm control lines, I needed pretty small blocks with tight clearances, so I ended up using ones from the Harken 16mm line - utter overkill, but they get the job done.  To make sure that the curtains closed tightly when closed (since there's not much overlap), I sewed magnets into both sides, so that they 'zipper' it shut when the curtains are down, and can easily pop apart when opened.


That's the state that the curtains have been in for about a year and a half.  My next step was to automate them, but I ran into a snag.  If you look back at the Card Swipe Unlocker project I did 7 years ago, I used a low-RPM, high-torque motor - that motor had been missing, blocking my next step.  I looked into other linear actuators and curtain automation systems, but none of them were suitable for my purpose.  When going through a random drawer a couple weeks ago, I happened to re-discover the missing motor - joy!  Once I had that element, I went about designing the circuit to control the raising and lowering (I also recycled the relays and plastic box from that project).  I wanted to use the same control system as my lights so that it could be automated using the same application (which includes scheduled events - ie open them in the morning), which meant that it needed to work via a DMX-controlled relay.  In addition, I decided that including a dedicated DMX control channel for direction (ie one channel for motor on/off, one for direction up/down) was excessive.  After much pondering, I came up with this circuit that does the job beautifully.



There are 2 switches that are triggered by knots in the control line - one indicating that the curtains are all the way open, and one that they are all the way closed.  The switches have to be placed facing in opposite directions in order to be triggered correctly by the line, and become circuit interruptions for the motor power when triggered (so normally forming a closed circuit when at rest).  To make the reed switches activate by the knots in the control line, I added a housing made from InstaMorph (mouldable plastic) around the switches, with a channel for the control line, and a 'hood' to ensure that the knot would hit the switch.





The power supply coming into the circuit is always active.  When the DMX-controlled relay is flipped, it triggers 2 DPDT relays.  One of the relays determines the polarity of the motor circuit's power supply (so changes the direction), and the other relay determines which of the switches affects if the motor circuit is open or closed (we want the 'passive' switch to be removed from the motor relay circuit when switching direction, otherwise the motor would never start, as it is activated when the change happens).  Ergo, when you change the state of the DMX controled relay, it activates the motor in the opposite direction, and changes the switch determining when the motor should cut off.  Add in a DMX-controlled relay (http://www.amazon.com/dp/B00CEOLYZ0), and you've got yourself a DMX-activated curtain control box.



One issue that I ran into with this is, when the curtains are approaching full closure, there's very little (or no) upward pressure on the control line.  Unfortunately, this means that the switch indicating that the curtains are fully closed is never triggered, and they start winding back open the other direction.  To get around that, I added another control line spanning from the junction point of the two primary lines on the left side across to the rod support on the right side.  I then added a small weight on an additional block to that 'tension' line with a small weight on it, and it worked perfectly - that tension line gives just enough pressure as the curtains are closing activate the switch, and pulls up and out of the way when the curtains are opened.  The length of the tension line is such that it is taught along the top when the curtains are fully opened, and drops down when they are closed (the image has it taught across the top when they are closed, which is not entirely accurate, but you get the picture).



And there you have it!  Curtains that open like those on a stage, and are automated using a single DMX channel and one power supply.  I plan to swap out for a stronger motor to make the opening process faster, but this fully proves out the automation process.


Monday, November 24, 2014

Balsa Bridge

The company I work for has periodical 'Tech Challenges'.  These are normally coding tasks - build an AI player for a board game, that sort of thing.  The latest incantation, however is a much more engineering-related challenge - build a balsa bridge (within very specific parameters - http://bridgecontest.phys.iit.edu/public/international/2014/international_rules) to support as much weight as possible.

Since I'm not a trained structural engineer, I thought it prudent to do some testing.  Based on various designs on a truss simulator (http://ivanmarkov.com/truss-simulator.html), I decided upon my overall design.


Since there's no kill like overkill, I also added in a bit of 'secret sauce' - Titebond-3 ultimate wood glue in a precision applicator bottle, hot glue on the bottom of the supports to provide friction, Pitsco Lumberjack cutter for precisely angled cuts, and the basic cardboard covered with parchment paper and straight pins to assist with the gluing process.


While the bridge only ended up holding about 30 pounds, it still put on a decent showing of ~600x it's own mass - and there were quite a few good explosions. For your viewing pleasure, the destruction reel.



Monday, October 13, 2014

Raspberry Pi Conference Room Schedule Display

The company I work for recently moved into a new office, and I've been wanting to make a digital display to put outside the conference room I'm near, so that I know if it's free for ad-hoc meetings, or if I need to find somewhere else to convene.  Since I recently worked on a project that involved querying Exchange WebServices (EWS) to retrieve information, and the room has a shared calendar with the schedule, it seemed like a pretty straightforward project.  It was.

Part 1 - The Hardware
Start with one Raspberry Pi (http://www.amazon.com/RASPBERRY-MODEL-756-8308-Raspberry-Pi/dp/B009SQQF9C), add a 2.8" TFT touchscreen that attaches on top (http://www.adafruit.com/product/1601), and a micro USB Wi-Fi receiver (http://www.amazon.com/gp/product/B003MTTJOY).  Cobble together the two boards into a case printed on a MakerBot (box from http://www.thingiverse.com/thing:233396), configure the operating system to connect to the office network and launch the browser to the schedule in fullscreen, and presto, you've got a dandy device that can display the schedule outside a conference room, with only a power cable going to it.

Part 2 - The Software
Using EWS, write an app to retrieve the events from a shared calendar (in this case, the calendar for the conference room in question).  Push that data into a database, and schedule the app to run every hour (Efficient?  No.  Effective and simple?  Sure is).  Then create a simple PHP web page to query the database for the data and format it into a website designed for the screen resolution of the TFT.  Bam, you just created a conference room schedule board that shows the meetings scheduled for each day.

End result:

Monday, September 29, 2014

Nerf Escalations

For a period of time, our office was in an all-out Nerf war.  Truly, there were battles to be remembered.  To gain true superiority, I decided it was necessary to, not only get a weapon superior to others, but modify it to gain yet more power.

It all started with a Nerf N-Strike Rayven.  For those not well versed in the world of foam darts, the N-Strike series is designed with battles in mind, utilizing aerodynamically streamlined darts.  The Rayven is one of the guns that uses spinning wheels powered by batteries rather than air to propel the darts.  The wheels counterrotate, the dart is pressed between them, and the wheels fling it forward.

The major advantage of the Rayven for my purposes was that, it was designed with a neat little trick of using glow-in-the-dark darts, with little lights in the magazine that charged them with light before they were fired.  Pretty cool trick, if you're into that sort of thing.  What made it even more appealing, was that the lights were powered by a separate bank of batteries.  

With a little ingenuity, screwdrivers, and hot glue, I re-worked the circuitry to be able to include the magazine's battery bank in with the primary bank that powers the motors.  This ran 10.5v through them, rather than the paltry 6v that comes stock (when I wanted the power, that is.  The switch on the trigger guard allowed the overclocking to be activated or disabled).  With the additional voltage running through the motors, I was able to improve the distance it threw darts by 50% - a nice little bump.  A quick-release, reversable connection between the magazine and the body ensured that reloading could be quick and polarity was never a concern.

They never saw it coming.




Thursday, September 25, 2014

DMX Lighting Control Application - And Then Some!

There's been a bit of a dry spell around here, eh?  Shifting from the scholastic world to the professional world comes with it's share of changes, and some projects had to be put on hold for a bit.  Let's get back on that horse!

I've always had a love for stage technologies - pro sound, stage lighting, all that good stuff.  Once I got a real job, I was able to start getting some of my own equipment to use on the side - soundboards, speakers, and stage lights.  The next logical step (well, to me anyway) was to use those stage lights in my apartment instead of normal things like lamps.  They're all RGB LED fixtures (that is, each contains red, green, and blue LEDs in an array) positioned on the floor pointing up at the wall, so they give off a nice indirect, diffused glow.  The lights are all controlled via DMX (standard stage lighting control), so logically, I needed to make an application that would control them using a USB to DMX interface.



I started off with a very modular setup from the outset.  I set up a database that allowed for configured Light Types (each fixture has a specific way it needs to be controlled, as certain number of DMX channels it requires, etc), Lights (the actual devices, with their associated Type), Groups of lights, and Scenes (conglomerations of groups and their lighting state, like bright red).  I made a super-simple Windows Forms application to be able to configure all those settings in a tabular format.  Now that I had information about all the lights and their current state when various things happened, I was able to build a 'universe' of information about what value every DMX channel needed to be configured for in the current setup.  Using a USB > DMX interface with an API that plays nicely with C# (http://www.amazon.com/Velleman-VM116-Usb-Controlled-Interface/dp/B001IRMFUW, using K8062D.dll), I was able to commune with the lights to my heart's content.



Except the heart wanted more.  The nest step was to make the application web-accessable so that I could set the lights from my phone.  Obviously.  So, I updated the application to host a REST endpoint that allowed it to load requested scenes.  I then created a simple PHP web page that connected to the database, retrieved a list of all configured scenes, and then displayed them on the screen as big buttons that, when clicked, triggered a call to the application's service endpoint to enact the change.  Simple, and highly effective - my lights were now mobile-friendly!  And I saw that it was good.



And yet, there was something missing.  Sure, it was nice being able to take out my phone and set the lights, but shouldn't they be able to do that themselves?  I added a new tab to my rapidly growing application for Schedule items.  These had information about what Scene should be triggered, at what time, and on what days.  Once set up, my lights turned on a bright white in the morning when I was supposed to be awake (during the week, that is), green when I should start heading out, red when I really-no-kidding-for-realzies need to leave, then turn off when I sure as heck should be out of the house.  They then turn back on a nice bright white just before I get home in the evening, a soothing blue when I need to start heading to bed, and turn off when I should be falling asleep.  And thus, the lights gained a speck of artificial sentience, and my heart was happy for a time.



But alas, one cannot stem the torrent of need from the heart.  Yet another use case presented itself that seemed to be a wonderful fit for my little application.  One of my good friends was getting married, and he asked if I could provide sound and lights for the reception.  Never one to go into something halfway, I added to grant the application the ability to function as fully automated DJ.  I added a new tab to the interface for Songs.  Each song had an associated lead-in and end buffer (to trim out introductions and fade-outs to keep the party jammin'), as well as it's own scene (yep, I made a scene for each song).  These are mostly empty because I cleaned the lists out for everyday use.



Once started, the application cross-fades through each song in the list (using WMPLib.WindowsMediaPlayer objects), fades the lights from one scene to the next, and in general takes care of itself.  It also allowed for skipping and re-ordering songs (which, for those of you who have never played the role of music selection master, happens.  A.  Lot.)  There were a couple minor glitches like songs repeating, but in general, it worked out quite nicely, and allowed me to enjoy the reception as well.



What's next for Moody?  Who knows - the heart is a fickle organ; you can never quite tell what it's going to pine after next.