When I was at the rock gym last week, one of the staff members had some gloves with blinking LEDs in the finger tips and was dancing around like an idiot.A friend of mine was jealous and said in passing “you should invent something for me to swing around so I can go to a rave.”


So the goal was to make something cool (cooler than just generic blinking LEDs) that one could swing around during a rave.

Here are my design requirements:

  • Cooler than blinking LEDs
  • A nice user-friendly polished finish
  • Made with stuff that I have lying around my apartment (time constraint)

I settled on making a Persistence of Vision toy.Persistence of vision is what allows these clocks to work:

Basically, they operate on the principle that your eyes react very slowly to changing inputs.If you have a row of LEDs moving very quickly, their light will hit different parts of your retina as they move.If you move fast enough, you will still be able to see the light coming from their first position as they move into their final position.This lets you “paint” images or text in the air.

To make a steady image, you need to map the LED blinking to a specific location in space.Presumably, the clock above has some kind of position encoder for the LED wand that flicks back and forth.

I didn’t want to go too crazy with my design, so I figured that I would just have the LEDs blink at their own pace and just make sure that the patterns are simple enough to be seen with a single pass.

I had some red LED bar graph displays lying around and an old ATMega48A.The schematic is pretty simple.Each LED is connected to a data pin of the ATMega in series with a 100 ohm resistor making sure that the micro-controller pins were sinking instead of sourcing the current (most micros can sink more than they source).Because the voltage drop across red LEDs is typically about 2v, this gives you a 1v drop across your 100 ohm resistor or about 10mA of current.
Concerning the current draw on the pins, the datasheet had this to say:

  1. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady stateconditions (non-transient), the following must be observed:
    ATmega48/88/168:
    1] The sum of all IOL, for ports C0 – C5, ADC7, ADC6 should not exceed 100mA.
    2] The sum of all IOL, for ports B0 – B5, D5 – D7, XTAL1, XTAL2 should not exceed 100mA.
    3] The sum of all IOL, for ports D0 – D4, RESET should not exceed 100mA.

I’m probably okay here.8 pins (per port) with 10mA each is still under 100mA.
Here’s my schematic:
 

Though it’s really not much to look at because the bus makes it hard to determine LED mappings.This is actually kind of irrelevant because the LEDs can be mapped in whatever way is convenient when laying out the PCB itself.Here’s my PCB:

I actually set out to etch this PCB (note how it’s mostly one-layer), but I ran into some problems.I’ve had this bottle of Radio Shack brand PCB etchant that totally sucks and has ruined a number of boards. That’s just as well, because I realized after the fact that I made a few mistakes.I fixed them on the schematic, but didn’t bother on the PCB (notice the airwires).I wasted about 2 hours trying to get this to work and eventually gave up and just used perf-board instead (I actually had to cut some old components off an old circuit because I was out of fresh board).

I didn’t get any pics of the assembly process, but you can find a bunch of info on un-clad perf-board prototyping online if you just Google it.The only new thing is that I decided to remove the power switch.Because the batteries will be easily accessible, it’s reasonable to just have the user take one out when he/she doesn’t want to use it (after all, it’s for a rave and glow sticks don’t have power switches).

The next major (and really only) challenge was making patterns for this thing.I ended up writing a python script using the Image library that accepted bitmap images and produced lookup tables for my AVR.

It took this:

And produced this:

{0×0,0×51,0xff,0x3c,0xff,0xff,0x3c,0xff,0xff,0x3c,0xff,0x3f,0x3c,0×7,0x1e,0x3c,0×1,0xce,0x3c,0×70,0xc7,0×38,0xfc,0xf3,0×30,0xff,0xf1,0×20,0xff,0xf9,0×24,0x1f,0xf9,0×4,0×13,0xfd,0xc,0×19,0xfd,0xc,0xfc,0xfd,0xc,0xfc,0xfd,0xc,0xfc,0xfd,0xc,0×19,0xf9,0×4,0×13,0xf9,0×24,0x1f,0xf1,0×20,0xff,0xf3,0×30,0xff,0xc7,0×38,0xfc,0xce,0x3c,0×70,0x1e,0x3c,0×1,0x3f,0x3c,0×7,0xff,0x3c,0xff,0xff,0x3c,0xff,0xff,0x3c,0xff}

This is a table of values to display on the LEDs.The first two values show in hex how many values are in the table, and the values after that are in groups of 3.They are the values to be displayed on PORTB, PORTC, and PORTD respectively.

What’s silly is that the part that took me the longest was remembering the syntax for accessing lookup tables.The most efficient way to store lookup tables is in program memory (because you have a lot of it).The syntax is as follows:

const uint8_t smile[83] PROGMEM = {0×0,0×51…

Where “smile” is the table name and [83] is the number of elements.To return the first value, you would do the following:

PORTB = pgm_read_byte(&smile[0]);

Note that you’re passing the address of smile to pgm_read_byte(), not the value itself.When I first wrote the program, I forgot the special pgm_read_byte() and just wrote:

PORTB = smile[0];

What’s silly is that this actually worked fine until I tried doing this operation in a loop.It’s just one of those weird compiler quirks.I don’t know what was going on internally, but all of the LEDs would flash on randomly if I tried running the lookup in a loop.You can imagine now why it took me 45 minutes to figure out I had the wrong syntax.

Because I wanted to support several patterns, I was going to need a way to write a generic pattern reading function and pass multiple patterns to it.I had never tried passing a look up table to a function before, so it took me a few tries to get it right, but here’s the syntax:

void print(uint8_t *pattern, uint8_t loops) {….

print (&smile, 200);

Where “loops” is the number of times to repeat the pattern.

Well, that’s about it for the software.Now back to the hardware!

Here’s the finished board:

I had one of these cases lying around:

And milled it up using my hand-mill to cut a hole for the display.I mounted a battery clip onto the back using some super glue and a single nylon screw (I only had one):

As you can see, there is a keyring attached with dental floss to one side (I said it had to be stuff in my apartment!).The idea was that you could spin this thing around on your finger.I found that this didn’t work for a number of reasons (namely, the dental floss would make its way through the keyring and the device would go flying across the room), so I made a quick trip to home depot and made this for the ultra low price of $2:

I cut two holes in a washer and tied a line through them.I then fitted the washer on to a bolt and threaded two nuts (to lock them in place) making sure to leave a gap between the nuts and the bolt head so that the washer could freely rotate.Finally, I glued the bolt into a piece of wooden dowel using wood glue.The end result worked really really well and was easy to hold.I was afraid that the device would tend to twist and turn its back on the viewer (making it impossible to see), but because I could space both lines apart like this, that wasn’t an issue.

And here’s a video of the end result! (there’s no audio)

As you can see, it automatically scrolls through a number of patterns.I actually had space on the device for about twice as many, but I couldn’t think of anything more to display, so I left it as is.Another thing to notice is that the text “DANCE!” is fairly difficult to read.For complex images and text, some method of reading position data and controlling the LEDs to hold the image steady is important.As long as the image is reasonably steady, the viewer’s brain should lock on and stabilize it the rest of the way.This way they can see the image for multiple passes and have more time to read it.I’ll have to keep this in mind for my future persistence of vision projects.

I am extremely impressed with how well this thing turned out.The entire project time was about 15 hours.I started it at 3pm on Saturday and gave it to my friend by 7pm the next day.She loved it!

P.S. The music note pattern is backwards.Fuck.

[via: http://ch00ftech.com]

 

If you saw this guy at a bar, would you say hello?

No? What if he shaved and took a shower?

Concept

This is an idea I had a while back after making my persistence of vision toy.Unlike that though, this thing had to be small and lightweight.To accomplish this, I was going to need to etch my own PCB rather than using perfboard.That’s what this was all about.I’ll be providing a tutorial on that later.

So, unlike the persistence of vision toy, I wanted this thing to have some sense of where it was in order to blink the LEDs properly.All I needed was a single trigger at a set location.I could then use the time between triggers to calculate how fast the user is waving the device around and use that frequency to attempt to blink the LEDs at the same location in every cycle.Image stability makes text much easier to read.

My original thoughts were to use an accelerometer, but that presents several unknowns.For example, as the user is waving to the right, he or she might actually be slowing down slightly which would register as a leftwards acceleration.Also, accelerometers are generally fairly expensive, and I was trying to keep costs down.I decided to consult a similar gadget and do some reverse engineering.

Here is a toy I bought a few years ago:

It’s a scanner/display which is actually pretty cool.I don’t know who makes it, and I can’t find anything about it online, but they used to sell them on Thinkgeek.The user can use the LEDs as a scanner to scan black and white images (using a technique that I will be trying out shorty) and then wave it back and forth to display the images in midair.

The question is: how do they display the images so smoothly?I was about to crack the device open to see when I saw this:

It looks like they just have a white marble that rolls around and a proximity sensor that detects when the marble is overhead.This has several advantages over the accelerometer.Namely, it doesn’t require any sort of signal processing.The ball is either there, or it isn’t.

I wasn’t able to take a picture of this, but using a pair of night-vision goggles (what? they’re cool. Screw you guys), I could see that this proximity sensor was emitting infra-red light.The sensor is basically an IR LED and an IR sensor.When the IR light bounces off the marble, the sensor picks it up.

Construction

Keeping that in mind, I made this:

Same basic concept.The channel is a plastic drinking straw from Chipotle (very important.It won’t work if it’s not from Chipotle), the end stops are rolled up paper, and the “marble” is the shaft of a nylon screw wrapped in paper.I had to cut a small window out of the bottom of the drinking straw, because even though it’s clear, it reflected enough IR light at that close a range to register on the sensor.

All together, here’s the gadget:

Relevant parts:

  • ATTiny24 – I tried using a ATTiny20, but found that there is very little support for that crappy chip.
  • SFH7441 proximity sensor.
  • CR2032 battery.This is a 3V cell, so I had to use a low-voltage micro controller.
  • DP3T switch.The idea here was to have three different positions: Off, “Hello”, and “Goodbye”.One side of the switch is power (handle’s the “off”), and the other side feeds into an input line that determines whether you want “Hello” or “Goodbye”.I haven’t implemented this feature yet, but I might later.

The code for this thing is pretty nifty.I managed to do all of it in hardware interrupts. There’s an external interrupt provided by the sensor, and an internal clock interrupt that helps keep timing.Every time the clock interrupt fires, the code adds one to a tally.When the external sensor interrupt fires, it looks at that tally and uses it to determine how fast the user is swinging (faster = lower tally).It then divides that tally by the number of columns to be displayed.This last number is used every clock interrupt to determine whether or not to display a new column.

Problems:

Once I got the firmware written, I wasn’t exactly pleased with the performance of the device.My original plan was to have it paint “Hello” on the left-right swing and “olleH” on the right-left swing.I quickly found that this was a bad idea as most people don’t wave exactly symmetrically and the letters rarely line up correctly (the toy also only “paints” in one direction).

After fixing that, I still wasn’t very happy.I noticed that discounting all of my timing issues, the start of the “H” wasn’t showing up in the same location every swing.I quickly began to suspect my proximity sensor wasn’t firing properly.I took a peek at the data sheet, and found this:

Turns out the sensor is actually pulsing it’s sensing ability (I actually noticed the IRLED blinking when I looked at it through my IR goggles).What’s worse is this:

That middle number is the typical refresh time of the sensor.90ms is nothing to scoff at.Assuming I’m swinging at 3Hz, that’s only about 160ms per left-right swing.What’s happening is that the sensor isn’t registering my swing until I’m part-way through with it!What’s worse is that unless I’m swinging at a rate evenly divisible by 90ms, the “start of swing” will move around as time goes on.What a pain!

If I swing slowly enough, the text stays reasonably still though.I might be making another one using a better sensor in the future.They sell sensors that are simply photodiodes and LEDs where you get to set the refresh rate yourself.I’m pretty sure this is what my toy uses (it has four leads).I’m still trying to figure out why there’s an entire class of blinking sensors. Perhaps pulsing the LED makes it more power efficient? Some of them have refresh rates up to 1MHz, but even the 200Hz sensors cost upwards of $30.

Conclusion

All in all, it was a fun project.The hardest parts were etching the board and writing the firmware, and now that I’ve got all of that figured out, I can make another one with a better sensor in no time.I’ll order some parts and try it again soon.

Here’s a video of it in action.I used some Hollywood magic to approximate your persistence of vision using the “echo” effect.

[via: http://ch00ftech.com]

 

Whaaat? You can do that?! You need phototransistors or photodiodes silly!Turns out, you don’t.IT’S A CONSPIRACY!

Seriously though, LEDs can be used as photo detectors.It’s not as simple as using a proper photodiode, but it’s a pretty neat trick and can save you a few parts if you’re working on a budget.

First, let’s discuss what an LED is.

Light-Emitting Diode

LEDs contain a small junction of specially doped silicon.The details are a little complicated, but all you really need to know is that this junction sets up a “band gap”.Visually, I like to think of a band gap as a large stair step where the vertical axis represents voltage:

If you are able to raise the anode step up high enough (the forward voltage of the LED), you can get electrons to fall down to the cathode.As they fall from this high energy state to a lower energy state, they release a photon of energy equivalent to the energy lost during their fall.

This explains two cool facts about LEDs:

  1. With light, low frequency colors (red, yellow, etc) have less energy per photon.This is why blue and green LEDs have a higher forward voltage.The electrons have to fall farther to release more energy and get higher-energy photons.
  2. This is why LEDs need in-series resistors.Once you’ve got your electrons up to a sufficiently high energy state, there’s nothing to keep the lot of them from pouring down that step and potentially blowing out the LED.

Now.Here’s where a cool trick comes into play.If you reverse the paths of the charge carrier and photon in that image above, it still holds true.

This is what Einstein calls the “photo-electric effect”.Assuming the incoming photons are of high enough energy to raise the electrons on the cathode up to the anode, the junction will produce a current (if the photons aren’t energetic enough, the charge carriers will just fall back down to the cathode and produce heat).

If you look at a solar panel, it’s really just a giant junction that will produce current when exposed to light.This is also why most semiconductor products are housed in black plastic.Incoming light could potentially produce small currents that could disrupt performance.

Now, it’s worth keeping in mind that this effect is exhibited more in some devices than others.It will vary depending on how the junction was doped.In the case of LEDs, this photo-current is extremely small.On the order of maybe a micro-amp or two.Currents like this are extremely difficult to measure, especially considering that the idea here was to reduce the number of components.

Capacitors turn Current into Time

To measure this current, you just have to take advantage of parasitic capacitance.Every single component on any PCB exhibits some kind of capacitance.In some cases, such as in high-speed data lines, this capacitance can be an issue.For this project though, it’s welcomed.

To perform this trick, I started by connecting an LED across two pins of my micro-controller.I know you’re always supposed to have a current-limiting resistor in series, but I figured that I’d leave it out for simplicity’s sake.The output impedance of the micro-controller isn’t exactly super low anyway.

The IO pins of the ATMega48 I was using can be configured as either outputs, high-impedance inputs, or high-impedance inputs with a weak pull-up resistor.

The basic idea is to build up a small amount of charge on this parasitic capacitance and then let it slowly bleed through the LED.The more light hits the LED, the more current the LED generates, and the faster this charge bleeds off.While current is hard to measure, time is extremely easy to measure.All you have to do is time how long it takes for the voltage on the cathode of the LED to drop.

I started this process with the IO pins in the following configuration:


In this configuration, the capacitor charges pretty much instantly.Next, I changed it to high-impedance input with a pull up resistor.Electrically, this step doesn’t do much new, but it does prepare the micro-controller to “let go” of the cathode.I figured it was better to charge the capacitor with the pins in output mode, rather than through the pull-up.

Finally, I dropped the pull-up, letting the cathode float, and immediately started a timer to see how long it would take the LED to dissipate the charge.You don’t even need an ADC for this step.As soon as the voltage drops below the V-input low, the micro-controller will read a low voltage, and you can tell it to stop timing.

All of this is accomplished in the following code snippet (sorry about the formatting, I’ve been battling with wordpress lately…)

uint8_t count(void){uint16_t time = 0;PORTB = (1<<cathode); //force cathode high and anode low//to charge the "capacitor"DDRB = (1<<anode);//turn the cathode into an input//still held high by internal pull-upsPORTB =0; //release the cathode.while (PINB & (1<<cathode))//time how long until the voltagetime++;//cathode drops below V_input_low.DDRB =((1<<anode)|(1<<cathode));//turn anode and cathode back into//outputs so the LED can be used.return time;}

Benefits

The coolest part of this technique is that when you’re not actually measuring the ambient light the LED can be used as…well… and LED!It’s just a matter of reversing the pins and driving the LED normally.For long-term use though, you might want to consider integrating a series resistor.Given how low the currents are, a 100ohm or so resistance probably wouldn’t make any difference.

Drawbacks

There are quite a few drawbacks.Some of the simple ones include the fact that an LED will only detect light that is a higher frequency than the light it emits.If you have a blue LED, you will be unable to detect red light.

The LED can’t be lit while it’s in detection mode.This isn’t too much of a problem until you start getting into dark situations.Sometimes, if it’s dark enough, it can take a number of seconds for the cathode voltage to drop.You might be able to fix this problem by putting a huuuuge resistor in parallel with the LED, but the highest I had was 470k, and that wasn’t big enough.

When I first ran the code snippet above, I noticed that my time measurements seemed to get a lot noisier as light-level decreased.Commenter Josip pointed out that I wasn’t using a large enough variable to store the time, and it was overflowing, causing me to take “random” measurements.Running it again, I found that even a uint32 isn’t large enough to prevent overflow, so if you use this code, you’ll have to find some way to accommodate small and very very large numbers.

Finally, no two LEDs are the same, and the measured values can change dramatically because of things like ambient temperature and humidity as well as circuit board layout (anything that can affect capacitance).For my little demo, I just found a value that looked good and used it as a threshold.In reality, you would need some kind of calibration routine.

Conclusion

The below video is a short demo of this application.The code takes a measurement of the ambient light entering the LED then decides whether it’s going to keep the LED on or turn it off.It then takes another measurement after a short delay, and the process continues.The idea is for it to act like a night light, only turning on when the room gets dark.As you can see, this plan backfires when the room gets too dark as it spends so much time waiting for the LED’s capacitance to discharge that it becomes noticeable and then downright useless.In a real application, you would have to find some way to accommodate this delay perhaps by only taking a measurement every 30 seconds or so.

Overall, it was a pretty cool project.I have a plan to make a sort of simplified image scanner that will be made much easier using this method.

[via: http://ch00ftech.com]

 

So, my attempt at make home-brew etchant before was a miserable failure, but I think I’ve found the solution:

Hehe…get it?

Seriously though, this stuff was badass as hell.When I opened the bottle, I saw a little wisp of white smoke.Definitely more badass than the stuff I had last night.Before I could use the new acid though, I needed to properly dispose of the old etchant I made yesterday:

Now, I don’t remember too much chemistry from high school, but I actually used to volunteer to be lab assistant for my teacher after school.One of the tasks of a lab assistant was to neutralize and dispose of all the left over acid from the day.To neutralize an acid, you just need to add a base:

If you’ve ever mixed baking soda and vinegar, you’ve neutralized an acid.Basically, you just want to slowly add baking soda being careful not to let it fizz up too much and spill all over the place (possibly burning holes in things).Once you’ve added enough baking soda so that it no longer reacts, the solution is safe to pour down the drain.My etchant solution turned the most lovely color of green:

and it smelled a little bit like the rec center pool.You chemistry folks will have to explain that one to me.

With that all taken care of, I followed the same recipe for the etchant this time: 2% H2O2, 10% HCL.Because my solutions were already 3% and 30% respectively, I just did 2 parts H2O2 solution to one part HCL solution.

I didn’t mention this last night, but here’s a brief lesson on acid safety.Wear goggles, wear gloves, wear an apron if you have it.Work in a well-ventilated environment.Don’t store acids in metal containers.Don’t use metal implements.Always add acid to water and do it slowly.

This last one isn’t super intuitive, so it’s worth explaining.When you dilute an acid, heat is produced.You usually want a large body of water to absorb that heat.If you add water to a small amount of concentrated acid, the heat could potentially cause the acid to boil and splatter concentrated acid all over the place.Not to mention that if anything is going to splash or splatter, you want it to be your vat of water and not acid.In this case, I added the HCL to the H2O2 because the H2O2 solution was mostly water anyway.

Moving on.Using the same process as last night, I prepared a test slip with some Sharpie marker and dropped it in the solution.The results came much faster.Here are some pictures:

After three minutes:

After 10 minutes:

After 13 minutes:

After 25 minutes:

The whole time I was stirring pretty much non-stop.I didn’t think to heat the solution, but I’m sure if I did, it would go even faster.

The Sharpie marker turns out to not be the perfect etch-resist marker as some of it dissolved away (that could also be a function of it not being perfectly dry).Here’s the board at the end:

As you can see, the Sharpie layer is so thin that it’s translucent in some areas.You’ll also note a bit of undissolved copper.I decided to pull the board out a little early to save from having any more of the Sharpie eaten away.

With a little acetone, I removed the remaining marker:

Well, the end result is far from perfect.There is a lot of under-cutting, and the letters are hardly straight-edged.Overall though, I think it was a success.Once I get my proper UV-reactive etch-resist boards in, I’ll be able to make some really clean traces I think.I wasn’t really going anywhere with Sharpie anyway.

Also, the entire process took less than 30 minutes as opposed to the hour long travesty from last night.This is also with me etching a much larger board.Here’s a comparison:

What’s also cool is that this stuff is (supposedly) reusable!When the solution dissolves a lot of copper, it turns a bluish hue.Apparently bubbling some oxygen into the solution causes the dissolved copper to precipitate out leaving the solution ready to use again.If bubbling is too difficult, you can also just add a little more H2O2.

Even still, the entire solution was less than $10 and will be enough to etch dozens of boards.Can’t wait to try it on the real deal!

[via: http://ch00ftech.com]

 

When you feel like doing some really rapid prototyping and don’t want to wait around for a board to come in the mail, you usually have to print a board of your own.I’ve done this a number of times (the original bullet counter was a home-printed board).

The whole process has a number of steps (which I will be going into in another post), but one of them involves printing an acid-resistant substance on a copper sheet and dissolving the un-coated copper in an acid.As I have mentioned earlier, I had some really crummy ferric chloride acid that didn’t do a very good job of etching my boards.I would usually end up sitting around for an hour or so waiting for it to etch only to have the etchant start to eat under my etch-resist while other free portions were still un-dissolved.

Ferric chloride is also kind of pricey, so I decided to try my hand at some home-brew etchant.I found a recipe online that calls for just two ingredients:

Muriatic Acid (HCL) and Hydrogen Peroxide (H2O2)

The goal is to have about 10% HCL and 2% H2O2.The H2O2 claimed to be 3%, but there were no details on the HCL bottle (save for what I added in sharpie later).A quick google search turned up some documents on the Klean-Strip brand HCL:

So it says “<25%”.Hrm…not too specific…Well, I decided for simplicity’s sake to just round up to 30%.That way I can just use two parts H2O2 and one part HCL to get my 10%-2% solution.I mixed the solution up into a plastic bin while WEARING GLOVES AND GOGGLES.

Next, I took a small piece of copper-clad circuit board and drew on it with a special etch-resist marker:

By which I mean a sharpie.

I cracked a window and then dropped the test piece into my solution:

I immediately noticed a fair amount of bubbling.I originally paid no attention to these bubbles, but as time wore on decided that it was a pretty good idea to agitate the solution to keep them from building up.I used the wooden handle of a thin paint brush to move the little board around.

I also decided that it would be a good idea to heat the solution a bit to speed the reaction along.I filled the sink with hot water and placed container in the hot bath being careful not let any water into or acid out of the container.

You can already see that some of the copper has been eaten away by the acid.

After a while, the solution started to turn a little blue-ish as the copper was dissolved:

After an hour of stirring and mixing, I removed the board, washed it off, removed the sharpie with some acetone and PRESTO CHANG-

Oh… Well, something went wrong here.

Well, I did a number of things wrong.Firstly, Sharpie isn’t the greatest etch-resist marker, and my copper clad was pretty beat up (scratches in the copper can lead to under-cutting of the etch-resist.

Barring that though, there was something seriously wrong with my solution.Most of the guides online talk about the etching process taking less than five minutes.Mine was an order of magnitude slower.

My theory is that the muriatic acid that I used wasn’t very strong or that it had some kind of buffer solutions mixed in with it.The stuff was advertised as producing “90% less fumes than standard muriatic acid” and being “safer than standard muriatic acid”.I want the dangerous corrosive stuff dammit!My guess is that this acid is just super weak.It says that it’s “less than 25%” in the documentation, but I’m willing to bet that it’s much much less than that.Hell, HCL is supposed to corrode your lungs and make it hard to breathe and yet I could barely smell the stuff I was using.

This was the only brand of HCL that Home Depot carries, so I’m going to take a trip to Lowe’s tomorrow and pick up some of this stuff.It claims to be over 31%!

[via: http://ch00ftech.com]

 

So, the good news is that my laptop is up and running again despite Apple designing their software to be too user-friendly to actually work (it’s cute when it’s PhotoBooth.Less so when it’s 10,000 of my photos).

The bad news is that my attempts at making a circuit board were complete failures.See results below:

The first five of these were made using the UV exposure method, the latter was me falling back on the toner-transfer method (and melting the paper itself onto the copper).

The purpose of this post will be describing what I think went wrong, and how I plan on fixing it in the future.Before I can do that, I need to explain exactly what the UV exposure method entails.

I’ll be writing a proper how-to guide in the future (with pictures), but this is just a quick explanation.

In order to use the UV method, you need special substrate-coated copper sheets.There are two types of substrate: positive and negative resist.Positive resist is softened by UV light and the UV-exposed areas are washed away.Negative resist is the opposite.I used the former.

The circuit board “artwork” is first printed on a sheet of transparency film. The transparency sheet is then laid on top of the substrate-coated copper sheets with a transparent glass or plexiglass weight on top to hold it down.

The combination is then exposed to UV light for a period of time.The toner on the transparency sheets protects certain parts of the board from UV light.When it is done, a special developer is used to wash away the sections that were exposed leaving only the traces that exactly match the pattern that was originally printed.

The board is then washed in acid.The areas still covered in substrate are protected while the unwanted areas are washed away.

So what went wrong when I tried this?I have a few ideas.

  • Developer was too strong
  • Boards were too cheap
  • Printer doesn’t print dark enough
  • Acid agitation was too non-uniform/rough

Developer was too strong

Rather than ordering special developer, I opted to make my own.Developer is really nothing more than NaOH or “lye” of a certain concentration.Unable to buy pure lye (thanks crackheads!), I had to purchase Drano which contains high concentrations of lye (among other things).

I purchased two types of Drano: Drano Max Gel, and Drano Kitchen Crystals.The latter is what I used for most of my experiments.It took me a while to realize exactly what the stuff is, but it appears to be powdered lye mixed in with metal shavings and a few other things.The Lye dissolves the metal shavings (probably Aluminum?) and foams up presumably helping clean your pipes.

The issue is that this creates a time differential of developer potency.As I was trying to add just the right about of crystals (a guess-and-check procedure), the mix was actually becoming more dilute over time.What usually happened is that I would end up having to add a lot of Drano all at once creating a super strong solution that would dissolve everything off the board, not just the UV-exposed substrate.

I also tried the gel Drano for one of my final trials, but I still couldn’t find the right concentration and ended up over-developing my board.To fix this problem, I purchased a graduated cylinder, and I plan on running a few trials of known concentrations to figure out which mix works best (rather than guessing).

Another thing to note is that the substrate tends to need some gentle scrubbing to get the developed bits off.I have to be more careful with this step as it is easy to scrub the entire surface off.

Board was too cheap

The board I purchased was manufactured by a company called “Injectorall Electronics” (but I hardly know ‘er!).Most of the reading I did online referred to a company called MG Chemicals.MG is actually the company that made the UV lamp that I bought.

The Injectorall boards are almost half the price of the MG boards, and I think it’s possible that they are just really crappy.It didn’t help that the substrate on those boards was nearly the color of bare copper so it was difficult to see when they were properly developed.I think the MG boards have dark black substrate.

For next time, I hunkered down and boughtone of the more expensive MG boards.It’s still only $18 for a 6×6″ board, and that’s a hell of a lot cheaper than the $150 minimum order at Advanced Circuits.Especially considering this will mostly be for small one-off boards.

Printer doesn’t print dark enough

This one is less likely to be a real issue, but it’s worth addressing.My printer’s toner cartridge is a bit old, and it’s definition of “black” is really more of a “gray”.It’s possible that some UV light is seeping through the black sections and weakening the substrate beneath.

To fix this, I ran over the traces and copper pours with a sharpie just to make sure they were properly blacked out.It might not be an issue, but for a small board, blacking it out like this only takes a few minutes and only needs to be done once per design so I plan to err on the side of caution.

Acid agitation was too non-uniform/rough

This one calls back to my post from last week about copper etching.I’m still not really satisfied with the performance of my acid.The acid is probably fine, but I found that when agitating it, I was often times rubbing off substrate by accident.I’ve also been unable to aerate my acid enough to get the copper to precipitate out.

Here you can see where I got part way through etching when some of the substrate (dark tan) came off.

To fix all of this, I’m going to be building a special etching tank that includes a fish tank bubbler that should make sure there’s plenty of air in my acid.The bubbles will also serve to agitate the board for me and make sure that fresh etchant is always flowing over the copper.

I also purchased a fish tank heater that will get my solution hopefully up to around 115F which will greatly speed up the etching process (some claim that it works in six minutes!).

I’ll be assembling the tank when the parts come in later this week.

I’ve dumped quite a bit of time/money in to this, but I think the outcome will definitely be worth it.I really liked the persistence of vision toy I made a few weeks ago specifically because I made it so quickly.I don’t want to have to wait three weeks for boards to come in. If it’s a bit of a pain to make them myself, I’m up for it.

[via: http://ch00ftech.com]

 

So, after weeks of trying to get this whole PCB etchant business right, I think I’ve finally finally got it.

See?

Now, I know what you’re thinking: “Didn’t you show us a circuit board recently claiming that you had this all figured out before?”Well, I can tell you that I didn’t actually have it then BUT NOW I DO.

This whole tale will require something of a chemistry lesson, so let’s do that first:

A Chemistry Lesson

To make PCB etchant at home, you need just two ingredients:

  • “Muriatic Acid” a.k.a. Hydrochloric Acid a.k.a. HCL.This can be purchased from your local home depot.It’s usually marketed as a concrete cleaner.
  • Hydrogen Peroxide a.k.a. H2O2.You can pick it up at CVS.It’s actually cheaper than their bottled water.

The recommended concentrations of these two ingredients are 10% HCL and 2% H2O2.This is fairly easy to do because the HCL typically comes in 30% concentration by volume while the H2O2 comes in 3%.Two parts H2O2 to one part HCL gives you just the right combinations of both.Or so I thought…

Making etchant is actually a two-part process.The goal is to create Copper(II) Chloride (CuCl2).As you might have noticed, there is no Copper in either of the above ingredients.If you add Copper, this happens:

H2O2 + 2HCl + Cu -> CuCl2 + 2H20

So, you can either add some Copper you have lying around, or you can just etch a board.The solution will start out clear, but it will turn greenish after you add coper.This first “starter” etchant will etch extremely quickly, and I’ve found it to be a little too violent resulting in some undercutting and pitting of the traces on my board.When I thought I had it figured out last time, this is the etchant I was using.This was also the etchant I used for this demonstration.You can see that the board isn’t nearly as clean as the picture at the top of this post.

Okay, so moving right along.When you have your CuCl2, you can start etching to your heart’s content, but you have to watch out for a few things.As you use the etchant, it will turn a gross brown color.This is the result of this reaction:

CuCl2 + Cu = 2CuCl

The Copper(I) Chloride is that brown stuff.Now, I haven’t dealt with this yet, but apparently that reaction is reversible to a degree.When your solution starts getting gross, you just need to add some more Oxygen.This can be done by adding a small amount of H2O2 or just bubbling air through the solution.You then get this reaction:

2CuCl + 2HCl + O = 2CuCl2 + 2H2O

And your solution should turn green again.

Your solution also will need to have its HCl supply replenished from time to time, but more on that in my “Stuff I Screwed Up” section below.

In order to speed along the reaction and get good results, you might want to build an etchant tank.I made mine using a fish tank pump and heater, some rubber hosing, and a tupperware container:

I drilled some small holes in the hosing, plugged the end of it with glue, and glued it to the bottom of the container with some waterproof silicone sealant.

I turned the heater up all the way.I’m not sure exactly how hot it gets, but it’s rated for up to 36C.Heat will speed along the reactions, and I’ve heard that you can bring Copper(II) Chloride all the way up to 55C for good results (just be careful!).

The bubbling action serves two purposes.The bubbles help to add O2 to reverse the CuCl reaction, but they also help agitate the tank.This is very important for an even etch.You can see in the first photo on this post how the corner of the board didn’t etch.This is the corner that was out of the path of rising bubbles.Had I waited a little longer, it all would have etched, but during that time, the finished traces are getting eaten away slowly.I usually suspend the board right in the path of bubbles using some stiff coated wire to hold it in place.

You can see it in its bubbling glory here:

The starter etchant will eat through 1oz. Copper in a matter of minutes (maybe 5-10).Assuming you did everything right, the CuCl2 should take around 45 minutes or so.That’s why it’s definitely a good idea to have a tank that will do all of the agitation for you.You can leave it alone and just check back every few minutes.

So that didn’t seem so hard right?Apparently it was for me.If you care to keep reading, I’ll let you know all of the mistakes I made along the way (and you might even learn something).

Stuff I Screwed Up

If you’re just joining the story, you can see some details of some of my earlier failures here and here.I found that my solutions were working great when they were still the starter solution, but as soon as the color changed, they stopped dissolving Copper.I started to get some really crazy theories about it.

In my original etching tank, I used a fish tank bubbler instead of the rubber hosing.The bubbler is mostly plastic, but the bubbles were formed by forcing air through some kind of porous ceramic element.The element was originally blue in color, but as time wore on, it turned almost whitish green:

I was convinced that somehow the ceramic was reacting with the etchant and contaminating it (this is probably true, but it wasn’t the cause of my problems).

That wasn’t the problem at all.It was actually a much much cooler issue.

Everyone kept talking about CuCl2 having a greenish color.The lighting isn’t too good in my apartment, so I was never quite sure, but I always had a suspicion that something was up because my solution was most decidedly blue in color.I did some research on the topic and came across this awesome page which gives tons of information about Copper(II) Chloride.Turns out not only engineers are interested in the stuff.

I was originally drawn to the page by this video:

Which describes a reaction of Copper(II) Chloride to changing concentrations of Chlorine ions.When your Copper(II) Chloride is lacking in the Cl- department, the Copper ions will form what’s called a Hexaquacopper complex where one Copper ion combines with six water molecules.Adding more free Cl- ions draws the copper back into CuCl2.

This was exactly my problem!I hadn’t quite added enough HCl, and because HCl provides the magical Cl- ions, my Copper formed into Hexaquacopper and ceased to dissolve anything.Adding more HCl turned my solution a lovely green just like in the video above:

Chemistry is awesome.

Anyway, the moral of the story is: if your solution starts to turn brown, bubble more oxygen in, and if it starts to turn blue, you need to up the HCl.

And there you have it folks!After almost of a month of trial and error, I think I’ve finally got my PCB manufacturing process figured out.I’ll be doing a super awesome writeup of the whole process sometime soon, so stay tuned.

[via: http://ch00ftech.com]

 

Self-Monitoring, Analysis and Reporting Technology.

That’s a backronym if I’ve ever heard one.

Basically, my laptop’s hard drive is dead.

It came suddenly and tragically.Fortunately, I make backups often.Unfortunately, the most recent backup was from two weeks ago, so you would think from me saying that that I’ve lost all of the projects that I’ve worked on over the last two weeks.

But one more fortunately: Fortunately, I’m still able to access the drive in a recovery terminal and copy files off of it (actually, copy them straight on to a network store. Nifty, huh?).I’ve completely secured all of my project files and I’m able to open and work on them on my Windows PC.I’m also backing up everything I can off that drive while I still can just in case my other backups don’t work.

I’ve ordered a new hard drive for the Mac, and it will be getting here Saturday (yay Amazon Prime!).

Overall, this whole experience wasn’t super stressful.Worst case is that I would have lost an album I purchased last week and the schematic for the persistence of vision toy as well as a work-in progress that I started last Sunday afternoon.Let this serve as a reminder to BACK UP YOUR SHIT NOW.Seriously, a 1TB drive costs like $90.There is no excuse not to.

[via: http://ch00ftech.com]

 

And the back:

I’ll explain how later, but all I can say is that my last twoweekends of putsing around finally paid off.

There were a few minor shorts between some of the traces which I had to fix with a hobby knife, but I think that was mostly the fault of me pushing it a little too far.I’ll need to add more space between traces next time.

Having more space will also speed along etching, as most of this board was done in 10 minutes, and the other 20 were spent slowly etching away the last bits of copper between traces.I think when the traces are so close, the ink from my printer bleeds together and causes those areas to not get exposed to UV like they’re supposed to.

It’s past my bedtime, and I’m rambling.Short story is: I’ve got a three day weekend ahead of me, and I know what I’m going to be doing.

[via: http://ch00ftech.com]

 

Amanda and I finally cut the cord about two years ago, after having spent quite a bit of time developing a replacement for Cable television. We started to realize that many of the shows we watched were on broadcast television, and others we could wait for on DVD or watch legally online. Since cutting the cord we’ve never had any regrets and it’s because we always have something on the server to watch.

My setup uses one server running MythTV to record shows from an antenna I built. Those shows are transcoded and stored on a networked folder to be played back by various front end hardware running XBMC. After the break I’ll share all the hardware and software details that make this happen.

What goes into this setup:

  • An HD antenna (self-made in my case)
  • A networked computer to record and serve the library
  • ATSC tuner card(s)
  • Big HDD (1 gig per hour — I use 1 TB)
  • Device that runs XBMC at each television
  • Ubuntu
  • Self-compiled version of FFmpeg
  • Transcoding script
  • MythicalLibrarian to manage library

Capturing the air waves

You’re going to need an antenna. There are an unbelievable number of choices on the commercial market, but if you live in a city of any size at all you might be able to get great signal using stuff you have around the house. I built my own coat hanger antenna and only spent about $7 on some hardware and a coax connector.

I simply followed the Make Magazine instructions (PDF). They even covered the build in one of the Make TV episodes which is where the image above came from. Unfortunately, I didn’t take any pictures of the Antennas I built. Mine is now in the Attic where it feeds the coax network throughout my house and the rest of them I gave away to other cord cutters.

On the East side of Madison I get at least 13 channels. All of them are crystal clear except two of them when it is stormy. The signal works with anything that has an ATSC digital television tuner (all modern flat panels do) and I don’t need any amplification to distribute the signal to all rooms of the house.

The Recording Hardware and Software

ATSC is the television standard for digital broadcasts and it’s already a compressed format. This means it’s incredibly easy to record since the signal doesn’t need to be encoded as it did with NTSC analog cable recording.

I use dual ATSC tuner cards in order to record more than one show at a time. They are both PCI express cards so you’ll need to have one slot available for each card if you go this route. I have been very happy with my Hauppauge 1250 tuner cards.

Both cards are automatically recognized under Ubuntu 11.10 Oneiric Ocelot. This operating system makes it a snap to install MythTV, which is responsible for recordings.

Note: You will need to pay a subscription fee to easily use MythTV. This is because the software needs to know about the broadcast television schedule information in your area and this information is not free (at least not in an easily and automatically usable way). Luckily, some MythTV supporters got together and started a non-profit service that provides this info for $25/year called Schedules Direct.

Installation and setup of MythTV is a tutorial in itself and I won’t cover it here. I will talk about extra steps to transition MythTV recordings over to an XBMC controlled library. Keep reading for that.

Transcoding recordings

1080i video can be huge! For instance, it’s not uncommon for one hour of video to be 6 GB. I’m not a stickler for this level of quality, and am quite happy with DVD quality. For me, this is also necessary because not all of the hardware I use to watch these recordings can handle video of this quality.

I’m using a script to automatically transcode to DVD quality. The original files are saved, in case there was an issue with the conversion. I clean those out manually from time to time, but you can set up a cron job to do this if you’re so inclined.

You probably want to compile your own version of FFmpeg. The version available in the Ubuntu repositories has a bug that will very occasionally crash the process if the recording has signal interference (remember, you’re using an antenna for the source so there may be slight glitches in the signal) but it’s been fixed upstream. This is quite easy, even if you’ve never compiled anything before. That’s because the Ubuntu forums have a fantastic thread that shows every command necessary to pull this off. I’m very comfortable compiling source but I’m in the debt of FakeOutdoorsman because his guide is so useful!

I based my script off of a MythTV script that was intended to automatically remove commercials. It is very good at keeping a backup and returning error codes (which is why I modified it for my uses). Syntax is easy enough, and I’ll get to that later when we work on adding a user job to MythTV to automate this. For now, download the file directly, or grab it from my Github repository. Save the file to the mythtv home directory (/home/mythtv).

Moving recordings to an XBMC-friendly library

XBMC has a great scraper for grabbing thetvdb.com data such as art-work, episode titles and descriptions, info about the cast, and more. We just need to have the files named correctly and in a hierarchy which XBMC can understand. This is a huge amount of work to do by hand, but luckily my friend Adam Outler wrote an amazing piece of software called Mythical Librarian that will do it for you automatically.

To get the script up and running, first make a directory on your big hard drive, make the mythtv user (automatically created when you installed MythTV) the owner, and set the appropriate permissions:

sudo mkdir /BigHardDrive/videoLibrarycd /BigHardDrive/videoLibrarysudo mkdir TV Movies Showingssudo chown -R mythtv:mythtv /BigHardDrive/videoLibrarysudo chmod -R 775 /BigHardDrive/videoLibrary

This creates a drive that will store the three different types of recording categories that Mythical Librarian uses, changes the owner and group to MythTV, and gives full access to the owner and group members. This will be important later so that recordings can be deleted via a network share once you’ve watched them.

Next follow the automatic installation on Linux instructions for MythicalLibrarian. Here are the answers that I chose along the way. You should actually think about them and learn what you’re doing, but I know… you just want to get this over with:

  • library-notify-send – NO
  • Build
  • mythicalInterface – should be MythTV0.24 if you’re using Ubuntu 11.10
  • Use Defaults – NO
  • End File Location – Manually choose Folders
  • (Now select the TV folder you just created)
  • SymLink – NO (we want to control the recordings using XBMC)
  • Database Type – YES
  • MySQL name – OK (should be mythtv by default)
  • Enter your MySQL password – OK (default should be auto detected)
  • Enter you DB host IP – OK (should be localhost in most cases)
  • Enter your MythTV PIN – OK (should be 0 by default
  • (Now select the Movies directory you created before)
  • Unrecognized programming – No (I’ve never had good luck with this feature so I don’t use it)
  • (Now select the Showings directory you created before)
  • Enter your Desktop username – OK (this probably doesn’t matter)
  • Desktop Notifications – No
  • XBMC Notifications – No
  • Enter the username of the person who will run MythicalLibrarian – OK (should be mythtv by default)

Whew, that was a lot. The package will now run some tests. A couple of them will fail (Desktop notifications and XBMC notifications because we didn’t enable them). But the directory tests must succeed or you need to fix your permissions and try again. This is why I shared the commands for setting up the storage directories!

With that set up (this was one of the more confusing parts so great job getting through it!) we can create some user jobs to make this automatic.

MythTV user jobs

Once a recording has been stored on the hard drive, MythTV has the ability to automatically execute commands related to that file. First we need to set up a couple of User Jobs.

Enter the setup program for mythtv by typing this at the command line:

mythtv-setup

You’ll be warned that the backend must be closed to run setup. This is fine as long as you’re not currently recording something.

Press enter when “1. General Setup” is highlighted. Press enter until you get to the tenth screen where user jobs are setup (there’s an image of this below). You need two user jobs, it doesn’t matter which ones you use, as long as the transcoding job is above the mythical librarian job. For User Job #1 I have a description and command of:

Downsample to DVD quality/home/mythtv/1080-to-dvd.sh %DIR% %FILE% %CHANID% %STARTTIME%

For User Job #2 I have a description and command of:

Mythical Librarian/usr/local/bin/mythicalLibrarian "%DIR%/%FILE%"

Press enter until you get back to the main screen. Press escape to exit. You do not need to run mythfilldatabase at this time.

We’re nearing the finish line. Next you need to make sure the files are available on the network.

Setup samba

Setting up the server packages is an easy one-liner:

sudo apt-get install samba

Next add mythtv as a samba user

sudo smbpasswd -a mythtv

Setup your samba folder configuration using your favorite text editor (I used gedit):

sudo gedit /etc/samba/smb.conf

And copy this to the bottom of the file (change the path to directory locations you created earlier):

[Recordings]path = /BigHardDrive/videoLibrarypublic = yeswriteable = yesavailable = yesbrowsable = yes

Finally, restart the samba server:

sudo restart smbd

Samba is a network file sharing system that pretty much everything supports these days. We’ve shared the recording library folder using that protocol without any type of password security. This is fine if you’re behind a hardware firewall like a wireless router. It’s not a bad idea to think about your home network security at this point, but I won’t cover that here.

Install MythWeb to manage your recording schedule

sudo apt-get install mythweb

This one-liner will install mythweb. Once done, you can go to http://YourMythTVServerIP/mythweb to schedule recordings. Notice in the screenshot I’ve check the box next to the User Jobs we’ve set up. This is what makes this whole thing automatic and needs to be done for each program you set to record (no each episode… just each TV show).

When I set up the user jobs before I made sure that the transcoding job was above the Mythical Librarian job. Here you can see the same order. Whichever command is higher on the list will be executed first. We don’t want to run the Mythical Librarian command first because it moves the files and removes the meta info from MythTV. This would make it impossible for MythTV to automatically run the transcoding operation afterwards.

This completes the server-side setup. All that’s left is to find something that can play from your well-organized library of recordings.

Configuring XBMC

XBMC is an open source media player. It works on a huge number of devices, including computers running Linux, OSX or Windows operating systems, Apple TV 1 and 2, iOS devices like iPad, iPhone, and iPod touch, the Boxee Box, and others. Download a copy for your device and install it.

Note: I installed XBMC for Ubuntu 11.10 Oneiric Ocelot from a PPA:

sudo add-apt-repository ppa:nathan-renniewaldock/xbmc-stablesudo apt-get updatesudo apt-get install xbmc

First, let’s setup the general network features that will make it easier to use the samba shares setup earlier. Got to:

System –> Network –> SMB Client

and enter the IP address of your MythTV computer in the ‘WINS’ server field

Next navigate to:

System –> Video –> Library

and choose “Update Library on Startup”. This way, every time you start XBMC to watch a program, newly recorded shows will be automatically added to the library.

The final setting you’ll want can be found at:

System –> Appearance –> File Lists

Make sure you add a check mark to the box next to “Allow File Renaming and Deletion”. This will allow you to delete programs in the library after watching them by pulling up the menu and choosing “Remove from Library”. A secondary prompt will ask if you also want to remove the file. If you aren’t asked about file removal, it’s because this option wasn’t chosen.

Adding your shares to XBMC

This is it, the final step. Everything should now be in place for your system to work, but you need to tell XBMC where the recordings are stored.

From the main menu of XBMC choose “Video”, then select “add source”. When asked to enter the path to your content click the Browse button to the right.

From the list presented choose “Windows Network (SMB)”, then navigate through the folders until you get to the directories which we set up during the samba configuration part of this tutorial. Remember when we created a TV, Movies, and Showings folder? You want to create a separate source for each, and give them a name which will be displayed on the XBMC menu. To the right is a screen capture of what my Television source looks like. Note that your path will be different from mine.

The next screen will let you choose what type of content this folder contains. Choose what’s appropriate, in this case I’ve selected TV Shows and am using the recommended ‘The TVDB’ scraper. Make sure to put a check in the “Run Automated Scan” option so that XBMC starts looking for TV Shows right away.

Conclusion

If you’ve made it this far, congratulations! Things have gotten so much easier over the years, but your first setup process is always a big undertaking.

You should now be able to navigate, watch, and delete your shows from the sofa. New recordings can be scheduled using a computer by loading up mythweb. And don’t forget that XBMC has a ton of Video Add-Ons that will let you watch content from the Internet

I’ll leave you with one pro tip. If you use XBMC in multiple locations in your house, deleting a recording from the library on one piece of hardware will not remove it from the others. You need to clean the library to do that. It is possible to do this automatically, but there are some gotchc’s that made that process too much for this tutorial. Check out the wiki if you are comfortable setting that up yourself.

Follow Me

@szczys

[via: http://jumptuck.com/]

© 2011 Geko Geek This is a news aggregator website. Articles and images are copyrighted to their original source authors. Gekogeek takes no responsibility about the articles content Suffusion theme by Sayontan Sinha