loading

This instructable documents the fun I had building a 'tree house' bed for my daughter.

The bedroom is quite small, so we thought it a good idea to build an additional play area over the bed. The upstairs doubles as an extra bed for sleepovers.

Step 1: Turning a Stock Ikea Bunk Into an L-shaped Bunk

The main part of this project is the bunk bed. I bought a cheap 2nd hand Ikea Mydal bed, its a nice simple frame and the added benefit is that a model of the bed is available on the sketchup 3D warehouse. We wanted to make the lower bed perpendicular to the bunk, so i figured the most practical solution would be to create a fully independent single bed from parts of the bunk. All I needed was some sturdy legs (45x45mm pine) and a few extra lengths of 19x90mm dressed kiln dried pine. I also found i needed slightly longer bolts to attach the bed frame to the legs due to the larder sized legs. I bought some m6 125mm furniture bolts and barrel nuts from ebay to match the existing ikea fixings.

I had to make some other modifications to move the ladder to one of the ends. The attached sketchup file shows the changes i made compared to the original.

Once i finished modifying the frame, I noticed the whole bed was really wobbly. Removing the lower bed significantly reduces the rigidity of an already slender frame. To strengthen the structure, I secured a sheet of 7mm ply to the back of the bed. A single sheet of 1200x2400 does the trick, but doesnt quite reach to the ground. Once painted to match the wall, its nearly invisible.

Step 2: Turning the Bed Into a Tree House

I took ideas from the internet to turn the upper bunk into a tree house. I wanted a rustic look, so i found a source of UNTREATED rough sawn cypress from a timber yard (all the pine was treated and kiln dried was too expensive). It is 12mm thick, but was still a little heavy for the bed (considering it for cladding only), but i couldn't find anything better. reclaimed timber would be great if you could find it. It took a fair bit of planing of the edges and some rough sanding to remove splinters, yet still retain the rustic rough sawn look.

One consideration we made was the possibility of using the top bunk as a spare bed one day. The slats on the side wall are all attached as a single removable panel, which can be unbolted and removed to allow a mattress to go in.

Step 3: Making a Tree for the Tree House.

A treehouse needs a tree right?

