﻿ CarloLoG

## Since 1983, nothing to do.

[EDIT: This post also was featured on Hack a Day. Again many thanks to the Hack a Day Staff, and to those that are reading here!]

Ok, I know that a lot of time has passed since the first post! I’m sorry! Here’s the second part, with also a video of the exposure box.

The board schema is pretty simple, there are almost the essentials components needed to
drive an Atmega8, plus a TIP112 transistor and a 7805 linear regulator.
Power is provided through a mean well switching power supply that picks the mains 220
AC and outputs a (almost) steady 12V DC. The linear regulator has been used to limit the voltage to 5V;
The 5V supplies the micro-controller and the lcd display, instead 12V rail has been picked directly from the PS and fed through the led array using the transistor.

We use the transistor as a switch, driving it into saturation. When saturated, it “gives
power” to the led array and, instead, when we stop to saturate him, it “cuts off” power on
the led.
To accomplish this task, we need to assure that the transistor goes into saturation zone,
so, some boring math is required:

Hereʼs some specs of the TIP112 transistor:

Absolute maximum rates:
Vcb = 100V;
Vce = 100V
Veb = 5V
Ic = 2A
Ib = 50 mA

Typical characteristics:
Vce (Sat) = 2.5V
Vbe = 2.8V
Hfe = 500/1000
We have a load of 0.9 A to drive, so
Ic = 0.9 A (Below max constrain of 2A, so, all ok!)
Ic = Hfe * Ib, where:
Hfe = 500 (I chose to use the minimum value from the data-sheet)
Ib = Ic / Hfe = 0.9/500 = 0.0018 A, 1.8 mA

To drive our transistor into saturation we need to source 1.8 mA to the base;
We need to put a resistor Rb to limit the current between the pinout of the micro and the
base of the transistor:

Rb = (Vpinout – Vbe) / Ib
Rb = (5V – 2.8V) / 0.0018 A =~ 1 222.22222 ohms, near 1Kohm
P = V*I = (5V – 2.8V) * 0.0018 A = 0.00396 watts

So we can chose a resistor of 1K, 1/4 W, that is near the calculated value. If you want
more details on transistor operation and more calculations, check this great erMicro blog post. (An awesome work)

DRAWING CIRCUIT SCHEMA AND BOARD LAYOUT
As I tell you in the previous post, to draw the board schematics I used kicad.
board size limitations and is completely open source.
I found the learning curve of kicad a little steep (maybe all cad software out there are a
bit not-so-intuitive at first), but once you got the basics, it become more simple to use.
Perhaps the major limitation of kicad is that there are not so many parts available, and that
there is not so much documentation around.
I managed to create a component modifying an existing one [the transistor],
create a complete circuit schema and outlining the board. I used freerouting.net to
auto-route all connection to the board, cause at the moment the autorouter within kicad is really unstable and almost
impossible to use.
Thereʼs no need to use an external oscillator on the board, cause Iʼm using the internal one of the Atmega.
The software is pretty simple (and of course thereʼs lot of room for improvement), written
and burned on the Atmega8 using arduino environment.
To do that we need an external programmer  (I use a usbtiny bought from adafruit store), and then you have to add a custom arduino board on
You can find the configuration that I have inserted on my boards.txt file on my github page.

FIRST BURNING TESTS
First, if you would like to have a nice overview on pcb etching, you can check out these two links:

I used the etching solution proposed by blondiehacks, one part vinegar with one part hydrogen peroxide + salt as needed.
It worked great.
To drill the holes on the boards I used a good-ol Dremel (see his restoration process),
with bits bought on ebay.
Here are some photos of the first prototypes made using the box:

The first attempt made was a larson scanner,
using the circuit available by the evil mad scientist labs. First one was a sort of disaster,
with a lot of tracks gone and little small holes on copper. I improved board design using a greater wide for tracks, and I resolved the holes problem using 4 positive sheets stacked.

Good results was obtained using a track width of
0.351 mm and an exposure time of almost 6 minutes. The errors that I made were caused by bad design or bad etching and seems there are
no problems with the uv led array.
Once I had a complete working larson scanner, I decided to start etching the uv exposure board.

The first result was apparently ok, but I forgot to connect all ground planes, so I had to connect them with wires. Another
problem came near the regulator, where I find a short. After correcting all these design errors, I obtained a good timer board!
Project UV exposure timer box completed with success!!
At the end of the story, I have a complete self made uv exposure box + a lot of new things learned, and more things to do with them.
Here you can see a video of the completed exposure box and a video of the completed larson board scanner.

I hope everyone enjoyed my post, if you liked it or not, drop me a line!

[EDIT: Seems that this post was featured on Hack a Day! So excited about that!! Many thanks to the Hack a Day Staff!]

[UPDATE 02/10: Writing the second part of the post is taking me more time than I originally planned, this because I'm moving into a new house. I'm sorry for the delay, I hope to publish the next part during the second week of October. ]

[UPDATE 05/11: I have finally written the LAST POST about the UV exp box]

WHY

First objective of all this trip was learning to make a decent pcb from scratch. Honestly there was’nt just one, but multiple objectives:

• Learn to use Kicad (Kicad is an open source EDA  suite – check wikipedia, some tutorials here);
• Design a fully working pcb with a microcontroller on it;
• Learn to impress and etch a board at home;
• Finally, make a uv exposure box with a programmable timer and display, for making other boards.

THE INITIAL IDEA, or Let there be more light

To expose presensitized pcbs you need an uv light source. Common commercial solution is based on neon – For example - .

I choosed to use some uv leds bought from china. They are cheap, I bought 200 of them for 13 euros. With all this leds I tought to make a uv led array with current limiting resistors, driven from 12V power supply. To select wich resistor value and how many resistor to use we have to do some math; If you won’t bother with math, you can use this online tool available here.

For those that want to see annoing numbers, we go ahead with the math for a single resistor in series with a led:

VAcrossResistor = VSupply – VAcrossLed

ResistorValueΩ = VAcrossResistor / IacrossLed

Power dissipated by resistor = VAcrossResistor * IacrossLed

So, suppose we got a 12V supply, a led with a forward voltage of 3.1 V and 20 mA (20 mA are 0.02 A) of forward current:

VAcrossResistor = 12V – 3.1V = 8.9V

ResistorValueΩ = 8.9V / 0.02 A = 445Ω

Power dissipated by resistor = 8.9V * 0.02A = 0.178 W = 178 mW

That was ok, but if you wanna drive an array of 135 leds using 135 445Ω resistors, you result in a lot of energy wasted. Almost 24000 mW of power are turned into heat (Do the math: 178mW * 135 = 24030 mW) . We must improve our efficiency, trying using less resistors and putting them in series with leds.

Now I’ll try to perform the needed calculations, just to see if is it possible to put three leds in series using a single current limiting resistor. If the calculation ends positively, we can use the same obtained configuration and repeat it 45 times, calculating in the end the total consumption of my array.  (This kind of configuration is almost ok if you are pretty sure that all 3 leds have same voltages & current drop. A lot of other efficient ways to driving led exists, this is a very basic way)

Let’s begin:

VAcrossResistor = 12V – (3.1 + 3.1 + 3.1) =  2.7V

ResistorValueΩ = 2.7 / 0.02 = 135Ω

Power dissipated by resistor = 2.7V * 0.02 = 0.054 W = 54 mW

So we are wasting only 54 mW of power. For 45 groups of leds, this become:

54 mW * 45 = 2430 mW of wasted power, that is almost 10 times less than using a single resistor per led.

How much is the power drawn by the array, totally?

A single led drains (3.1V * 0.02A = 0.062 W) 62 mW;

135 leds burns about (62 mW * 135) 8370 mW of power;

Now we sum led power and resistor power:

8370 mW + 2430 mW = 10800 mW, that are 10.8 Watts

A 135Ω resistor is probably uncommon and hard to find (maybe impossible, who knows!) so we can go ahead and use a more common 150Ω resistor, without exceeding our specs:

V = 150Ω * 0.02 A = 3 V voltage drop across resistor;

P = 3V * 0.02 A = 60 mW of power wasted for each resistor;

Total power wasted by resistors: 60 mW * 45 = 2700 mW

Total power required for the led array = 2700 mW + 8370 mW = 11070 mW

Total current consumption is:

I = Veq * Req  Veq / Req;  Req = 1/( [1/(150Ω * 4[3 leds + one resistor] = 600Ω) * 45 ] = 13.33Ω; [Thank you piroesp for telling me about the error!!]

I = 12V * 13.33Ω  12V /13.33Ω= 900 mA or 0.9 A

Done!

We have now the specs for choosing a power supply:

• DC 12V
• Maximum current 1 or 1.5 A
• Maximum power almost 15 Watts

I found this on a local fair.

Leds are soldered on a pre-drilled proto board. That was a painful and tedious process, maybe could be useful if you want to learn how to solder.

Some suggestions:

• Keeping in place the leds can be difficult. I soldered all the leds without the aid of a panavise tool, the results are ok but I wasted lot of time trying to keep all the leds properly aligned. A panavise or a third hand tool is HIGHLY recommended.
• Double check cathode and anode positions before soldering, ending with wrong soldered led after 1 hour of work sucks. Really.

Boxed light

The box his a modded ikea photo frame. More precisely, is made from three ikea photo frames, and a sheet of plexiglas cutted to fit. The upper side of the box was made using two frames glued together, the third frame is linked to the glued two frames using a hinge bought on local hardware store. The upper frame was used to contain the array of leds, the timer board and a display with pushbuttons. Push buttons was made cutting three screws with a dremel, using nuts to keep they in place.

It’s all for this post, stay tuned for the next part. (I’ll try to put it online for the next week)

[If you note something wrong on the led resistor calculation, drop me a line!]

[Drop me a line also for everything else. Feedback is appreciated a lot.]

[Forgive me for my messy usage of english language.]

It’s from Sunday that I find wonderful things: I was googling around for some clarifications related to the problems caused by introduction of a leap second, and I found a good post on: http://my.opera.com/marcomarongiu/blog/2012/06/01/an-humble-attempt-to-work-around-the-leap-second. The author is from Sardinia, Italy. And he works for Opera.

OMG.

My strange trip continues, and when I was poking around redis web site, I discovered that the core developer of the project is from Sicily, Italy (https://github.com/antirez).

OMFG.

Ok, now my last finding: I was looking at opencompute , an interesting project about open source hardware for data center, and I downloaded a pdf containing specs on an open source rack design. Who is one of the authors? An Italian!

• Conclusion number one: I want to do something awesome;
• Conclusion number two: Italy still breaks some asses;
• Conclusion number three: There is an hidden “Italy” that is probably more valuable than half Europe. (Ok, the last conclusion is perhaps exaggerated, but it’s just a provocation. [lol])

Past year winter was very rainy here were I live. So rainy that I had the groundfloor of the house where I live flooded, garage included.

Big mess everywhere, but luckily, my room (I live with other people, we share the apartment) is on first floor of the house, so most of my stuff was
safe.
The only mine thing that gone underwater was my Dremel 300 drill. This not-so-lucky piece of engineering did a 15 hours long bath into muddy waters. After the flood, I was too busy cleaning the house and putting pieces back in place, so I forgot to take a look on my poorly wet Dremel.
Until today! I remembered about his existance because I needed him to cut in half a printed circuit board.
Great. Where the hell is my Dremel?!
Oh fuck! It has been underwater when the flood occurred! Can it still work? My worries were related to rust formation, due to the fact that the drill
was only shaked a bit to let the water go, but it was not opened up, cleaned and dried.
All my worries gone away when I connected it to the grid and pushed the switch. We have a rotation! Tt’s working, and it’s working good!
Even at full speed, no strange sounds, no buzzes. It worked like a charm.
Curiosity drives me, and I were too curious to see the belly of this little workhorse, so I disassembled it.
Here there are few toughts that I want to share about my little Dremel servicing experience.

Fully KISS compliance (Keep It Simple Stupid):
Too easy to take apart the pieces. No fucking strange screws (like f.e. those unnecessary crappy tri-wings), or sticker-screw-masks. Just plain torx type screws. Nothing is so easy like open up this guy (Okay, don’t take me too serious, man). All the pieces inside where easy to take apart. I was able to
pull out the rotor from the stator in a bunch of minutes. The stator seats on drill enclosure. There is no glue, no strange things. The rotor axle
has two little bearings on the ends, one of them has a little rubber gasket on it. The rotor windings where perfect, magnets was a little rusty, only
on the surface. Rust was also on stator magnets, on the end of the rotor axle (near the drill tip attachment), and on the surface of the bearing without
gasket. There was a thin film of mud everywhere, water was evaporated as expected.
Easy to see how all pieces fits together, was easy to put the pieces back in place.

Quality:
I’m not a materials expert, nor an engineer or a designer, but I had the opportunity to take apart a lot of things in my life; This little drill
rocks. Flood-proof parts here, dude.

Mantenaince:
As said before, there was rust on the surface of magnets. Rust was also on the rotor axle, and on bearings surfaces. Nothing serious, just rust on the
surface that probably get worse if not removed. I choosed to use fine-grained metal sandpaper for rust removal and a sprinkle of WD40 to protect from corrosion. NOTE: Use sandpaper on the windings is probably a bad idea.

Final toughts:
Nice example of industrial design. We need more things engineered like this one. Simple. Cheap. Durable. Easily repairable. Easily serviceable.
We don’t need complicated and impossible to open things, and although the dremel is not open hardware, I think that hardware makers can use it as a good example.
Now put your drill in the air, and start to sing.. “We don’t need no, complications, we don’t need no, control of our hardware….”

NOTE(I don’t work for Dremel, no one paid me to write that toughts)
NOTE2(Someone would pay me for write good things about products? Drop me a mail if interested!)

Companies, please respect maker’s bill of rights!!
The Hardware Hacker Manifesto: http://daeken.com/the-hardware-hacker-manifesto
The open hardware journal: http://www.openhardware.org/journal/
Wikipedia on open source hardware: http://en.wikipedia.org/wiki/Open-source_hardware

Good news on the horizon: Raspberry team has released the first root filesystem image, which is [Excerpt from the announcement] “a fully functional Debian Squeeze installation containing LXDE (desktop) and Midori (browser)”
Board selling is planned to start from the end of February, 25 \$ for model A and 35 \$ for model B. Specs of both are here

Ok, nothing extraordinary today, just some things that are worth mentioning..
Last week I was working on adding some features to an existing java webapp, that we use to control acquisition processes on an embedded system. While I was doing it, emerged the need to execute ping requests using web interface. The web interface is built upon Ext js 3.2, and is composed mainly of tabbed panels containing grids and forms. Our ping interface is made of a simple form, containing a text field and a button. When button is pressed, I execute a http post containing IP address of the host that will be “pinged”.
I needed some server side validation of Ip address, and a instant refresh of my knowledge about regexps.
First of all, if you need to compose and test regexps, my suggestion is to take a look to rubular , it’s fast and easy to use. You can compile regular expressions and test them against strings on the fly. Very useful to my needs.
After a couple of minutes trying various combination, I found this:

`\A\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}\z`

This regexp matches against a string containing an ip address formatted string. How? I will try to explain what the expression do analyzing the meaning of each single piece:

• `\A`
This metacharacter means “start of the string”, we need it to put a sort of starting point marker. The presence of this char in the expression avoid matching against a malformed ip address like for example x192.168.2.3.
• `\d{1,3}`
First meta \d matches against digit characters. But how many digit we expect to find in our Ip address? A minimum of one to a maximum of three. So we need to use the {MIN,MAX} matching operator. \d{1,3} means that we want to match a number, built of a minimum of one to a maximum of three digits.
• `[.]`
All chars enclosed into square brackets will be matched. More clearly, suppose that you want to know if there are numbers into a string: The regexp [\d] will match if there is some numbers (or only one) into. In our ip case, we need to match against a dot after a group of digit, so we use [.]
At this point, we have a regexp that matches against pattern X. or XX. or XXX. , where the X are only numbers. We need just to repeat the same pattern 4 times, one for every octet of an ip address: \A\d{1,3}[.]\d{1,3}\d{1,3}[.]\d{1,3}
• `\z`
The \z meta means “end of the String”. After 4 octets, we don’t want anything else in our ip. So we have to include \z to avoid matching against a malformed ip address such as 192.168.231.2x or 192.168.2.90x.
At this point we have an expression that matches against a string formatted like an ip address, but what happens if my string is something like 999.999.999.99 ? I mean, string is formatted correctly but, of course, is NOT a valid ip. With our regexp, we check only the format of the String. We know that a valid ip address is composed from 4 octets, and each one could be a number in the interval 0-255 (Probably this statement is not completely true, but it’s ok for our purposes). We need to check that every octet is within the range 0-255. How we can do this? There are many ways, one is to get every octet from the string, put them into an array and execute on that all the checks that we need. We could extract our octects using regexp capture operator. Our regexp become:

`\A(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})\z`

See that round brackets? Every char of the string that matches on meta enclosed into them will be stored in memory for later recall. AFAIK, the way in which you could retrieve the groups from memory depends on the used programming language.
Following, two Java methods that summarize the content of this post. I hope that all this things and toughts will be useful for someone, comments are opened!

```final Pattern IP_PATTERN = Pattern.compile("\\A(\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})\z");
boolean matches = m.matches();
boolean validIp = false;
for(int octet: octects){
if (octet > 255){
validIp = false;
break;
} else {
validIp = true;
}
}
return matches && validIp;
}
```
```    private int[] extractIpOctets(String ip){
int[] octects = new int[4];
Matcher group = IP_PATTERN.matcher(ip);
boolean matchFound = group.find();
if (matchFound) {
for (int i=1; i<=group.groupCount(); i++) {
octects[i-1] = Integer.valueOf(group.group(i));
}
}
return octects;
}
```

• Just found a super simply way to make a screencast whith osx (10.6.8):

• Open QuickTime;
• File -> New Screen Recording;
• Now click on the right side arrow of the window, and select your audio source (If you need to record some audio);
• Push the record button when you want to start recording;
• When finished, push stop recording button on the top bar, your awesome screencast will be saved on movies folder. If you want to select a particular format, you can click “Save as” and select which format you need.
No mess, it’s done.

• This is my first hack video footage. It explain the process of inspection against a remote that I have connected to an arduino. Not very useful, just a generic experiment with Arduino, simple electronics, and video editing.