Saturday 14 May 2011

Boolean Logic in electronics

I stumbled across this great website in regards to basic electronics (for the AS Electronics course in the UK). Alas at the moment I don't have time to do much electronics or programming as I'm just about to start a month of exams, come the 20th June, I shall be back with hopefully some interesting posts!
See you then..

Tuesday 10 May 2011

Packaging

I just received a fountain pen through the post today. I was a bit put out due to it not being in any packaging and being loose in a jiffy bag, upon reflection it occurred to me, this is great - no waste, the pen survive fine, no damage at all. I then remembered when I bought some DIP sockets from rapid, they sent 1 tube (roughly 1cmx1cmx60cm) in a 1mx0.5mx0.2m and stuffed it full of paper, surely the could use tubes that they use to send posters in instead?! It's infuriating how much the electronics industry waste, I've seen a few posts on sparkfun's packaging, it looks quite minimalist yet sufficient for the job, why can't more suppliers be like this!
Rant over.

Friday 6 May 2011

PCB etch tank

So I've got hold of some of the things I need, aquarium heater, bubbler and check valves, the chemicals are on there way and should be here soon, I'm looking forward to testing some things out. The immediate problem, being a student, I am somewhat poor and I have slightly broken my aquarium heater (more on that later in this post) so things progress slowly (I also have exams and should be focussing on them, but I'm not, because I like electronics more and I'm dedicated to my hobby...)

Here are a few pictures of the the parts:
From PCB etch tank
From PCB etch tank

I got the heater today, I thought "Great, this is exactly what I want" I even managed to slice the limit stopping you from turning the knob too far so I could reach higher temperatures (read: ~40 °C)

N.B. *Sigh* just looked at the cupric chloride guide:

Temperature (°C)040HCl fuming increases.
Etch speed increases. (see note 1)

Looks like I might not even need that heater... I think for the sake of simplicity and cost I shall eliminate it. Good, I feel like I have less things to limit my design now.

Coming back from my tangent, I had modded it and let it sit at ~45°C for a bit and went out for a run leaving it on, I came back to find it no longer working. I took it apart and found that the framework it was all attached to had melted and had pushed the magnet out stopping the lever from making contact with the contact. (best described with a picture)
From PCB etch tank
The lever on the bottom touches a contact when the blue knob is turned (this is how you set the temperature). When the temperature has reached a certain point, the lever expands and the magnet can no longer hold it touching the contact so it returns to the position in the picture breaking the circuit, I tried to remold the magnet hold and to some extent I had some sucess, I put it back in it's glass tube and turn it back on. *BANG* I have a nice set of sun spots and the breakers go; the heating element had shorted.

Before:
From PCB etch tank
After:
From PCB etch tank

I took it all apart and tested all the components then fixed the heating element (shortening it due to a part blowing off it. I assumed the bulb had gone so took it out and replaced it with a jumper, it didn't work. After 30 minutes of troubleshooting I thought to check the fuse (I should have done this first) and low behold it had blown. After reassembling it this time I got a lovely red glow from the element so I'm assuming this is due to the loss of part of the element and the element's resistance has gone down.
From PCB etch tank
Because the circuit is setup as a potential divider the bulb was dimmer due to the lower resistance of the element & thus lower current through the bulb. The bulb is attached to a ~120k resistor which I think I'll replace with a lower value one to divert more current to the bulb and hopefully remedy the over powered element issue.
From PCB etch tank
My apologies if this is a little incoherent, It's getting a bit late here. Time for experiment 18 I think, I fancy some electronics to calm me down after such an eventful evening!

MAKE Electronics: Experiment 17: Emitting a tone (555)

PART 1:
This experiment sets the 555 up in astable mode (check out the previous post for an explanation). The 555 will emit pulses at a certain frequency which will drive the speaker. Changing the frequency of the pulses will then in turn change the frequency of the speaker's tone. To change the pulse frequency or rate, we adjust the external capacitor connected to pin 6, the threshold pin. (or the resistor between 6 & 7)
From MAKE: Electronics: Experiment 17 (555 in astable mode)
From MAKE: Electronics: Experiment 17 (555 in astable mode)

Here's the circuit, lets have a look at the schematic of the 555 in astable mode again:

So the THRESHOLD is connected to the TRIGGER, when the cap, C, is charged past 2/3 of the Vsupply the threshold is passed and the capacitor discharges through R2 into pin 7 (DISCHARGE) and a pulse is emitted from OUT. Once the cap has discharged and the IC is no longer triggered, the cap starts charging again, when it reaches 2/3 Vsupply it repeats the process, this results in a series of pulses, this is called a square wave oscillator, because it's producing a a series of square wave pulses. This is great for generating tones on speakers, flashing LEDs (albeit highly overkill!) etc.

PART 2:
Now we chain 2 chips together, both in astable mode, this produces a warbling tone.
The 555 on the left (IC2) is working in the same way as in part 1, however this time, a second 555 (IC1) is chained to the chip with it's output attached to pin 5 of the tone generator 555 (IC2). When IC1 produces a pulse it increases the voltage at pin 5 (2/3 Vsupply results in the chip emitting a pulse) so when IC1 emits a pulse and triggers the second chip to generate a pulse the capacitor attached to pin 5 of IC2 is less charged than it would have been if IC1 wasn't chained to IC2, this results in a higher pitch, because IC1 is oscillating far slower than IC2, IC2 isn't always triggered by a pulse from IC1 meaning it operates in its normal mode and produces a lower frequency tone.

This results in a warbling sound to be produced as some of the time IC2 is producing high frequency square waves (when IC1 is emitting a pulse) and some of the time IC2 is producing lower frequency square waves (when IC1 is not emitting a pulse)


(the video shows the circuit the other way round, sorry about that!)

There is a hell of a lot of info in this experiment so I think I'll spend some time playing around with the 555 trying to figure out how to get it to emit different pulses, an oscilloscope would be great to have around for this experiment!

Thursday 5 May 2011

Custom etch tank: The start.

I've decided to have a bash at making an etch tank as I like making PCBs, however at the moment I've got no way to heat my etchant up and the whole affair is looking like a rather sorry state. After reading this instructable, I decided to build my own, I really like the etch tank design but would like to redesign it myself, purely for the practice in CAD and in-depth knowledge it will provide. I've bought an aquarium pump and heater to use in it and I will be using cupric chloride to etch.
I've found a wonderful website with a list of several materials and their resistances to specified chemicals, it's really invaluable to picking materials to use.
So far I have chosen a few materials:

Etch tank - Acrylic
Tubing - Ideally polypropylene (but I will settle for PVC) 1/4" ID (same as aquarium pump)
Fittings - Ideally polypropylene, but if PVC one are available I'd settle for them, they're expensive and hard to find.

It's a rather pitiful list but it's all I've decided on for the moment. I'm looking at buying chemicals, shipping is painfully expensive and I haven't really calculated how much I need to get, so that's on my to do list. It looks like higher concentration solutions of hydrogen peroxide cost the same as the lower concentration ones, obviously I'll go for the higher concentration as It's less to store, shipping will be cheaper and It's easy to dilute it.

I also need to get some methylene chloride for solvent welding acrylic, it's pretty cheap here, but I might buy it from ebay depending on delivery prices, this seller has most/all of the chemicals I need. Scratch that, the first seller mostly what I want at lower prices, excellent!
Hydrogen peroxide is the only thing that isn't stocked there, I thought I'd figure out how much I need, at 35% it's pretty concentrated, I used this handy calculator to find the concentration in mol/dm^3, so 500ml at 35% can be diluted to give 5 litres of 1.16mol/dm^3 looking at the equation on the cupric chloride link:
2H+ + Cu1+ + O{aq} → Cu2+ + H2O
This looks like it's probably going to be more than sufficient. Actually looking at the page again, it just occurred to me, I don't even need hydrogen peroxide after producing the etchant as I can regenerate the solution using air, I'm going to just get 250ml...
The acid gets used up so I'm buying a litre of that, the common mix to produce the starter etchant seems to be:
1 part HCl (35%)
2 parts H2O2 (3%)

UPDATE:
Just bought:
1 Litre HCl
1 Litre Acetone
1 Litre methylene chloride
1 kg NaOH (just in case I want to do titration and analyze my etchant)
£9.50 for delivery
£11.50 for the chemicals

Now I can whip up some etchant, have a play around with it and see whether the check valves I've bought are or are not made from polycarbonate... hopefully they'll be OK.

On a side note: I've picked up a laser printer (from freecycle!) which I may play around modding to print on circuit boards. However, it looks like a fairly complicated endeavour which currently I'm not sure I need to embark on, one for the future perhaps.


Sunday 1 May 2011

Learning Processing Chapter 5.6

BOOLEAN VARIABLES:
Just a short post today, lots of work to get on with.
This little segment teaches you how to program a button in processing, a basic of UI design.
Boolean variables are either true or false, nothing in between.

mousePressed is a boolean variable, it is true when a mouse button is pressed and false when they are not. We use this in the button example, this is an emulation of a light switch in a dark room, when you press the switch the light comes on, when you let go, the light goes off and the room goes dark. This is implemented using similar code to the roll-over example:

 // Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 5-4: Hold down the button
boolean button = false;

int x = 50;
int y = 50;
int w = 100;
int h = 75;

void setup() {
size(200,200);
}

void draw() {
// The button is pressed if (mouseX,mouseY) is inside the rectangle and mousePressed is true.
if (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h && mousePressed) {
button = true;
} else {
button = false;
}

if (button) {
background(255);
stroke(0);
} else {
background(0);
stroke(255);
}

fill(175);
rect(x,y,w,h);
}





(Taken from the learning processing site, all credit to Daniel Shiffman)

This code is fairly self-explanatory after the rollover exercises, the only thing I am a little unsure about it is this line:
if (button) {
I assume that (button) is the same as writing (button == true)
looking on this link it appears so, and (!button) would be the same as writing (button == false).

The next step on is to implement a switch feature so that when the button is pressed, it latches and stays on until you click it again. This makes use of putting code in the mousePressed function.
 void mousePressed() {
if (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h && mousePressed) {
button = !button;
}
We just add this to the end of the code and get rid of the first conditional in the draw() loop as it is no longer needed.

Shiffman's Code:
 // Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 5-5: Button as switch
boolean button = false;

int x = 50;
int y = 50;
int w = 100;
int h = 75;

void setup() {
size(200,200);
}

void draw() {
if (button) {
background(255);
stroke(0);
} else {
background(0);
stroke(255);
}

fill(175);
rect(x,y,w,h);
}

// When the mouse is pressed, the state of the button is toggled.
// Try moving this code to draw() like in the rollover example. What goes wrong?
void mousePressed() {
if (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) {
button = !button;
}
}

So this time, when the mouse is pressed inside the rectangle, button is set to set to the opposite of what it was, if it was true then it would become false and vica versa.
I had to think about this for a bit to understand how it works, Draw is continually looping looking at button's value (true or false).The 'mousePressed' code is only initiated when (as you already knew) the button is pressed, (let's say the original value was false) clicking inside the rectangle changes the code to the opposite of what it was, so, it becomes true. Draw() loops and reads that button == true from the line "if(button) {" and then changes the background colour and stroke colour accordingly.

Here's what it produces:
(Taken from the learning processing site, all credit to Daniel Shiffman)