I made the fake tree from many layers of polystyrene, coated with a paper clay skin. I cut out each layer using a DIY hot wire cutter (bought some nichrome wire from bunnings and attached to a 12v car battery see http://www.jacobs-online.biz/nichrome/NichromeCalc... for calculations).

My calculations were fairly rough and my wire cutting skills were not great, so i ended up having to fill any large areas with a spray can of expanding foam.

I stuck a broom handle through the whole structure to add strength and bolted it to a piece of plywood base. I just used regular white glue (pva) to stick the layers together.

I found a good recipe for paper clay on this website: http://www.ultimatepapermache.com/paper-mache-clay... I was pleasantly surprised with the versatility of this material, it slapped on really easily, stuck to any angle and was very easy to shape. I simply ran my fingers across the surface to get a fairly realistic bark texture.

As an aside, the paper clay was very attractive to rats (must have been the flour in the mix), the varmints took big chunks out of my tree as it was drying overnight - but to my glee, the plaster in the mixture ended up killing the rats!!!

The final surface is very tough. I was originally thinking about adding a layer of resin on top to further strengthen, however i think its strong enough as it is. Time will tell how durable it is!

To paint, I got 1l of brown latex paint mixed at the hardware store. I painted the whole tree in this base colour, then made several extra shades by adding small amounts of darker and lighter brown acrylics. I painted the depressions in the 'bark' dark colours, then brushed lighter shades over the surface using the side of the brush. The end result wasnt too bad, though i wasnt aiming for realism!

I chose simplicity for the leaves and cut out big 'canopy; shapes from large sheets of polystyrene. I cut a mix of shapes from 20, 30 and 40mm thick sheets and painted each layer in a different shade of green. I screwed each layer directly to the ceiling (i figured this would be easier to patch than glue when we decide to take it all down). I then glued another layer over to hide the screw holes. I made collars to go round some of the tree branches as some of them i cut too short.

Step 4: Modified Ceiling Fan

We realised that the existing ceiling fan was going to cause a problem with the bunk bed due to small size of our room. The enclosed roof and walls of the tree house will keep little heads away from the fan, but there was not enough clearance between the fan blades and the roof of the tree house.

In keeping with the tree theme, I replaced the fan blades with custom cut pieces of 3mm mdf, painted with acrylic. I made the blades short enough to avoid the roof of the tree house and made the blades wider to compensate for the reduced length. The fan is quite a bit louder now, even on its lowest setting, so i might consider tinkering with the electrics to slow it down a bit more.

Seeing as the whole think was apart, I painted the fan body green using enamel spray.

Step 5: The Electonics

I couldn't resist adding a bit of tech to the bed, so I installed some strips of RGB led's and a twinking star field/glow-worms on the underneath of the bunk.

The led strips were easy. I opted for a fixed controller off ebay, as shown in the pic, as i knew a remote control would go missing after a few days. I put one strip in the top bunk and another underneath for reading.

The star ceiling took a bit of effort... I adapted this code (http://playground.arduino.cc/Main/AnalogAndDigital...) to use the 6 pwm outputs of an arduino mini. My code is below (feel free to let me know if you have any suggestions, I'm still learning arduino).

I added a power switch and a potentiometer to adjust the LED brightness in a little control box under the bunk. I wired together clusters of 6 LEDs to each PWM output of the arduino and added a 1k ohm resistor to each led to keep the current down (they didnt need to be all that bright) and ensure all the leds would not overload the arduino. I hid all the messy wiring by stretching a sheet of black polyester across the underside of the bunk and securing it in place with thin pieces of pine molding. The LEDs shine nicely through the fabric, you can kind of see it in the attached pics.

#define MAX_FIREFLIES_ON 6
int PotPin = A0; //**analogue connected to pot int fade = 0;

//Change these values to determine how long the LED stays OFF and how long it stays ON for the Analog fireflies. //These values are in milliseconds times 10 (i.e. 27 = 270 milliseconds). #define ANALOG_MIN_OFF 41 #define ANALOG_MAX_OFF 300 #define ANALOG_MIN_ON 50 #define ANALOG_MAX_ON 200

//Change these values to determine how long the LED stays OFF and how long it stays ON for the Digital fireflies. //These values are in milliseconds. #define DIGITAL_MIN_OFF 4410 #define DIGITAL_MAX_OFF 30000 #define DIGITAL_MIN_ON 210 #define DIGITAL_MAX_ON 2100

//The number of levels of fade before the LED is off with a digital PWM. //Best to not change these #define DIGITAL_FADE_INTERVAL 20 #define DIGITAL_FADE_WAIT 20

//Used to indicate the 4 states we can be in. typedef enum {FADEUP, ON, FADEDOWN, OFF} FireflyState;

typedef struct FireFlyStruct { byte pin; //PWM output pins are 3,5,6,9,10,and 11 FireflyState state; //used to determine what state the LED is in, fading up/down or on/off unsigned long value; //used as LED's current value

//Analog Values int duration; //specifies how long the led will be on/off

//Digital Values unsigned long time; //Used for time calculations to see if it's time to change state boolean toggle; //Used for toggling the LED on/off with PWM unsigned long fade; //used to calculate how long the led will be on/off for PWM during a fade up/down unsigned long fadeWait; //used to increase the time it takes to fade so it lasts just a little longer. } Firefly;

//UNO R3 - 14 pins int analogPins[] = { 3, 5, 6, 9, 10, 11 }; int allPins[] = { 3, 5, 6, 9, 10, 11 };

Firefly fireflies[sizeof(allPins)/sizeof(*allPins)];

//Used to determine if the current pin is an Analog or a Digital Pin. boolean isAnalog(int pin) { int length = sizeof(analogPins)/sizeof(*analogPins); for (int i=0; i

//At the end of this function, all of the fireflies will be setup //with the data they need in order to work properly. //We also turn on MAX_FIREFLIES_ON fireflies to start us off. void initialize() { for (int i=0; i < (sizeof(fireflies)/sizeof(Firefly)); i++) { //Why am I using this pointer notation of taking the address of the object //and then dereferencing it? It was to show someone how to do it. //If it bothers you, replace every occurrence of "ff->" with "fireflies[i]." and //it will run the same. Firefly *ff = &fireflies[i]; ff->pin = allPins[i]; if (i < MAX_FIREFLIES_ON) ff->state = ON; else ff->state = OFF; ff->value = 0;

//Analog Values ff->duration = 0;

//Digital Values ff->time = 0; ff->toggle = true; ff->fade = 0; ff->fadeWait = 0;

if (i < MAX_FIREFLIES_ON) { if (isAnalog(ff->pin) == true) ff->duration = random(ANALOG_MIN_ON, ANALOG_MAX_ON); else ff->value = millis() + random(DIGITAL_MIN_ON, DIGITAL_MAX_ON); } else { if (isAnalog(ff->pin) == true) ff->duration = random(ANALOG_MIN_OFF, ANALOG_MAX_OFF); else ff->value = ff->time + random(DIGITAL_MIN_OFF, DIGITAL_MAX_OFF); } } }

//Determine how many LED's are currently ON and if that is equal to MAX_FIREFLIES_ON, return true. boolean isMaxFireflies() { boolean retValue = false; int cnt = 0; for (int i=0; i < (sizeof(fireflies)/sizeof(Firefly)); i++) { Firefly *ff = &fireflies[i]; if (ff->state != OFF) cnt++; } if (cnt >= MAX_FIREFLIES_ON) { retValue = true; } return retValue; }

//Used for our delay of 10ms for analog. unsigned long analogDelayTime = 0;

/* ANALOG FIREFLIES NOTE: (there is a 10ms delay on all analog fireflies).

There are 4 states the fireflies can be in. ON = Keeps the LED on until the counter reaches the duration set for on. OFF = Keeps the LED off until the counter reaches the duration set for on. FADEUP = Over the course of 500ms, change the LED's brightness about 51 times FADEDOWN = Over the course of 500ms, change the LED's brightness about 51 times

When the firefly has finished it's FADEUP, it will determine a random duration for how long to keep the LED on. Similarly, FADEDOWN determines a random duration for how long to keep the LED off.

If an LED is ready to be turned on (FADEUP) we check to see if we have reached MAX_FIREFLIES_ON. If we have, then we set that LED back to the OFF state and tell it to wait again without turning on. */ void analogFireflies() {

//Put a 10ms delay on all of the analog stuff. if (millis()-analogDelayTime < 50) return; analogDelayTime = millis();

//Iterate through all of the analog fireflies for (int i=0; i < (sizeof(fireflies)/sizeof(Firefly)); i++) { Firefly *ff = &fireflies[i];

if (isAnalog(ff->pin) == false) continue;

if (ff->state == ON) { // Pin On analogWrite (ff->pin, fade);

ff->value +=1; if (ff->value == ff->duration) { ff->state=FADEDOWN; ff->value = fade; } } else if (ff->state == OFF) { // Pin Off analogWrite (ff->pin, 0);

ff->value +=1; if (ff->value == ff->duration) { if (isMaxFireflies()) { ff->value = 0; ff->state=OFF; ff->duration = random(ANALOG_MIN_OFF, ANALOG_MAX_OFF); } else { ff->state=FADEUP; ff->value = 0; } } } else if (ff->state == FADEUP){ // Pin Fade Up ff->value +=1; //previously 5 analogWrite (ff->pin, ff->value);

if (ff->value == fade) { ff->value = 0; ff->state=ON; ff->duration = random(ANALOG_MIN_ON, ANALOG_MAX_ON); } } else if (ff->state == FADEDOWN) { // Pin Fade Down ff->value -=1; //previously 5 analogWrite (ff->pin, ff->value);

if (ff->value == 0) { ff->value = 0; ff->state=OFF; ff->duration = random(ANALOG_MIN_OFF, ANALOG_MAX_OFF); } } } }

//----------------------------------------------------------------------------------------------------

void turnLedOn(int pin) {

if (isAnalog(pin) == true) analogWrite (pin, 255); } void turnLedOff(int pin) {

if (isAnalog(pin) == true) analogWrite (pin, 0); }

//Iterates through all of the pins (digital and analog) and turns them on (up to MAX_FIREFLIES_ON). //Allows us a chance to make sure all of the LED's are connected and working before the program starts //and when we hit reset on the arduino. void caterpillar() { int allcount = (sizeof(allPins)/sizeof(*allPins));

for (int i=allcount-1; i>=0; i--) { if (i < allcount-MAX_FIREFLIES_ON) turnLedOff(allPins[MAX_FIREFLIES_ON+i]); turnLedOn(allPins[i]); delay(250); }

for (int i=MAX_FIREFLIES_ON-1; i >=0; i--) { turnLedOff(allPins[i]); delay(250); } }

void setup() { //Set all of the digital pins to OUTPUT pinMode(PotPin, INPUT); Serial.begin(9600); // for (int i=0; i < (sizeof(allPins)/sizeof(*allPins)); i++) { // if (isAnalog(i) == false) // pinMode(i, OUTPUT); // }

caterpillar(); initialize(); }

void loop() { fade = map(analogRead(PotPin), 0, 1023, 1, 255 ); // fade = 255; Serial.println(fade); analogFireflies(); }

What a fantastic bunk bed. There is nothing better than a tree house, except maybe one in your room. Great project

About This Instructable

2,224views

71favorites

License:

More by tommo_79:LED Interactive Copper Etching  Tree House Bunk Bed Arduino Freezer Alarm 
Add instructable to: