DIY, Electronics

DIY concrete lamp with switch and power outlet

fullsizeoutput_4a33
Today I finished my new project, a concrete lamp with power outlet and switch for the lamp. Usually, you will only find the one or the other. Actually I’ve built a concrete lamp before butwithout the switch and a power outlet.

To build the lamp, i followed the instrocutions of this youtube video. I used 5 pieces to build a 13cm*13cm*13cm cube. I mounted two flush boxes to hold the power outlet and the switch.

If you don’t know what you’re doing, don’t do it! Attention: Concrete might actually be conductive!

Mounting the boxes was actually more difficult than expected because the boxes overlapped by half a centimeter so I had to trim of a bit. I drilled holes for the screws to hold the boxes in place. I also used some quick concrete to seal the gaps so that no concrete could enter the boxes.

After the concrete dried (like 4 days), I carefully drilled the holes to mount the outlet and switch. Make sure your switch is a two-pole switch! Otherwise your lamp socket would eventually still be connected to phase depending on which way you plug in the power cord! Afterwards I applied two coats of concrete sealer.

Finally, I only had to connect the plug to the wire. I used white again to match the overall design which turned out to be a good choice I think. I used white heat shrink tubing as protection of the fabric cord. And finally …tada: done! Feel free to copy and comment!

 

DIY

My version of americas first map

I spent the last year in California working for a tech company. Since then, I got more and more interested in american culture, politics and history. Looking at the current path the politic is taking, I think it is important to see the ups and downs of America thorough history. Knowing for example that California has been a Spanish colony giving california all it’s iconic city names, makes me really upset seeing how Mexicans are treated.

I found this very cool website “David Rumsey Map Collection” and got a little obsessed with it. It is a huge database of old digitalized maps in high resolution, free to download. The database has a great amount of maps showing america. Seeing how how many of the old Californian city names survived “Santa Clara”, “Santa Cruz” and of course “San Mateo” which is where i lived gives me goosebumps! Interestingly, the very first maps of California show it as an island. Probably only the Baja California was known back then and extrapolated into the north (or something like that).

11576026I found that the very very first map to name “America” came from a -who would have guessed- German!  Waldseemüller drew America as a very abstract looking continent (see image below). The real shape still unknown back then. The map was created in 1507! Just a few years after the continent has been discoverd by Columbus. Unfortunately, the map is not available through David Rumsey’s database. However, the library of congress lets you download high resolution here  ! Also, check out this article on the Waldseemüller maps and don’t forget to also read this article on the 1562 map of America!

 

default

I just renovated my room and really wanted to hang some of these old maps. I also downloaded another Waldseemüller maps ( the globus). Of course, none of the maps has the same aspect ratio of my picture frame. Thus, I modified them a little bit in photoshop. The frames that i am using are 33*45cm but the edges are covered so that the visible picture only needs to be 25*37cm. Unfortunately, my printer service only allowed me to only print 30*45. So i extended the borders such that the center  part (25*37 ) contains the important stuff.

I’m not very good with photoshop, but i found that the “content aware” feature is just amazing. I loaded the image and cropped a section with an aspect ratio of roughly 25*37. Then i changed the image size to something close to 25*37 cm. Afterwards I scaled the canvas size to 40*45 exactly. I wanted to fill the white frame around the image. Therefore  I selected the image leaving a a little distance to its borders. Inverted the selection such that only a little bit of its original border and all the white was selected and hit delete. The popup menu lets you select “content aware” and will fill the whole white space with some content of the insight of the selction. The feature will take some of the patterns from the image to fill the space as shown below. I used the stamp tool to retouch the areas that contained actual patterns from the globe.

The second image shows the whole world map including america. I used the third tile of the first row from the world map shown above. There, you can see this dude standing nect to a globus. I used a crop from the image and surrounded it by a copy of the top border. I then again, placed the image in a bigger canvas and filled the surrounding white space using the content aware feature. This time, i actually liked how the border was a random pattern of fragments of the image. Since it will be hidden behind the picture frames border anyway, i decided to leave it as it is. I finally changed the colors with the replace color feature to match the colors of the first image.

 

I’m really excited how the prints will turn out! Hope to give you an update soon!

 

App development

UIViewController offsets scrollview subviews

I was just wondering why my Scrollview Content would always beoffset to what i set it up in Storyboard (Xcode). I use a UIViewController and changed it’s view’s class to UIScrollView.

The layout of my scrollview in Xcode Storyboard
The layout of my scrollview in Xcode Storyboard

The problem was, that all the content which i played out in Xcode was offset by the height of the toolbar during runtime. This did not happen when the view was of class UIView, as by default. I therefore tried to set the subviews frames during runtime but this seems to be restricted by the loaded nibs somehow.

Subviews have a offset in y direction with a height of the toolbar
Subviews have a offset in y direction with a height of the toolbar

for(UIView* subview in self.view.subviews){ [subview setFrame:CGRectOffset(subview.frame, 0, -[self navigationController].toolbar.frame.size.height)];}

I finally found the reason for my problem in the attributes inspector of my ViewController.

Turn "Adjust Scrollview Insets off"
Turn “Adjust Scrollview Insets off”

The Option “Adjust Scroll View Insets” must be disabled for this purpose. It’s probably something which tries to prevent the offset from being hidden by the toolbar. But using the layout in interface builder to manage your subviews obviously interferes with this option. You should therefore turn it off!

offset removed by turning off "Adjust Scrollview Insets"
offset removed by turning off “Adjust Scrollview Insets”

Cheers,

Jan

Electronics

HSV RGB IKEA lamp + IR Remote

My first Awesome IKEA lamp had multiple trimmers and push buttons to setup speed, brightness and color. I now added a remote control to get rid of all these. I chose one of these common rgb remote controls that are shipped with every other cheap rgb lamp. I got it from dx.com. The led i use is a 3W rgb star led from ebay with the following specifications:

Red=2,4V, Green=3,4V, Blue=3,4V, 350mA per channel

Make sure you do not get one with common “+”; if so you can’t use p mosfets but must use the n version instead. Common ground is no problem. You’ll get a complete partlist from the eagle file. The main changes from the original layout are:

  • P_MOSFET: IRLML6402
  • IR-RECEIVER: TSOP 31238
  • IR_REMOTE: CR2025

hsvrgblamp1.0

I uploaded everything including the schematic, board and the code: Download!

The code is neither commented nor nice. Feel free to improve it 😉 There is a little problem with this version; the p-mosfets seem to have great leakage current so the leds wont turn off completely. I think the PORTD has to little output power…

Electronics

Awesome HSV RGB IKEA lamp

When my girlfriend gave me her birthday present, i was overwhelmed. The drawing was perfect, I loved the motive, details and shadows. And it came that she had her own birthday! This was the moment i decided not to buy one of her wishlist’s entrys (yes i keep track) but build something by my own too (let’s just stick to buying things okay?). I thought about painting a picture too but decided against it. I just didn’t want to reveal my inner artist and make her jealous.

Since im a student of it and electronics, i chose to build something wired.  It had to be cool but also instructive for me i though. I always planned on building a “proper” RedGreenBlue LED Lamp which could fade between colors. But i never found the time nor the motivation to do something símilar in my freetime. The first attempts on my Arduino Board were pretty basic. The colors were fading, yes, but randomly which means (in RGB color space) pretty white changes to a white reddish to bright white reddish to a bright white reddish with a touch of green or blue. This wasn’t  that exciting at all. I “went” to the mikrocontroller.net community and asked about color spaces. My idea was to make a distinction between color and brightness and avoid same colors with just different portions of white. I found that the hsv (hue saturation value) color space met my needs. It allowed me to use a simple potentiometer for choosing the color (hue) and a further one for the brightness, while the saturation remains constant (no white parts please ;-))

I started coding (checkout github) the code for an atmega8 controller and tested it on a breadboard first. I found and bought a perfect fitting aluminium globe at IKEA which could hold both the led and the electronic circuit. Then I began with the final board layout in Eagle and ordered the other parts at reichelt: Three Potentiometers (two logarithmic ones), three nmos transistors, resistors, capacitors, push buttons, toggle and finally the power supply (5V2A).

I attached the parts to the new board and tested it with Georg who provided an oscillocope and even a 3D printer. I  designed and printed two plastic parts for the globe to hold the led and the board.

Also I changed the original design from a standing lamp to a laying one. I though it would look nicer and lighten a wall much better. Also the potentiometers and buttons were better accessible (It’s not a bug it’s a feature).

Everything looked fine but a random flashing which disturbed me. One user from the forum gave me hint that there could be something wrong with my code since he had the same problem in the past. So glad this guy read the post -> no flickering anymore!

During the project i learned a lot about the whole progress of implementing a vision. I really started with a vague idea and then made use of a great toolchain (3d printing, uC development, board layout in eagle, testing testing and testing with oscilloscope)… Also i must say that there were a lot of coincidences like a broken diode and a wrongly connected mosfet which i eventually hadn’t noticed in other places… Maybe you (Kenzie) remember that i was happy about the one day on skype? Yeah, i figured the board was actually working … so this was my last week; for you! be happy!

Looking forward to party in fading colors!

Reference:

https://github.com/kreuzUndQwertz/hsv2rgb (code and board layouts as well as the openscad 3d designs)

http://www.mikrocontroller.net/topic/262143#postform (thread on rgb space and flashing issue)

App development

Ratelet a OSX Menulet to control iTunes’ rating and volume

Hey, i finally submitted my first official App to the Apple App Store! Check it out 😉

Ratelet is shown in your statusbar and gives you easy access to the rating of the current song and iTunes volume.

Ratelet will automatically hide itself from the statusbar when iTunes is not running and reveal if iTunes starts. You can hide the volume slider if you only need the rating bar.

Quickly changing iTunes volume can be useful especially when you use Airplay or output sound digital because the Mac’s volume buttons only affect analog output volume!

 

 

 

 

App development

Anchor Point vs. Position (CALayer)

Yesterday i was trying to do some animation which included rotation along the x axis. For this i needed to figure out how to set the anchor point of my layer without moving it in the superlayers coordinate system. But when i setted a different anchor Point the layer moved.
I didn’t know why and some internet resources did not help me at all.

I noticed that both setting the position or the anchor point would move the layer. But setting the one does not affect the other. Some pages on the web explained this bahvior with examples. Now i will give you an example too but no instrutions or advices for how to work with it in concrete cases. This post tries to explain the concept in general.

The anchor point is an attribute of every layer. Its coordinates describe a realtive position in your layer. Every point from 0.0/0.0 to 1.0/1.0 describes a point withing the bounds of the layer. Every negative pair like -1.0/-1.0 is placed once the height to the top and once the width to the left oustide the layers bounds. For instance 0.5/0.5 is the center of a layers bounds. Make sure you understand that this point is independent from the layers or superlayers actual dimension (in pixels or whatever). 0.5/0.5 always is the center independent from if its a layer of size 500×500 or 500×150.

Position on the other hand is expressed in actual layer dimensions but referrs to the superlayer not the layer itself! Position in short says “Position the layer in a way that the anchor point of the layer matches the position in my superlayer”.

Example: You have created a view (50×50) and added it to the center of your superview (150×150) using setCenter…
The anchor point of every layer is always set to 0.5/0.5 at creation time and therefor points to the center of the layer. Now when you added your view and placed it to the center, the position attribute of the layer makes shure that the layer is centered in respect to your anchor point (currently 0.5/0.5).

Since the anchor point is the center of the sublayer, the position attribute must be the center of the super layer so that the layers center is the superlayers center. As stated above, the position attribute now says “the layer is positioned in a way that the relative point 0.5/0.5 (anchor point) is at the super views center by setting the position to 75×75 sublayer.

20120403-154128.jpg

Now imagine you change the anchor point so that not the layers center is centered in the superlayer but the upperleft corner. All you need to do is setting the anchor point to 0.0/0.0 which represents the realtive position for the upper left corner.
20120403-154201.jpg