Sunday, October 11, 2015

Project: Adjustable Height Motorized Desk

So for a side project at work I have decided to automate raising and lowering my desk with a motor. The company I work for supplies us with desks that can be raised to a standing position or lowered to a sitting position via a crank.

There has been a long running challenge for someone to automate this. Guess who is taking this challenge :)
I should make it clear now that I am not an electrical engineer and have very limited experience with this sort of thing. I am a software developer, I plan on interfacing the device via c#.

What I Want To Accomplish: Build a mechanical motorized apparatus that can be mounted to the desk and interfaced with my PC preferably  USB.  Will need some way to know a maximum height and minimum height so the motor does not break the internal gearing of the desk by hyper extending it. In addition I want to write the software to control the process in C#.

That's the criteria. Next Step will be proof of concept.

9/21/2015 – Ordered the Pololu Simple Motor Controller 18v7! This will be the interface between the computer and the motor.

9/23/2015 – Purchased a cheap 18v cordless drill from Harbor Freight to use the motor and test the concept.  The drill does in fact work in moving the desk both directions when a 10mm bit is on the drill. Now to wait for the motor controller to get here.

9/28/2015 – Got the Pololu Simple Motor Controller board in the mail. Very easy to setup and the company offered sample code to test the board. I hooked it to my Harbor Freight drill and was super stoked to see it work. Proof of concept!

9/30/2015 – Mapped out a design that I will be making work using parts sold from the website I spent lots of hours surfing the web to find a supplier of robotic parts that are reasonably priced. This company is perfect and their tag line is “We Have The Parts For Your Ideas!”. This is exactly what I am looking for! My thought is to use the drill motor for the implementation.

10/1/2015 – I was reading the documentation on the Pololu SMC and learned that the board has 2 analog channels on it that can be used for a forward and reverse limit switch. This is great since I was researching for many hours methods for getting the motor to stop at the max and min heights. Placed an order to Pololu for the analog switches that I will use for the limiters.

10/4/2015 – Got the parts from Servocity in the mail to fabricate the device. Decided that the drill motor did not fit the design. Researching the motors sold at servocity. I think the 81Rpm gear motor will do the trick. It produces 57oz-in of torque. Drilled the mounting holes in the desk using the ServoCity parts as a template.

One of the challenges was figuring out a way to interface with desk. Specifically to transfer the power from the motor to the desk. The solution I came up with is as follows. I purchased a length of 1/4 square steel stock from home depot. This coincidentally is the size of small sockets. It fits perfectly.I can cut it to any length needed. This had to couple to a 1/4in D shaft that is used on the device. So I purchased a 8mm to 1/4in coupler. In order to fit the square shaft into the 8mm side, I had to slightly round the corners. Here are the final drive pictures.

10/6/2015 – Placed an order ServoCity for assorted parts including the 81RPM motor.

10/8/2015 – Got the motor from ServoCity! Mounted it up and tested it. It completely stalled. No movement at all when connected to the desk. I even heard the motor whine. Then it stopped completely. Now it does not work at all, even without a load. I determined that the motor is still operational however the board is giving errors. This is bad!
Spoke to Brandon, a representative at Pololu and explained what had happened with the board. He told me that I more then likely toasted it. He gave me a 15% discount code to purchase a new board. I ordered one with a little more capacity. The part I ordered is: 1 x #1378 Pololu Simple High-Power Motor Controller 24v12. He gave me a great suggestion to get a variable voltage DC supply to avoid burning boards in the future.

10/9/2015 - Ordered a Variable Adjustable 30v5a DC Power Supply from Amazon. This will allow me to test motors and load without burning up the SMC board. I can also see how many amps the decide draws.

10/16/2015 – Got the DC variable voltage power supply to test the new motor. Wired the 81RPM 12v geared motor to the power supply and ran 12 volts through it. Much to my dismay the motor did not turn.  It does not have enough torque. I thought 57 oz-in should turn the crank but it did not budge. I was careful not to burn up the motor by prolonged stall.

10/17/2015 – Back to the drawing board. I am both determined and depressed. Depressed that this project is a seemingly never ending series of hurdles but determined that I will make this happen. I spent about 4 hours researching DC motors and the effect of different voltages. My feeling now is that I need  a planetary gear motor. This is the same setup used in drills and electric cars. Very high torque! There are lots of options on the market and some are very expensive. Due to my inexperience level I want to stay at 12 volts, im thinking a less voltage motor would be less of a fire hazard. Not sure if this is true or not.
10/18/2015 – Fabricated the PC and power supply trays. Drilled the mounting holes in the desk for them. Worked out really well and looks great! Ordered a new motor from as well. I went with a 12v 60RPM planetary gear motor. This puts out a whopping 1874.8 oz-in of torque! My though is that a drill motor has lots of torque and spins at approximately 900RPMs, this motor should more then adequately do the job. I can get a faster motor later or tinker with the sprocket teeth for speed.

10/21/2015 – Got the new motor in the mail today. Had to modify the mount to allow for the larger size. I ran it at 12 volts and it moved the desk absolutely perfect! The amp draw going down was less then 1. Going up it drew about 1.5 amps which is not an issue either. I expect it will draw a little more once there is weight on the desk. I will do more testing but I would call this a great success!

