Ledberg hack: From wimpy IKEA Ledberg to cool work light!

From

IKEA Ledberg

to:

Ledberg hack: work light soft mode

Bill of materials

For this project you will need:

Tools:

  • Soldering iron
  • multimeter

Ledberg hack: Introduction

This Ledberg hack started when I was walking around the Ikea and noticed the Ledberg ledstrips. They looked like a perfect hackable product that doesn’t cost much. Hacking mass produced stuff is just great fun.

Looking at this product it seems to me that that big ugly wall wart and on-off switch is way to big and clunky for these ledstrips. I’d like to get rid off those en make these strips wireless so they become usable wherever I need them.

Making

I decided to make a mobile work light out of these strips. Since LED lights do not use much energy (in comparison with traditional lighting), I thought it would be great if I could make these strips run of a single D-Cell battery. These D-Cells have reasonable amount of charge so it should last long enough to be usable.  I measured 160 mA current used by the three strips with my multimeter. An alkaline D-Cell contains in the neighbourhood of 15000 mAh. So a single battery has a enough charge for 15000/160 = 93.75 hours.

However, these strips need 12V to produce usable light. The D-Cell only produces 1.5V! So I need to find a way to boost the voltage from the D-Cell to 12V. Taking inspiration from Ladyada’s minty boost circuit I decided to us a boost converter chip. I settled on Linear’s LT1110-12 chip which they market as a “Micropower DC-DC Converter”. It looks like a simple circuit and has only a few components. Here’s the application diagram:

Boost converter circuit

I ordered the parts from both digikey and mouser. After the parts arrived I tested the circuit on a breadboard and was able to boost the voltage from 1.5V to 12V at once. Great, until I put some load on the 12V. When I added a little load to the Vout path the output voltage dropped to around 5V :(

Being an electronics beginner I first thought that the inductor might be the limiting factor. But talking to more experienced friends I discovered that in order to get 160mA@12V on Vout you need to increase the input current by around the same factor as the Vout/Vin. So going from 1.5V to 12V is a factor of 8. That means that if I need 160mA@12V, that is 1.92 Watt on Vout I will need to put in 160 * 8 = 1280 mA on Vin or it won’t reach the needed output voltage. The D-Cell can’t provide that much current (I could not find an exact number but it seems well below 1 Amp).

To be sure I modeled my circuit in LT-Spice, which is a great tool for this kind of circuit design. Simulating the circuit you can clearly see that putting in 1.5V from 1 D-cell tops out at about 4.2V.

Failing to boost voltage

When I put in 4.5V on Vin I finally get the Voltage and Current that I need for my LED strips.

Successful voltage boost

So now that we know we can’t power these LED strips with anything less that 3 D-Cells we can start building the actual mobile work light. First I created the battery pack. It is crude but effective. Just soldered on the power leads to the first and last battery (TIP: sand the part of the battery you want to solder to get the solder to actually bond to the battery, otherwise it will slide off). I wound transparent tape tightly around it to give it structural strength. It feels quite solid after that.

D-cell battery pack
Attached leads

After that, let’s put the circuit on a piece of perfboard.

2B98E27E-6CDF-4C9B-B4B2-730B157036FA

It’s not the most elegant piece of soldering but it works. I just glued the rocker switch to the perfboard. I used a 2-way rocker to make a work light with two settings: Soft and Bright.

soldering

A tricky part is to solder leads to the actual LED strips themselves. I want to put them in a parallel arrangement so I can’t slide them into each other as they are meant to. The actual solder pads are recessed in the (cheap) plastic housing in a place where you almost can’t get to with the soldering iron. The trick here is to put some solder on the solder pad first, then put your lead against it, and then use the soldering iron to let the solder fuse with the lead and the pad. The result should look like this:

leads-to-ledstrip

Finally putting everything together you get something like this:

assembled worklight

One improvement to this Ledberg hack that I did not get around to is to make all three LED strips light up in the bright mode. In order to do that I need more switches than my simple 2 way rocker switch. So if anyone has a nice design for that I’d love to learn about it.

Worklight Bright mode
  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Lighting, Maker Recipes | Leave a comment

Wireless IP Camera – Part 4: build your own IP camera software

In this post I’ll explain how to build your own IP camera software that makes our IP camera a “smart” camera.

We’ll make camera control software that:

  1. Monitors the signal coming from the PIR sensor
  2. Snaps pictures with the webcams when motion is detected
  3. Stores pictures both locally and on-line
I’m using ANSI C to develop this code. The nice thing about coding in ANSI C on an embedded device is that the executable will be very small. So we won’t take up much space on the precious 8mb of flash. Additionally, since linux was written in C we can make use of a lot of the tools and libraries that are part of linux to do some heavy lifting for us. Things such as having a permanent process/service running (daemon) and controlling it or things such as logging are good examples of things that standard linux functions do well.
The structure of the code is as follows. We have the basic logic of the program in two files motion-detect.h and motion-detect.c. The .h file is mostly used for the declarative side of the program naming variables and functions. The .c file is used hold the program logic.

On the next page I’ll explain the main functions of the program…

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Maker Recipes, Security | Leave a comment

PSU hack: change adapter voltage from 5 to 5.2 Volts

For a hobby project I’m working with a Beagleboard-XM. Suddenly the board starts to have problems booting up. After much trial-and-error the problem persisted even when changing SD-cards and even when changing the entire beagle! It turns out it was a power problem. The beagleboard-XM should operate on 5V and 1A. However even though my adapter was supplying precisely 5V the board would only work when I applied a little more like 5.2V.

It seems that the beagleboard does not precisely work as specified. I’ve read similar stories about the Raspberry Pi and the Pandaboard as well. Most of these problems seem to relate to the inrush current when powering the USB parts of the board. They cause the input voltage drop which triggers an interrupt on the board upon which it will restart. So the hunt is on for an adapter that supplies 5.2V instead of 5!

I could not find an easy accessible adapter so I ended up hacking one I had lying around. Since this could be useful to some of you, I’ll post how to do it here.

Step 1. Find an adapter with multiple voltage settings

I had variable voltage adapters lying around so I opened one up to see if we could modify it.

Step 2. Open up the adapter and find the resistor that belongs to the 5V setting

It turns out that this type of adapter works as a switching power supply for which a number of different input resistors yield the appropriate output voltage. The input resistors are the ones in a row just above the rotary switch in the picture above. The resistor in my adapter was a SMD 3.3K Ohm resistor for 5V. For the 4,5V setting there is a 3.74K resistor and for the 6V setting a 2.65K resistor.

Step 3. Determine the appropriate resistor value to get the desired 5.2V

Judging by the differences in resistance between the settings, this is not a linear progression. At a guess I think 3.15K would yield approximately 5.2V output voltage.

Step 4. Replace the resistor or else attach a parallel resistor for the same effect

I did not have a 3.15K SMD resistor lying around (I don’t think it even exists). So simply replacing the resistor is not an option. Using the equation for parallel resistance (or the handy calculator): Rtotal = (R1 x R2) / (R1 + R2). We can calculate that putting a 68K resistor in parallel (which I did have) yields 3147 Ohm. Close enough to my estimation of 3.15K for my purposes. So I soldered the 68K resistor on top of the existing 3.3K resistor. This is good soldering practice because the resistor is so tiny. In the picture you can see how small the resistor is. It is no bigger that the tip of a ballpoint pen.

In the pictures below you can see the end result. It sits a little crooked on top of the original resistor. But it should work.

 Step 5. Measure the result

Yay, the multimeter satisfyingly shows almost 5.2V, close enough.

Step 6. Reassemble

I reassembled the adapter and tested it with the Beagle. And, voila the beagle boots reliably and works like a charm without having to attach it to a bench power supply.

Done.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Hacking, Hardware, Ingredients, Maker Recipes | Leave a comment

Come to the project kick-off “Sensors and the Internet of Things”!

On june 6th there is an Open-Geo Day event in the Jaarbeurs in Utrecht. Everyone interested in the Internet of Things should check it out. I’ll be presenting some of my work on sensors, data, low-power operation and the Internet of Things.

I’ll be speaking at the kick-off meeting of a new project by Geonovum (Geonovum is the National Spatial Data Infrastructure (NSDI) executive committee in the Netherlands). It aims to bring people together who want to help push this topic further.

You can find more information including the program for the entire event here.

So if you are in the area, you’re welcome to join us at the meeting on “Sensors and the Internet of Things”.

See you in Utrecht!

 

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in News | Leave a comment

Wireless IP Camera – Part 3

What is a camera without eyes? This part we’ll discuss adding the webcams to the security cam.

My goal is to have one webcam for use during daytime, and one webcam for use in low-light conditions. This way I’ll be able to snap pictures from tresspassers both during the day and during the night.

In the first post you can see on the Bill Of Materials that I’ve chosen two Trust camera’s for my security camera. I have to confess that since then, I’ve switched one out for a better unit. The problem was that the camera for day-time use was getting over-exposed and the electronics in the devices could not compensate for that. So now I’m using a Logitech C270 webcam. This device can cope much better with the lighting conditions and has the additional benefit that it supports higher resolution.

The first step to adding camera’s to our setup is to make one unit (the cheap one) fit for use in low-light conditions. Webcams use a CCD chip to capture images. These chips are sensitive to a broad spectrum of light including infra-red (IR). Without filtering the images coming from a CCD chip seem “odd”. That’s because the infra-red exposure is influencing the image. So webcam manufacturers install IR filters in the webcam to filter out this unwanted light.

This image shot with a IR-filter-less webcam shows nicely how much IR energy is radiating from those palm leaves. You can actually see them photosynthesizing.

The IR-filter also makes webcams less useful in low-light conditions. People, like those palmtrees, also radiate IR light. So by removing the IR-filter from a webcam we can make people show up in the dark where they would normally be invisible.

This little bit about webcams and IR-filter is widely known and there are many places on the web that describe how to remove the IR-filter from a webcam, so I’ll refer you to those instructions. Jake Ruppal made a great youtube video about how to do it, for instance. Sures Kumar has a nice written version of similar instructions.

Once you have removed the IR-filter we can simply hook-up the camera’s to the USB-hub we’ve attached to the USB port of the bifferboard. When you boot OpenWRT you’ll see messages saying something about a video4linux (v4l) device. This means the kernel has recognized the camera’s and that they can now be controlled through the video4linux driver (which is built into the kernel). No need to install drivers for these camera’s.

Now, to test if the webcams are working. We’ll need to install an additional program called fswebcam. This program was written to control webcams from the command line. It can do al kinds of fancy things (such as embed the date-time into a webcam snapshot). You can compile it as a package through the make menuconfig command as I’ve discussed before. Once built and installed you can issue a command like

This will tell the webcam connected to /dev/video0 (which the video4linux driver has created for you on your BB) to snap a picture. By default fswebcam will save the resulting image in the directory where you called it. To snap a picture with the second camera you’ll have to replace the /dev/video0 with /dev/video1 depending on how the system has recognized your camera’s. You can check the names in the /dev/ directory on your BB.

Here are some examples from my security cam:

Image shot during night-time with night-time camera
Image during night-time with the day-time camera
Image shot with the new Logitech Cam

Let’s review what we’ve done so far. If all went well you now have a Bifferboard that:

  1. Signals movement via the connected PIR sensor on /sys/class/gpio/gpio7
  2. Connects securely to your WiFi network using WPA security
  3. Can snap pictures from two webcams

We almost have all the ingredients we need in place to make a smart security camera. In this post I’ll add to this mix how to connect a memory stick and mount it, so you actually have the space to store the snapshots.

For the memory stick I’ve used a generic stick. I just plugged it into the USB hub on my BB and looked with the command:

To see if the kernel was able to detect the memory stick. The output of this command will also tell you which device on /dev was added so you can mount the memory stick. Linux will usually call solid-state memory (like usb-sticks and SD cards) /dev/sdX. In my case it was /dev/sda1

I’ve added a little startup script to my BB to auto-mount the memory stick on each boot. The startup script is called /etc/init.d/usb-stick and it contains:

Now we can add the final ingredient to our mix:

4. Storage to keep all our security cam snapshots safe.

The next post in this series looks like it will be a long one. Next time, I’ll describe how to write the code that automates all the tasks of a security cam (detecting motion, snapping pictures, etc.). So we’re finally done with the hardware business and can move on to the software development side of this project.

For those who can’t wait, you can take a look at the code on github.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Security | 4 Comments

IoT-maker is back

Dear reader, this blog was down for the last couple of days. We’re still investigating what happened to the server. We’ve moved to a different provider and everything seems to be running fine again.

Let’s hope we won’t have to be distracted by such things again.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in News | Leave a comment

5 Embedded systems we’re working with right now

It seems that every day there is new embedded computer launched for us to play with. Most recently the Raspberry Pi made quite the splash. You’d almost forget that there is  a lot to choose from already. Here’s a quick overview of the systems we’re playing around with at the moment.

We could give loads more information about io-pins, tooling, programming, etc. etc. We may do that in a later post.

This post is just to show you what we’re working with. I have to say I’m pleased with all these devices each one has it’s strength an it’s weaknesses. So depending on the project I could pick any one of them and be happy using it.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Hardware | Leave a comment

Wireless IP Camera – Part 2

Last time I promised to explain how to setup WiFi on the BB.

I don’t want to run cables through my entire house. Also I want to be able to place the camera anywhere in my house. So the security camera will use WiFi as the main connection to the web.  Running Linux, the BB is already internet ready from a software standpoint. However, the BB does not carry WiFi hardware. So we’ll have to connect a WiFi adapter to it. The standard BB comes with one USB slot, so using a USB hub we can attach as many devices as we need. And we need a lot of devices. We’ll be connecting 2 camera’s, a memory stick and a WiFi adapter.

For the wifi adapter I settled on the Sweex LW053. I chose this unit because 1) it is cheap and 2) it is based on the Ralink RT73 chipset which has proper drivers in Linux. Just hooking up the USB-hub and the USB WiFi adapter does not automatically yield a new ethernet device in OpenWRT Linux, however. We’ll have to jump trough a few hoops.

you’ll need to install the RT73 wireless driver which you can find in the make menu when building OpenWRT with:

What I do is instruct menuconfig to create a package for the driver. You can install the opkg package as I explained in the previous post.

You’ll also need to install wireless-tools. In my case I have protected my local WiFi network using WPA encryption. If you want to have your BB connect to your WiFi using WPA you’ll need WPA_supplicant-miniThis will add WPA capability to your BB.

WPA supplicant is the WPA client that negotiates the authorization on your wifi network. On the BB it is configured in the file /etc/wpa_supplicant.conf. Mine looks like this:

Next step is to make sure that the BB knows when to setup this authorization and for what network interface. For this purpose I’ve created a startup script in /etc/init.d which i call network_wifi_cfg it contains:

The first line is to assign an ip-address to the wifi network interface. The second line calls wpa_supplicant with the settings as described above. The third line sets the wifi network interface as the default gateway so all network traffic is routed through the wifi connection. The fourth line makes sure that the BB knows it is in the correct time zone (GMT+1 for me). And the last line makes sure the BB synchronizes it’s time via the internet (through the ntp protocol). This last step is necessary because the BB does not have a battery powered clock on board. It will forget the time when you switch it off.

After figuring out the proper configuration settings to connect to the network. The next step is to make this connection an automatic step after booting the BB. You can do this by creating a symbolic link to your startup script (such as the network_wifi_cfg script above). You can do this manually or use the enable command in OpenWRT, see here.

In the proces of figuring out this automatic connection to the network I came across a vexing issue. When you remotely (via SSH for instance) reboot the BB. The WiFi device would not come up as a network interface. It turns out that certain steps needed to connect to the network are only executed when booting the BB for the first time or upon disconnecting and reconnecting the USB adapter. I finally figured out that manually unloading and reloading the RT73 driver forces these steps. So I’ve added that to the bootup sequence. I’ve added the following lines to my network_wifi_cfg script:

This will reload the RT73 driver upon each reboot.

Now we have a BB that 1) recognizes it’s WiFi adapter on the USB port, and 2) connects automatically to the WiFi network using a secure WPA connection each time it boots. We can now just plugin the BB anywhere in the house and SSH into it (woohoo!).

Next time we’ll give the security cam it’s eyes. Untill next time…

Update: you can find part three here.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in Security | Leave a comment

Smart Things: a new cool looking open IoT platform on kickstarter

There is a new kickstarter project called Smart Things that we should not fail to mention on this blog. It has all the ingredients that we care about. It is a system that allows you to connect stuff to the web (yay!) and it comes with a cool looking user interface right on your iPhone (another yay!, for user friendliness). And finally, it is an open platform. So you can hack your own stuff together and connect it to the Smart Thinhgs platform (yay!).

We’d love to hear your experiences with this device if you own one. Feel free to comment or leave your story on our forum.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
Posted in News | Leave a comment