Duct-tape wallet with picture window and snap fastener

What do you give an 11 year old who “has everything”, and has interest in duct tape? And maybe even quoted someone by saying “if you can’t fix it with duct tape, it ain’t worth buying.”

Duct tape wallet

Duct tape wallet

The idea is clear: Duct tape wallet – it’s cool, most likely his friends doesn’t have one. It’s homemade, and therefor unique. Also, it’s a useful “toy.” That said, I wouldn’t spend too much time on it, as it may only bee cool for X months.. ;)

Got the tools ready! Also note the vinyl flooring, which made a good “work bench” for this task..

wallet-tools

Searching the net for a simple How to for a simple wallet, I found this: wikihow.com/Make-a-Duct-Tape-Wallet. The wallet is very simple, maybe even too simple: room for bills, two cards and a picture. But since the kids in Norway may start using debit cards at the age of eight (8), I didn’t give it a second thought.

Screenshot wikiHow

Screenshot wikiHow

Had an old wallet which I used one of the picture frames. A square piece of see through plastic.

Old wallet with picture plastic ripped out

Old wallet for parts

While putting it all together, measuring and cutting the duct tape I couldn’t help to think what an extra touch it would be to have a snap fastener. Just like my old, black wallet has.

Velco would probably be the easiest to use, but I had none. I looked at the old wallet again. Those snap buttons, you can’t just rip them off and reuse them without the right tools. Besides.. A duct tape wallet needs a different look..

9v-holders-or-snap-fastener

Cable connection for 9V battery

Taking the cable connection for 9v batteries, cutting it in half – there’s a snap connection!

Wallet snap fastener made of 9v battery connector

Wallet snap fastener made of 9v battery connector

Closed wallet

Closed wallet

Closed wallet. Backside.

Closed wallet. Backside.

Duct tape wallet present ready. :)

Duct tape wallet

Duct tape wallet

 

Making green eyes sensor activated

I moved in with my mom some weeks ago. During the tour of the house, we where in the basement and I noticed this guy up under the ceiling at the end of the hallway. Look at this thing!

wooden mask guy 1

wooden mask guy 1

– “What the hell is that?”
– “Oh.. That guy.. He hung there when we bought the house..”

I joked that I could make his eyes glow.

Well.. While debugging some electronics the other day, and figured I should make reality of that joke.

I had everything needed :

Stuff needed

My soldering iron was in a box far far away.. Luckily old fashion jumpers and tape will take you far ;)

Low tech solution

Low tech solution


The motion sensor module has a working voltage between 5v and 20v, and a level output voltage at 3.3v. I connected the two LED’s in parallel to the output line. I sat the sensor module to react at the longest possible range, and to hold the lights activated for about 4 or 5 seconds.

It worked out great. Where ever you enter the hall way the lights will turn on. I feel the sensor being a bit too big for this project. But it was nice putting it to work.

Wooden mask guy with motion activated green eyes

Wooden mask guy with motion activated green eyes

.

Raspberry Pi visual notification: mIRC and light chain

This is a real walk down memory lane: Scripting with mIRC! 10-15 years ago this would have been as awesome as air. Visual notification on activity in a chat channel. Nowadays there’s not much action on IRC, at least not where I’m hiding out..

The idea came when I got some very belated (5 months..) goods from Hongkong this week. Among other stuff a light chain/christmas lights. Five months ago my plan was to lighten up the dark Norwegian winter.. I had 20 min to spare and figured I should put them to use anyway.

I haven’t been scripting in mIRC for ages, had to dig up some old code from 2005. Back then I did a lot of stuff with mIRC. I even made a working IRC server at one point..

; LightNotify v0.1 for mIRC
; René 28.04.2014
on 1:text:*:#:{
  ; Something is said in any channel
  ; and mIRC window is not active notify me
  if (!$appactive) {
    notifyMe yes
  }
}

; 
alias notifyMe {
  if (($1 == yes)) {
    turnLight on
    .timerIsActive 0 5 isActive
  }
  elseif ($1 == no) { turnLight off }
}
alias isActive {
  if ($appactive) { notifyMe no | timerIsActive off }
}
alias turnLight {
  if (($1 == on) && (%lightison == 0)) { sockopen lightsocketON 192.168.1.50 80 }
  elseif (($1 == off) && (%lightison == 1)) { sockopen lightsocketOFF 192.168.1.50 80 }
}
on 1:sockopen:lightsocketON:{
  if ($sockerr) { echo -st Light notify: (socket: $+ $sockname $+ ): error: sockopen failed (too many requests?) }
  sockwrite -n $sockname GET /locallight.php?turnem=on HTTP/1.1
  sockwrite -n $sockname Host: im-name.net $+ $crlf $+ $crlf
}
on 1:sockopen:lightsocketOFF:{
  if ($sockerr) { echo -st Light notify: (socket: $+ $sockname $+ ): error: sockopen failed (too many requests?) }
  sockwrite -n $sockname GET /locallight.php?turnem=off HTTP/1.1
  sockwrite -n $sockname Host: im-name.net $+ $crlf $+ $crlf
}
on *:sockread:lightsocket*:{
  if ($sockerr > 0) { echo -st Light notify: (socket: $+ $sockname $+ ): error: sockread failed | goto w }
  else {
    var %count
    :nextread
    sockread %lightison 
    ;echo .. %lightison ;debug
    inc %count 1
    if (%count == 9) { goto w }
    goto nextread
  }
  :w
  echo -st Light notify: %lightison 
  sockclose $sockname
}

Basically, when someone talks in a channel, it checks if the mIRC program is in focus. If it isn’t it makes a http-call to a php-script (described here) on the RPi. Then it sends another call, to turns the lights off, when the program regains focus. Added some simple print notifications to the status window (echo -st ..).

It’s pretty much the same concept as the “Neighbor controlled christmas lights“, simple. But it was fun playing around with the mIRC syntax again.

Will I be using this? Well.. probably I will leave it on until the next project comes around.
Next project should be visual notification of the Facebook chat.. :P

The password: Changed it, forgot it – Raspberry Pi

Posted for my later reference.

It happened when I was about to connect the RPi to the interwebs. I changed the user password to something smart, then forgot it. Having not enabled the root user I was locked out.

As it turns out it’s really simple to reset. Just follow a simple step-by-step, like the one I found at rpi.tnet.com.

In short:

  1. Add init=/bin/sh to the end of cmdline.txt, which is to be found on the FAT-partition.
    Make sure the contents in this file stays in one line.
  2. Power up the RPi
  3. A command prompt magically appears
  4. Type the following:
mount -o remount,rw /
passwd pi
(enter a new password)
sync
exec /sbin/init

Remove the added command from cmdline.txt, power up the RPi and log in with the new password.

 

Neighbor controlled Christmas lights – Rasperry Pi

Even before getting the RPi I made some jokes about making it control my Christmas-lights. They are not the heaviest lights around; it is just 30 LED’s in a row running on 4.5v (three AA).

The easiest way to get started with the GPIO would be by connecting an LED. I followed this guide, and just connected the Christmas-lights instead. Pretty simple.

RPi GPIO Connected

The computer is now controlling something physical. How fun! :)
However, why stop there? Would it not be fun if my neighbors could control them too? I have the lights in my window so they are already visible for everyone.

I am of course not the first one with this thought, so there are a lot of tutorials and blogs about how to do this. However, that would ruin the fun!

My solution is the following: A PHP page allowing you to turn on or off by sending a get-parameter, and then returning the current state – are they on or off?

$what = $_GET['turnem'];
if ("on" == $what) {
	//turn on
	exec("gpio write 0 1 > /dev/null &");
}
else if ("off" == $what) {
	//turn off	
	exec("gpio write 0 0 > /dev/null &");
}
// get state
passthru ("gpio read 0", $gpio);

print $gpio;

Visiting https://thepi/?turnem=on would execute the command “gpio write 0 1” and not caring for any results, and then return the state. Visiting the page without any parameters would just return the state.

The command “gpio write” doesn’t return anything, so the “> /dev/null &” isn’t actually needed, but is good for further references. ;) Passthru allows for keeping any binary result from a command. In this case it will fill the variable $gpio with 1 or 0 depending whether the lights are on or off. Please note that this solution does require you to run “gpio mode 0 out” one time manually, which suits my needs.

Just having an empty page viewing a number isn’t very user friendly, but it allows you to make a fancy looking Norwegian page for your neighbors!

Yes, I know! A live web cam would be so much more fun..

Yes, I know! A live web cam would be so much more fun..

Bringebær i kortstokk

Jeg har gått til anskaffelse av en Raspberry Pi! =) Hva er nå det? Jo! Det er en minidatamaskin på størrelse med en kortstokk. Den er så og si like kraftig som den stasjonære PC’n jeg kjøpte meg da jeg var 15 år. 800 MHz, 512 MB RAM. Amazing!

RaspberryPi.

Raspberry Pi Model B. Bilde: Wikipedia.

Den kommer uten innkapsling. Så i påvente av bedre tider at Adafruit skal få inn denne, Adafruit Pi Box type blank, så måtte jeg finne noe annet å putte bringebæret i.

Behold the Raspberry Pi in a deck of cards:

Raspberry Pi i kortstokk

Raspberry Pi i kortstokk: Det praktiske fremfor det estetiske.

Raspberry Pi i kortstokk 2

Raspberry Pi i kortstokk

Tenker det er på sin plass å nevne at jeg ikke har mer forhold til nettbuss enn at de ga meg denne kortstokken en gang..  :P

Kortstokkesken gjør nytten sin. Mindre støv, og ikke minst mindre muligheter for å ta på noe man ikke bør ta på.. Jeg har ikke lagd noen ekstra luftehull. Esken holder en temperatur på ~40 °C, når CPU’en yter 100% og holder ~58-62 °C. Det bør være OK.

Akkurat nå tjener den som multimediasenter. Så får man se hva morsomt man kan prøve ut senere i år! :D