10/23/2015 – Changed the sprocket sizes to see how fast I can get the desk to move. I went with a 42t on the drive and 16t on the driven. It moved the desk just fine without any weight on the desk.  All I can say is it is super fast! It rips. Thought to test it with some weight on the desk. Put about 50 pounds on it and the motor stalled. It would not raise the desk. Changed the drive sprocket to a 32t and kept the 16t on the driven. This raised the desk with the weight on it. Pulled about 5 amps. Also, the speed is very good. I will keep this setup. I noticed that the actobotics channel was tweaking due to the load. I will need to shore it up by adding another mounting bolt position and adding a second motor mount.

10/24/2015 – Worked on the design of the channel and added a On/Off switch for emergency. Also mounted the box where the board will be mounted. Unfortunately I ordered the wrong size standoffs so I will need to order smaller ones. Purchased 1/2in by 1.5in steel bolts for the mounting of the channel to stop it from tweaking. Had to drill the holes bigger to accommodate. This worked to make the channel a tighter mount. Also mounted the LED lights and drilled holes for wire running. Tomorrow I will finish wiring them up.
One other thing, just to bling up the desk a little bit I mounted Harley Davidson mirrors to the desk. They will be good to see if someone is sneaking up behind me to shoot me with a nerf gun!

10/25/2015 – Spent about 4 hours wiring up the LEDs. They look pretty good, not perfect but I didn’t have to buy the lights, I had them laying around from past business ventures. At 12 volts the lights pull about .3 amps. Im thinking I can use the same 12v power supply that im using for the motor to power both devices.


Got alot done today. Completely blew up my shop! Defintely need to straighten it up before I proceed.

10/26/2015 -  Ordered what I think will be the final supplies for this project. Got a 12v 10a power supply on Amazon. I paid about 3 times as much as the others on there but it was important for it to be a UL listed power supply. Also ordered fuse holders and fuses. Now that I am so close im starting to think electrical safety. I probably should have thought about this
way earlier in the project but this is my first project of this kind and its certainly been a learning experience. In total I have about 3 orders coming in, everything should be here by the weekend, hopefully!

10/28/2015 -  Got the new supplies in from the order. I wired up the device and it looks great, very professional if I do say so myself.

10/29/2015 - Decided there were some design flaws with the device wiring so I reworked it and now it is perfect.

10/31/2015 - Completed the LED lights today. Wired up the JST connectors as well. Drilled a new hole in the desk for the power and usb cable to go through alongside the motor device. Test the motor by controlling it from the computer using the new 12v 10a power supply. Everything worked as it should. See the video :)

Wired up the switches to test the forward and reverse limiters. I was having alot of trouble figuring out how to wire them to the Pololu board.  The picture below shows analog input 1 and 2 but I couldnt figure out if the second wire should go to pot+ or pot-. I experiemented and was not getting it exactly correct. I posted a message to Brandon M. at Polulu on the forum asking to get me pointed in the right direction.

By an awesome coincidence my Buddy Tim Cox stopped by, most likely for some Halloween Beer, who happens to be an electronics wizard among other things. He helped me get this configured in no time and even tried to explain the logic to me as I was downing a PBR :)

11/1/2015 - Spent the better part of the day wiring up the limit switches with JST connectors. In addition I fabricated the height adjustment rod and mounted the switches to it. Tested the whole system and much to my surprise it worked almost perfectly! Got a few tweaks to do yet, going to switch the out A and B on the board since the desk goes down when I add + power to it and it goes up when I add - power. This seems backwards to me. Im sure I will have to reset the switches and go through the learn process again. Not a big deal. Aside from that the only thing left will be to write the code. Oh and I need to button up the wires underneath a little bit.

My  Helper Roscoe!

11/20/2015 - Ok Fedex day started yesterday and is continuing now. This is when employees at my company work all night to "deliver" a project. The rubber hit the road with this phase for me. Loading my actual computer on the outriggers. The weight of my monitors with the stands. These were all untested concerns of mine, So how did it work out for me? For the most part excellent. There were a few snags over the evening, let me explain.

I had to pretty much move my shop/tools to the office and of course i forgot some tools. I knew that was going to happen. Had to make do with what I did have.

Started working the software using the Pololu SMC sdk as a base and created my own c# project and went from there. It was pretty much straight forward. Got it working the way i wanted it to. Here is a screenshot.

After our traditional cornhole tournament, which I was the reining 3 time champion, i decided to give the desk a production run. Keep in mind it was near 2am at this point. I failed to tighten the limit switches properly and it got bad. The motor mount broke on my device. I spent about 1 hr re engineering it. Since I didn't have a way to cut the chain with me rigged it using the broken aluminum as a spacer and instead of using 4 mounting bolts I used 2, I will have to order the proper part but this will get me through the reveal today at 3ish.

Breakroom Snacks!

I spent alot of time/money and energy on this project. It was and still is an aweesome experience. I learned abunch of mechanical/electrical and interfacing the 2. I will post some pictures in the next few days, right now I want to get this presentation over and go home and chill. Did I mention I slept for about 2.5 hours in my chair last night? Yea, im exhausted but so glad the company I work for does things like this. What an opportunity to explore other facets of technology that I might not have bothered to do.

Had to engineering the motor mount after the woops.

1 comment: