NOTE: This is a currently active project. This page will be recieving updates and alterations as the project progresses over the next few months. Probably check back every few weeks if you are interested. Sorry, I don't use dated blog-style entries as I don't always operate in a neat chronological order that would make any sort of sense on a from-start reading! This page is getting quite long! Once the project is (largely) complete, I will probably break it into separate pages per section. But since I don't load my pages up with tracking, analytics, spinning-doo-dads and such crap, even in this form it should be a pretty light load on your browser and bandwidth!
So I went looking at recliner beds.... Not bad. However having seen the mechanisms involved I am confident I can do better*. For a start, weld up a nice solid stainless steel frame. And put in space for under-bed storage.
The other advantage of building the bed myself is that if I ever need a second one, I can guarantee availability of a perfect match.
* Emphasis here is on better, not cheaper! The costs of this project (not even counting false-starts and re-designs!) are coming in at about twice that of buying a (cheap) adjustable bed from the store. But mine will be considerably more durable and have the exact features I want (eg: integrated standardised storage, supplimentary-equipment attachment points, 48V electrics, microcontroller I can (re)program to suit myself).
People always want to know if I am going to start a business making them. No way! Far too much work - running a business! And I'd have to streamline the design and make all sorts of compromises to get it mass-producible until it isn't really much different to what is already on the market. Also consumer-safety testing is (necessarily) a world of misery and pain in itself. I'll stick to my salaried job and do this stuff for my own interest and skills-develompent.
Bit of a slow-down as we roll into student assessment time, which is my busiest time of the academic session. I have the metal for the bed head cut, but don't expect to have time for any welding for a few weeks.
Meanwhile, I let one of the TAFE students here film my bed and interview me about it for an assignment. The video is here. This was filmed before I had the electronics done, so while he was pretty good at editing around it, you can see I was driving the motors by crossing some wires in my hands at the time!
Above is revision (about) eleven. I have moved from four side-load storage bays to two end-load. The front bay was, on consideration, pointless as it would become inaccessable once a bedside table was in place. The end bay was sacrificed to keep the entire frame as short as the bed tray in fully-retracted state. The remaining two bays were rotated 90° since end-access is easier in my preferred room layout.
I invented my own unit of measurement. I call them hydrogen-units for want of a rolls-better-off-the-toungue alternative. They use a numeric base-8 (octal) multiple/division of the 'hydrogen line' wavelength.
1 h-unit is 21.10611405413cm (211mm being sufficiently accurate for most of my purposes) and is my chosen base unit of length. 1/8 of a h-unit is also close enough to 1 inch for casual use.
I have always found the metre too unwieldy for a lot of day-to-day use and the centimetre too fiddly. The decimetre is far more human-scale friendly, but not in common use. While the non-uniform 3-12-60-8-16-based divisions spread all over the place were not great, the actual scales in the imperial system (feet, inches) seem to be much more human-centric to me. (The metre, I believe, was origionally based of a crude estimate of the polar circumfrence of the Earth, rather than any units of measurement in daily use by actual people).
There are a number of these 'natural' units about based on various things that can be accurately and consistently measured by scientific means. I have played with a few and the Hydrogen-line length seems the most human-scale-friendly one (though a rather useless one for simplifying any actual physics equations - but no worse than the metre in that regard!). Interesting aside: The 'Hydrogen-length' was also used as a human-scale unit of measurement on the Pioneer space probe plaque.
I tend to use a base 8 counting system in my personal life. I like numbers that easily and cleanly convert to binary! Binary itself is far too fiddly for day-to-day use by humans. Base-16 (hexadecimal) is popular for easily representing binary in human-readable form, but is a bit large and unweildy for doing actual calculations with. Nicely, a signed base-8 integer also fits very neatly into 16 and 64 bits which are common data-widths on computers.
Why? If you have to ask, you wouldn't understand anyway. :-P
Just a quick check to make sure my counter-lever struts work as expected. They do.:
I have the advantage of at-work access to some good manufacturing equipment:
Above: Metal-cutting band-saw. Still slow, but semi-automated.
Above: Milling machine. Cutting notches for the short lengths of round tube that make the ends of the lever-arms.
Above: I've been welding mild steel since I was 12 years old, but this is my first time with stainless steel.
The workshop technician set up the voltage, amperage and feed speed for me, then it was not much different.
Long-sleeved shirt to avoid flash burn (welding makes a lot of UV light and you can 'sunburn' in less than a minute if you are close).
The big flexible pipe hanging from top-of-shot is the fume extractor, not a War of the Worlds alien probe taking an interest!
Above: Not very glamorous but a very useful machine.
My mum taught me to sew when I was ten. It is a very handy skill to have. Thanks mum!
The bed's base is a stainless steel frame with 2 bays for holding storage trunks. Here is the parts/cutting diagram:
Here are the parts for the base cut out (except the 40x80mm channel, which I had yet to order in):
I made the centre storage-box guide-rail T-section from 3 pieces of 50x3mm flat. Tack-welded together from beneath:
And welding has begun:
And here is the finished and sand-blasted base section, including the couplings for mounting the lever arms and linear motors to the head-end:
The glide rails were a bit tricky as the metal warped slightly during weld and had to be forced back into place. Note the extra horizontal struts across the 'open' ends of the structure too to keep things better in place. In an ideal world these wouldn't be needed, but this is the world I am stuck with :-/
Also, the rails are 5mm thick metal, which contributes greatly to the weight of the bed. While 3mm would have been ideal, I couldn't find any source of channel at this thickness in 316-grade stainless steel. Because of this, I origionally made the entire frame from 5mm metal, but when I re-did the design to the current Mk3 specification, as well as other changes, I dropped the metal to 3mm wherever possible -- 5mm was just over-engineered to the point of silliness! And the extra thickness didn't stop the heat-warping during welding anyway -- I suspect it actually exacerbated it!
The bed's recline mechanism is a set of stainless steel struts and levers operated by two linear motors. Here is the parts/cutting diagram:
The lever arms could probably also be made from 50x5mm flat bar, but I had plenty of the box section left over from cutting up the parts of the Mk1 bed I had made before deciding on the much better concept Mk2, which was not disimilar to the current Mk3. My wastage levels are surprisingly low (I keep promising the engineering department my significant-sized leftovers for their materials racks, then don't have any! Sorry! -- I do sweep their floors a lot though. My main rule of using someone else's workspace is to leave it cleaner than I found it. Then I am more likely to be allowed back again!)
The linear motors are 48V units with potentiometer positional feedback. I also had the mounting holes rotated 90° by the manufacturer so they can lie 'flat' between the mattress tray and the frame.
Looking forward, cars and solar DC seem to be heading for predominantly 48V systems: 12V just can't provide enough power for all the modern gizmos in today's car (at least not without rediculously fat power cables). Higher voltage means lower current for the same power (meaning better efficiency without heavier, more expensive cabling). In fact, these motors are a good example of that: the 12V versions pull 20Amps, while these 48V ones -- using the same total power -- pull 5Amps.
Also, above 50V you are supposed to have an electrician's licence and although, as a non-commercial, plugged-in device I could (legally) still work at mains voltages (your country's laws may differ!), I don't like working above 50V anyway. (Note: 48V - and even 9V - can still be dangerous if the current is high. Just not as dangerous.) I expect to normalise a lot of my personal equipment (ie: everything except major appliances) to 48VDC going forward. The bed will be one of the power-distribution hubs for this low-voltage stuff. I also found some 48V to 5V USB power converters online recently, to cover the Very-Low-Power range devices. Also Power-over-Ethernet is already standardised on 48VDC, so another source of equipment at this voltage.
Here is the glide frame that moves in and out to adjust the head of the bed:
Below is one of the 68mm bearings I am using as rollers, which fit in the 70mm channel of the guide-rails very nicely.
And here is a close-up of the couplings for the linear motors that move the runner and adjust the foot-elevation:
And the runner is out:
:and the runner is in!
Here are my linear motors attached to the base and glide frame. I am really on the home stretch now!
100mm M12 cup-head bolts held secure with regular nuts and a fat washer, and capped at the ends with Nylock nuts provide pivot connections between the foot lever arms and the glide frame.
WARNING: Having the linear motors solidly attached like this has a (very minor) safety risk if someone is stupid enough to get in between the lever arms/frame/tray while the unit is moving. Commercial beds are built slightly differently these days such that if the tray comes down on an obstruction it will separate from the motor-arm, but I didn't do this as it would have required different motors and some significant -- and somewhat more difficult to implement -- design changes, for something that is highly unlikely in my own life anyway, especially in that -- with the storage trunks in place -- getting under the bed anywhere near the mechanisms won't actually be possible anyway. I wouldn't let unsupervised children (or adults with the mentality of unsupervised children) play with it, though!
Having said all that, it is no more dangerous than a properly parked car (which children -- and adults with the mentality of children -- also shouldn't be playing in/on/around!).
Next step is the mattress platform (which you can see behind the frame above - yes, I did this bit ages ago really, mainly because I could do it all with my own hand-tools on the weekend)...
The bed's mattress platform is made of 19mm form-ply with stainless steel hinges and brackets to attach to the glide rails and linear actuators. Here are the parts:
I was origonally going to make a set of mesh trays from 25mm angle and 3mm woven stainless steel mesh, however: 1) it would have ended up costing over $1200 in metal and a LOT of time (for a part that is pretty-much always covered) and 2) I probably couldn't have made it rigid enough not to flex and warp.
And for the benefit of the hardware store (which, at $1 per cut, has much better cutting equipment than I can access), the cutting diagram from a 2400x1200mm sheet of 19mm black laminex form-ply:
Also, since I travel on foot, I can actually transport pre-cut pieces on a hand trolley. Transporting an uncut piece would require I borrow or rent a suitable vehicle.
The "1st/2nd cut" annotations are to account for the shop's cutting equipment not being able to handle over 1.5m lengths - most of the people there are experienced enough to work it out for themselves, but sometimes they have the trainee on!
Here is the assembled mattress tray:
I slotted the edges of the boards and embedded the hinges (with liquid nails also in the slots, as filler-material) because I could! :-P
Here is the mattress tray bolted to the bed base, lever arms and linear motors:
Woo-hoo, it appears to work as hoped!!!! I was honestly worried about the foot-elevation section, but it folded perfectly when the motor retracted. Note that, when the foot of the tray is flat, the motor is slightly inclined up from it towards the frame-attachment point. If it was strait, the force would be applied in parallel to the board, and likely cause the tray sections to jam and rip the tray-pivot-point out of the wood, rather than causing the tray to buckle upwards with the force applied slightly off parallel. It was the shallowness of this incline (necessary to stay clear of the storage-trunk space) that had me worried. In the Mk2 design, I had the linear motor pushing from the opposite direction towards the join between the 'foot' and 'leg' sections. This guarenteed smooth operation, but required the glide rail part be 40cm longer, with an extra cross-strut right on the end, and the bed base 10cm longer. I very much wanted the more compact Mk3 design for this part of the project, even if the motor is a bit more stressed (these motors are way over-powered for their duties anyway, but they were the smallest available at 48V).
Below is a shot of the lever arms that raise the bed-head. Their length and positioning are vitally important for the wall-hug feature: Too short and the head-panel will edge back and hit the wall as it rises; too long and the bed head will pull away from the wall. I had to remake them once to get it right -- 1-inch longer than estimated. Luckily the first try, they were the same length as the foot lever-arms, so head-arms attempt #1 are put aside in storage as foot arms for bed #2 if I ever need to make it. As always, the plans provided at top are up-to-date with correct measurements.
The lever arms for head and foot are attached to the tray with 25mm M6 cup-head bolts and acorn-nuts, for a nice sharp-edge-free finish. Major bolts are M12 hex-head with Nylock nuts. I am keeping the number of different-sized nuts and bolts to a minimum, so M6 and M12 are all I have used.
And here is it in action:
Note: the extreme-most folded positions for the head and foot are not intended (or likely possible) for lying/sitting on/in, but provide maximum retraction into the smallest footprint (ie: free up a lot of space at the bed-foot, and make reaching the under-bed trunks easier).
At the foot of the bed is a bar to stop the matress slipping down when the bed is folding.
I could also do the same at the head of the bed, but I have bigger plans for the bed-head bar: mainly a more prominant bar with attachment points for lighting, and possibly some computer-interface bits.
Having assembled the foot (as shown above), found I had a bunch of different pivots and other things attached to the plywood matress tray in a row using 16 bolts. I have now made an integrated part instead, which only requires 4 bolts for the lot!
Also, straps over the matress to keep it folding with the underlying platform, instead of 'planking' on top of it!
I milled the above parts from 50mm x 3mm stainless steel flat, of which I have plenty of short offcuts. The strapping is 40mm webbing I have had in my scrap-fabric box for so many decades I don't remember where I got it!
Above is the end strap to keep the matress end on the platform foot. There is another in the middle to keep the middle of the matress on the mid-platform.
The linear motors will be controlled by an Arduino microcontroller and some push buttons on a wired hand pad. It can also have a USB device interface, so that I might one day even voice-control it via my computer!
Above is the motor controller circuit diagram. The micro relays are 5V on the switch side, triggering via the BC547 transistors (an Arduino can't directly drive relay coils, of course). The relays form a H-bridge circuit which allows current to flow either way through the motor, providing forward and reverse directions.
When choosing mechanical switches (including relays) for DC use, it is VERY important to check their DC voltage rating, as distinct from their AC rating! Because AC works by repeatedly reversing (alternating) the current, there is a point in each cycle where the voltage on the switch contacts is zero. This makes it easy for the contacts to separate when the switch is turned off. DC has a continuous current so there is no zero-crossover point where the contacts can release easily. As a result, the AC voltage rating for a switch will be much higher than the DC rating for the same switch. Trying to use a DC voltage over a switch's rating can result in electrical arcing within the switch which can weld the contacts closed -- generally not a good thing.
So the upshoot of that is, DON'T use a switch rated for AC loads with a the same load under DC. If there isn't a spec available, probably assume the DC load is about 1/20th the AC load! -- yes, it makes that much difference! Better yet, buy switches explicitly rated for the DC load you are pushing.
Also, with inductive loads like motors, the switch rating should be at least double both voltage and current of the motor to be safer against inductive transitory currents during switching (the formation/collapse of the motor's magnetic fields during on/off changes can pull/push(!) a lot of extra juice for a fraction of a moment).
I ordered my motors with variable resistor position sensors built in so the Arduino can monitor their position for moving the motors to preset positions (The motors themselves have limit switches so stop them over extending/contracting, so monitoring the position for full-manual control is not required.).
Circuit board is laid out - I am using AutoDesk's Eagle electronic CAD program which is free-of-charge to use for small non-commercial stuff (sadly, the OSS stuff in this field is a bit disapointing, but while Eagle is not OSS, there is at least a closed-source Linux version!). Having said that, the main OSS alternative, KiCad, is not actually bad! Some of my opinion here is probably simply that I am used to Eagle's quirks. I am definitely watching KiCad going forward as it is not too many workflow features away from a satisfactory solution for my needs. It definitely needs some UI love, though, which for EDA software is really saying something!
Above is the finished circuit board layout. It was pretty simple to keep it quite Arduino-model-agnostic for no extra cost to cover a variety of small-form-factor Arduino modules. I personally prefer the Arduino Micro over the Nano -- instead of a fixed-function USB-serial chip, the Micros have a built-in configurable USB-device controller, so can be programmed to pose as other kinds of USB device -- the pinouts are much the same for the Arduino Micro, so I added outlines for both to the board, since keeping it more generic this way was effectively free. You could even use a Bluno Nano if for some reason you wanted to implement it as a Bluetooth Device (so every passing IoT hacker can controll things!!). I discovered this one recently while researching an unrelated project. Adding support for it was just another bit of extra silk-screen art, so why not! I guess I could write a simple app for my phone to control it! Note that a Pro-Micro is NOT pin-compatible!
Top are the 4 Micro-relays that drive the motors. At 120VDC and 10A, these devices are comfortably over the 5 Amps at 48 Volts I will be driving through them, keeping in mind that while the motor is 48V, the magnetic coils can cause transitory spikes over double that. The switching side of the relays is 5V, so easy to interface to the Arduino via cheap BC547 transistors.
Between the pairs of relays there are the Molex Mini-fit connectors which carry both the DC power for the motors and the analog signals to the motors' built in position-sensing potentiometers, which are connected to 5v power, GND and one of the Arduino analog sense pins each. I dis-assembled and re-arranged the pins on the motors' plugs as this made the board layout much simpler than the manufacturer's default (I could have specified this when ordering the motors if I had thought of it in advance).
Just above the Arduino (bottom-left) is a row of holes for an 8-way resistor network on the left to pull-down each controller-button signal line to ground when a button isn't being pressed. Without these, the button inputs would 'float' unpredictably when a button is not being pressed. Resistor networks make the wiring much simpler as I don't have to run ground wires all over the place - just to the common pin of the network!
Above are: (left) a resistor network package; (middle) what is inside; and (right) one hand-made from discrete resistors.
Also, to the right of the resistor network are 4 pins to break out 5v, Ground, and serial Tx and Rx pins. I am not using them but it costs nothing to add them to the board to make it another bit more generic. Also, in the unlikely event I want to add a wireless remote, this is where the reciever module would get connected.
There are 8 control lines plus 5V and GND to a 5x2 pin header to connect to the manual controller panel. I can have 8 buttons directly with this arrangement, or more if I want to multiplex them (I can really only think of six functions at present anyway - head up/down, foot up/down, go flat, go sit-up ... I won't include a full-retract button, as I don't want to accidentally press it! Holding down both the manual-raise buttons at once will achieve the same thing with the safety advantage that it requires the buttons to be held. .... maybe I should require that for the two preset buttons too? I will trial it and see how that goes: freedom to experiment is the advantage of doing the micro-conoroller programming myself!)
Lower-right on the board is a R-78HB5.0-0.5L switched voltage regulator module which drops the 48V rail that drives the motors down to the 5V needed by the Arduino. It can actually handle anywhere from 9V to 72V (!) on the input side, so this entire circuit would work without alteration for controlling pairs of 12V or 24V motors too. It drives up to 500mA which is far more than the Arduino itself will ever need.
Just to the left of the Arduino, above the USB socket, is a pair of pads for a wire link. If the pads are connected, Arduino digital pin 13 is grounded via the resistor network for use as an input. If the pads are left unconnected, digital pin 13 can be used as an output. I will be using this pin as an output to drive the LEDs in the control panel buttons. The pin can do PCM, so I can even control brightness dynamically!
I sent the file off to PCBfast in Melbourne who specialise in small runs (their minimum run it is based on the smallest board their machinery can do, cut-up, so I ordered two of these boards and got two boards for an unrelated project merged in to the job for a nominal extra setup cost). They were very helpful via email in assisting me to get them the information they needed to do the job the way I wanted (this is the first time I have ever had a custom board made up -- I used to etch my own as a kid, but this one is a bit too complicated for that!). Short-run PCBs are not particularly cheap, but I kept the costs minimal with a relatively simple two-layer board -- if you go beyond 2 'layers', prepare to pay!). The board was kept this simple by using an Arduino Micro as if it was a single chip, so all the fine, multi-layer circuit detail is already done (and tested) for me at mass-production cost scales.
And here (above) is the circuit board completed. On the right is a bare board. On the left is a fully populated one. I have tested it at 12 volts so far, with a multimeter instead of motors, and everything seems to work as expected, with the voltage switching from the positive, to zero, to the negative, to zero as the arduino drives each H-bridge for these states (see code sample below).
I ran some quick-nasty test-code on the Arduino to make sure the various parts were working (happily, they are!).
I will test at the full 48V with motors later in the week.
The control pad is to be built into a 100x55x25mm plastic case as shown:
The top two squares are center-off 3-way buttons (like used for electric windows in cars) for manually raising and lowering the head and foot of the bed. The two larger round buttons are for presets (I'm going with 'flat' and 'sitting'). The smaller button I haven't cut into the case yet as I haven't decided a use for it at this stage. I could go with a 'full retraction' button, but am not keen on that idea. The grey shape there is just showing the usable parts of the case interior -- the corners are filled with screw-posts.
I have a 9-core curly cable in my junk box to connect the control to the bed with, so 7 buttons (the center-off ones count as two buttons each) plus supply voltage and LED power wire (for the LEDs in the two larger round buttons). With 9 wires I can use a DB-9 plug on the end to connect to a mate at the head of the bed (probably in the bed-head itself).
Another option would be a wireless remote. Ones made specifically for use with Arduino microcontrollers are readily available. However, I have a personal preference for wired connections -- just have to make sure the curly cord doesn't try to strangle me in my sleep! (Which is why a nice short one is good).
Above is the controller assembled and what is inside: Mostly just wires to the buttons, which are all connected on the other side to the 5V cable. The resistors between 5V and the bottom positive terminals of the round switches limit the current to the LEDs on those terminals and are connected to their own wire which will be connected to Arduino pin 13. Because I am sinking (pulling from 5V) rather than sourcing (pushing to Ground), the analog settings for pin 13 will be backwards (high value for dim, low value for bright). This is simply because to do it the other way would require one of my limited number of wires to be used for the electrical Ground. Other than flipping the values in the code, it really doesn't matter to the Arduino, though.
The little metal tube on the strait bit of the cable is a ferrite bead. It reduces electrical spikes on the wires going back to the Arduino. Not really necessary, but it was already on the wire. The cubic block is just some moulded plastic that was also already on the wire. It stops the ferrite bead slipping too far down, so I left it there.
No, I am not making the mattress. That's just silly!
In the 18 months this project took (I was doing a lot of it in lunch breaks and odd days-off - couldn't do much on weekends as the engineering facility where I access cutting and welding equipment is closed), mattress standards here shifted a bit from 'long-single' being common to 'king-single' being more readily available! Same length but about 14cm wider. Not a big deal as 7cm overlap on the sides is managable. I have updated the plans for a king-single-width mattress tray, though, and will likely re-make the tray to the new width at some time down the line. The current tray, after all the trial-and-error re-alignments and design alterations, has quite a few holes in it too! None of them are visible with the mattress on, but I know they are there! :-)
I went with a Koala open-cell foam mattress which comes in an unbelievably tiny box, as they suck all the air out before packing it (no point shipping air, really!). The fact that it can survive this treatment is a very good indicator that it will handle the folding and unfolding well too (...plus I confirmed with their support people). And the mattress has lots of good reviews and was recomended by a friend. Oh, and the price is very competitive, especially with $100 off and free delivery at the time I purchased.
I have to add, with this being my first experience with a memory-foam matress, I LOVE it! Sometimes I lie on it and just feel like I am floating (and I am not a light person!)
To stop the pillow falling down when the bed-head is raised, I bought a cheap towel and machine-sewed it in a loop the size of the pillow with a 'tail' to hang over the back of the matress!
If you are feeling generous, here is a link to Kogan that will get me a $10 referral credit if you create an account and buy something! (No obligation, just if you end up wanting to anyway - happily surprised that a few people actually did! Wow, thanx!) :-D
And here is a little video of the bed folding up with the matress on it:
Sorry I look so grumpy in that last frame - I was racing the camera self-timer!
... Well, eventually!
One of the aims of this project is to merge the functionality of bedroom, living room and study. As such, the first 'accessory' I will be bolting on to the side of the bed will be a pivot-arm for my computer monitor (which also serves as my entertainment system) along with an attached tray for keyboard, trackball and my other controllers. The arm is intended to rotate so that the monitor is either over the bed, at a reasonable distance in front of me, or swung around 180 degrees flat against the wall beside the bed.
Watch this space.... (I obviously want the bed-project itself completed before I start making the optional extras! Though the bulk of the pivot frame is going to come from off-cuts from the main bed project anyway, so it will happen sooner rather than later, if only to use up the off-cuts and free up their storage space!)
I also made a little card with a QR code to this site to give to anyone I meet who is interested: