Thursday, December 5, 2013

Zamboni Pile and electrostatic pendulum

Here's what the setup looks like at the moment:


That's the pile there at the top of the pic, in a clamp.


The pendulum and plates


Pendulum in action.

I've known about the Oxford Electric Bell for quite a while, but could never figure out how it was made. I just assumed the tech was lost, and folks would only know how it was made once it stopped and they dismantled it. The thing has been running since 1840, is still going, and they might have to replace the clapper, because it's getting out of shape.

Somehow - some random youtubing and googling a couple of weeks ago led me to think that it might be possible to get started making a Zamboni pile, which is the battery used in the whole thing.

Turns out it's cheap and easy to make all this stuff.

Here's the recipe:

Grab some zinc-carbon batteries. In South Africa, "Eveready Gold" brand does the trick. Extract the manganese dioxide (black powder), mix with just enough water to make it into a paint like consistency, and then coat some paper on one side with the stuff.

Let it all dry

Glue aluminium foil to the other side of the sheet, so you've got the dioxide on one side, foil on the other.

Let it all dry

Cut into at least 700 pieces.

Stack them all in the same direction.

Compress the stack a bit.

Play.


Getting this thing to work took... faith. There's no easy way to measure the voltage coming off it - and you need a nice high one for these charge effects to happen. It took me about a week to get all those bits of paper made and cut. Clamping the leads onto a 100v capacitor only gave the weakest little bit of current after charging for a day. At about 700v, you can *just* get some effects.

Next up: better looking, easily transportable pile and a more impressive pendulum setup.

Thanks to these folks for information:

Music could be soothing or weird, depending on your taste



Tuesday, March 12, 2013

GATE-OTRON9000

I'm in the habit of naming anything I build with the suffix "-OTRON9000". Always good for a laugh. More so when such hacks make it into production on client's systems or become useful to all and sundry :)

This quick post is about how to hack a gate remote, graft it onto a Raspberry Pi, and have a web server controlled system up and running in about an hour, so everyone in your company can open and close the gate without running around to find a remote...

No doubt I'll pretty-fy the code listings, some day, but you should get the idea here.

First, THANK YOU Raspberry Pi people for making a great piece of kit. The Raspberry Pi (in case you've been in a cave for about two years) is an ARM based computer on a little board the size of a credit card (http://www.raspberrypi.org/). It's a full blown computer, only nice and cheap. And it's got some pins on it, which allow you to talk to the outside world. Here's the one I used:

My Pi - with power input (blue), Network(grey) and output pins all wired up (red)
This one has the stock standard Raspbian image on it, possibly with a custom build of Emacs 24 on it. I don't remember spending too much time getting Emacs running on it, so it's possible that either Raspbian now comes with Emacs 24, or that the installation process for building from scratch is painless. Anyway - the other tweak is that the IP address is static. I did this by tweaking the /etc/network/interfaces file to look something like this:

iface eth0 inet static
address 192.168.1.9
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
gateway 192.168.100.254


Right now, the Pi plugs directly into a wireless router. Much simpler this way.

Then, getting the pins set up so we can do fun things with them: I found the most basic example Gordon had put together (big THANKS again): https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/

It starts with wiring up an LED to the ground and 3.3V pin on the board, then on to actually using WiringPi to turn a light on and off. A ribbon cable, bit of wire stripping, careful counting of pins, and I had the thing connected exactly the same as in Gordon's example. Using the shell, I could enter commands to turn the LED on and off.

I then made a "press-button.sh" shell script - which looks like this:

#!/bin/bash
gpio mode 0 out
gpio write 0 1
sleep 1s
gpio write 0 0

All it's telling the Pi to do, is : set pin 0 as an output pin (gpio mode 0 out), send voltage through it (gpio write 0 1), wait a bit (sleep 1s) and then stop sending the voltage (gpio write 0 0).

Right. So we have a Rpi that can switch a light on and off. Nice, but hardly reaching out and touching the real world.

Next step: hack a remote. Ideally, I'd have had some sort of switching transistor or relay handy for this, but all I had was a photo resistor. One like this (courtesy bkbelectronics.com)


I then ripped open the gate remote, removed the battery and soldered the photo resistor over the little push button switch. If the remote had worked off 5v or 3.3v, I'd have possibly just hooked the Rpi wires that power the LED to the switch, but with 12v flying around, I wasn't going anywhere near it.

With the photo resistor in place, it was fun watching the remote light go on and off as I covered it with my hand and exposed it to sunlight. Because I was using a resistor, which looks like it went up to about 1K ohm or something when it was dark, I just wired a 12 DC transformer to the terminals that used to hook up to the battery. Without a real switch in there, it's sure to be sucking power. Long term: I expect something to burn out here, but nothing's getting hot or letting off a burned plastic smell just yet.

With an LED on one side, and Photo Resistor on the other, we have a photo-optically isolated interface, so weird spikes in voltage on the remote won't affect the Pi, and vice versa. Here's what the outside looks like:

Black thing is the gate remote, duct tape wrapped thing is the LED pointing at the Photo Resistor.
Sorry I don't have a shot of the insides, but the thing works right now, so I'm not going to mess with it.

So now, we have a way to easily trigger the gate remote from the Rpi, using a shell script. To trigger the gate remote, I'd just run the "press-button.sh" script, and that'd do the trick. But expecting folks to ssh into the Pi and TYPE stuff is a bit much. What I needed was a web page people could bookmark, so they could fire it up by visiting it.

In steps Elnode (http://emacswiki.org/emacs/Elnode). Sure, I could have put PHP in there, running on Apache, and be finished quickly, but this whole thing had only taken me about an hour so far, so I was feeling confident. Elnode is a web server, which runs inside Emacs - a highly extensible text editor. Installing and getting it up and running is easy - if you're an Emacs user. I'm not going to go into the details here, but it's a thoroughly worth it exercise to install Emacs and Elnode! Stretch yourself.

Just to see what happened, I thought I'd give it a bash. So I put a bit of elisp code together:

(require 'elnode)
(defun base-handler (httpcon)
   "Gate opener"
   (elnode-http-start httpcon 200 '("Content-type" . "text/html"))
   (shell-command-to-string "bash /home/pi/wiringPi/click-button.sh")
   (elnode-http-return httpcon "<h1>GATE-OTRON9000 Activated!!!</h1>"))
(elnode-start 'base-handler :port 9000 :host "192.168.1.9")

... Evaluating that (M-x eval-buffer) then gave me a lovely page when I visited the address:
http://192.168.1.9:9000. It just said GATE-OTRON9000 Activated!!! in big bold letters, but more importantly..

The thing worked! First time! straight off the bat. We expect the motor on the gate to be burned out soonish, but no one seems to mind, we're all having too much fun opening and closing the gate with anything with a browser and wi-fi connection.

Here's our model, Sipho, showing the sheer awesomeness of it all...


I'd upload a video. But seriously. It's a gate, opening and closing...

Just to recap - here's what's going on:

The user surfs to the web page, which is served by Elnode, running inside Emacs. The handler for the page fires off a shell script that uses the WiringPi library to turn an LED on and off. The LED is pointed at a photo resistor which is sitting across the switch of an actual gate remote. When the light from the LED hits the photo resistor, the button on the gate remote is "pressed" and the gate moves.

Duct tape, twisted wires, bash scripts and elisp at it's best!

Give it a go. It's very rewarding :)

Thursday, November 17, 2011

HTML5 - for non technical folk


TAKEHOME: HTML5 is coming - prepare for it.

With Adobe abandoning mobile Flash development, it looks like the age of HTML5 is upon us.

This is the non-technical version. For a bit more detail, click here

* What it is
  HTML5 is the next step in the evolution of the web. A host of technical changes that should clear the way for really great work.

* What it isn't
  Mostly, HTML5 isn't ready yet!

  It's still being argued over and agreed upon. It'll be ready anywhere between 2013 and 2022, depending on who you ask. http://en.wikipedia.org/wiki/HTML5

  It also isn't:
  - Animations
  - Faster Javascript
  - Gorgeous CSS (styling)

  Confused? So is everybody else. And when confusion is out there, snake-oil salesmen are always in the wings, ready to take some poor suckers for a ride. So be careful out there.

* The FUD
  HTML5 is set to become the new Flash, AJAX and Web 2.0 combined. Understandably, people are worried that they'll get left behind. That no one will use their sites. That if they don't get "the HTML5", their businesses will crash and burn. Not likely.

* Why it's good
  If it plays out how folks are intending, it's going to simplify the development of really fantastic web apps. Things like video and audio come baked in. Styling is taken care of by enhanced CSS. Machines will be able to understand the structure of pages more easily.

* When to use it
  At every opportunity :) Seriously though: you'd be wise to start getting things ready as soon as possible.

* When not to use it
  Don't try and do serious Flash-style animations. Also: remember that Flash and HTML are fundamentally different technologies, so trying to make one into the other is not a good strategy.

* How to prepare for it
  Start off small. Build content so it'd just as easily work on iPads, iPhones and regular browsers. Slowly, everything will converge, and you'll be ahead of the curve.

* Links
http://blogs.adobe.com/conversations/2011/11/flash-focus.html
http://www.w3.org/TR/html5-diff/
http://mashable.com/2011/11/11/flash-mobile-dead-adobe/
http://en.wikipedia.org/wiki/HTML5
https://developer.mozilla.org/en/HTML/HTML5#Technologies_often_called_part_of_HTML5_that_aren%27t

Wednesday, November 16, 2011

HTML5 - for technical folk

TAKEHOME: HTML5 is coming - know what your options are.

This post is targeted at a more technical audience. Click here for the ideas without all the detail.

Sometimes a technology goes mainstream, and everyone suddenly wants to show that they're at that cutting edge, so they MUST have the new thing. With Adobe basically jumping ship on Flash - HTML5 is that new thing.

Nothing new or groundbreaking here - just my thoughts on it, all in one place, as quickly as possible.

* What it is
  HTML5 is the next step in the evolution of the web. That's all. It's the specification for HTML - how it will look, and how browsers will deal with it. It separates concerns - making styling information the domain of CSS for instance. It defines things that are relevent and likely to be important in future - how to have audio and video, how to deal with email addresses and such in forms, things to make your site behave a bit more like applications (with their own little databases and things like that) and how to "semantically" construct your pages. A host of tweaks and imrovements that, on their own, wouldn't amount to much, but together are going to open the web up for vast improvements over time.

* What it isn't
  Mostly, HTML5 isn't ready yet!

  It's still being argued over and agreed upon. It'll be ready anywhere between 2013 and 2022, depending on who you ask. http://en.wikipedia.org/wiki/HTML5

  It also isn't:
  - Animations
  - Faster Javascript
  - Advanced CSS

  Confused? So is everybody else. Be prepared for lots of requests for "HTML 5" - without clear direction on what people are expecting.

* The FUD
  HTML5 is set to become the new Flash, AJAX and Web 2.0 combined. Understandably, people are worried that they'll get left behind. That no one will use their sites. That if they don't get "the HTML5", their businesses will crash and burn. It is your job to offset their fears.

* Why it's good
  Hopefully, websites will be easier for machines to read - making SEO easier to do and more honest. It'll hopefully do away with the need for third party plugins like Flash. It'll hopefully specify not only what browsers should do, but exactly how they should behave, even when failing - so web design should become more consistent, with less custom styling to get a site working in different browsers. Also - it should create an environment in which browser and website are able to behave in a more app-like manner.

* When to use it
  You can start using it right away. The secret here is to remember that most browsers only support parts of it. Building for complete cross-browser compatability with all the bells and whistles is difficult, if not impossible right now. http://www.webresourcesdepot.com/html5-and-css3-browser-compatibility-chart/ http://www.findmebyip.com/litmus/

* When not to use it
  Freaky animations - the high end stuff you'd do in Flash - rather keep those in flash. That said, you'll want to start avoiding doing that sort of thing - people with tablets and smartphones (iOS) won't be able to see your site anyway.

* How to prepare for it
 
Start getting used to having to take the animations down a notch.

Right now, having the best features of HTML5 available to you on all platforms is pretty much impossible, or possible, but with large amounts of dev work and duplication of functionality over multiple platforms.

  Use good Javascript and CSS to get most things done. Tweening libraries and CSS resetting frameworks will give you a lot of room to play. That said, you should still be aiming for a "progressive enhancement" approach - just to cover all your bases. Fundamentally, you want clean html, with nice, consistent and logical CSS and Javascript. Preparing your content for mobile and tablet devices is part of the battle anyway, so there's a good place to start. Either build an alternate version of your site for such devices or create them from the start to work on them as well as browsers.

  Right now, things are just beginning, so, for a while, it's going to feel like a ridiculous amount of work to get the most basic stuff done. You can expect things to get better shortly - even Adobe is spending a lot of time and effort in making HTML5 easier for everyone.

* Links
http://blogs.adobe.com/conversations/2011/11/flash-focus.html
http://www.w3.org/TR/html5-diff/
http://mashable.com/2011/11/11/flash-mobile-dead-adobe/
http://en.wikipedia.org/wiki/HTML5
https://developer.mozilla.org/en/HTML/HTML5#Technologies_often_called_part_of_HTML5_that_aren%27t


Tuesday, November 8, 2011

QR Codes - for non technical folk

By the end of this post, I hope to pass on a little bit of information about QR codes - just some things I've picked up over time in dealing with them.
This post is aimed at non-technical folk, keeping all the gory details to a minimum. For a tech-centric post, go here

What are they?
QR codes are hyperlinks that bridge the real and digital worlds. They allow a piece of print media to take the user to a website, usually on their mobile. The codes themselves are 2D barcodes, and can actually contain text or v-cards to name a few, but mostly they contain hyperlinks.

Where are they from, aren't they just a fad?
They originated in Japan - a subsidiary of Toyota invented them to keep track of car parts. From there, they spread into marketing. Because of their plain, utilitarian nature, I think they will fade as a cutesy novelty, to become ubiquitous, in the same way that hyperlinks are on the web.

Where can one get them?
http://www.qrstuff.com/ is a good place to start, but if you google "QR Code generator", you'll find plenty of tools.

Creative executions?

http://designerqrcodes.wordpress.com/designer-qr-code-art-gallery/ shows many good examples.

What are the legal requirements?
The term "QR Code" is owned by Denso Wave (a subsidiary of Toyota), and their only requirements are listed here:
http://www.denso-wave.com/qrcode/faqpatent-e.html
Basically, you can get away with using the actual code in any way you want, but if you use the term "QR Code", you should note that QR Code is a registered trademark of Denso Wave.

More info?
For more info and links, go to the techie version


QR Codes, explained by commoncraft
http://www.commoncraft.com/video/qr-codes

QR Codes - for technical folk

By the end of this post, I hope to pass on a little bit of information about QR codes - just some things I've picked up over time in dealing with them.

This post is targeted at technical folk. For the non-technical version, go here

Where are they from?
Denso Wave, a subsidiary of Toyota, first created them to track motor vehicle parts, and it wasn't too long before someone thought they'd be useful in the wild.

What do they do?
QR codes themselves just encode text, with varying degrees of capacity and redundancy. Often, the text is a link off to a web site, but it can also be plain text or a v-card or something like that. So QR codes are basically just hyperlinks in the physical world, enabling users to go to content quickly and easily.

Where does one get them?
The easiest way to get started is to google "QR Code generator" and go from there.

Do they have to be black and white?
Not at all - there are many ways to play with them - just as long as the contrast is maintained. Many deployments use a small logo or picture in the middle of the code or as part of the design. This is possible because the codes have a certain amount of error correction.
http://designerqrcodes.wordpress.com/designer-qr-code-art-gallery/ has good examples of interestingly crafted codes.

What are the legal requirements?
The term "QR Code" is owned by Denso Wave (a subsidiary of Toyota), and their only requirements are listed here:
http://www.denso-wave.com/qrcode/faqpatent-e.html
The requirements are extremely lenient - basically the codes themselves can just be used, and using the phrase "QR Code" needs a mention of Denso Wave as the owners of the term. Somewhere :)

Any tips?
  • Create different codes for each execution of your campaign, so you'll know which codes led users to the target URL.
  • Ideal size is 20x20mm, or the "pixels" to be 0.7x0.7mm, whichever is *bigger* (encoding more text will lead to more intricate patterns). Of course, this is for printed media within arm's reach of the user. Billboards and such will need special treatment.
  • Make sure the content the user is going to is mobile friendly. Users will almost exclusively use mobile phones to scan the codes, and will probably use the same to actually visit the destination.
  • QR codes are not a silver bullet. They're not a call to action in themselves, so don't expect addition of QR codes to printed media to suddenly and drastically increase visits.
  • Accept no substitutes. QR codes are the most widely used mobile codes - there are competitors out there, but they don't have the ubiquity of QR Codes - and  the companies peddling proprietary formats often charge to create them.
  • Stats and analytics are important - but beware of companies offering "free" analytics. Such operators still make money, potentially by selling details about visitors to your site. Rather go with a company that will charge you for analytics - your data will be safer this way. If you don't want to spend all that money, using Google Analytics on the destination page, combined ith some GET data will give you a fair amount of information. http://www.gloo.co.za?qr=001 and http://www.gloo.co.za?qr=002 are examples of what I'm talking about - they go to the same place, but indicate different entry points.
  • When generating codes, it's best to save them as a vector based format (like SVG) - your print people will thank you, because they can be scaled to suit whatever media they're designing for.
For more info, Wikipedia has an article:
http://en.wikipedia.org/wiki/QR_code
QR Codes, explained by commoncraft
http://www.commoncraft.com/video/qr-codes
QR code generator:
http://beqrious.com/generator

Saturday, October 29, 2011

Transmitting light, via liquid, down a plastic tube



I've always been curious about fiber optics. And recently found out about liquid lightguides.