Wednesday, 4 April 2018

DIY Dodow Clone Sleep Meditation Machine

I made an instructable of how to build a Dodow sleep meditation machine clone here;

https://www.instructables.com/id/DIY-Dodow-Clone-Arduino-Sleep-Meditation-Machine/

Below details how you'd select which resistors to use with the circuit...  I think I'd drank to much coffee that day so be warned, it's pretty long-winded & boring. 
The Finished Dodow Clone

You have been warned!


Resistance is Futile: A brief Introduction to Ohm's Law

Suggested music to learn Ohm's Law: Steve Moore 'Pangaea Ultima' album



Very Important Rule
















You'll need an LED, resistor, wire and a breadboard.  How to tell which resistor to use?  For this we can use Ohm's Law, which can be remembered as a Very Important Rule aka VIR.
V = Voltage
I = Current (don't worry that it doesn't begin with an 'I' as that was already taken)
R = Resistance

Ohm's law allows us to figure out one of the above, if we already know two of the others.  E.g If you knew the current and the resistance of something, you could work out the voltage needed.

So what do we know, and what do we need to know.  We're trying to work out which value of resistor we need, so we're trying to figure out the resistance (R).  So let's see if we can work out the other two parts of Ohm's law, voltage (V) and Current (I).

So lets try voltage first, how much voltage does an Arduino Uno pin output? Well lets try putting that into google;

 5 volts.  So now our problem looks like this;

V = 5 Volts
I = ???
R = ???

So lets see the current needed that will pass through an LED.  For this I'll google 'LED Datasheet' which should give us all the possible info on LEDs.  The second result looks simple, so I'll click that;


From which it gives us the information;

This is a very basic 5mm LED with a red lens. It has a typical forward voltage of 2.0V and a rated forward current of 20mA.

If you want to get little more dirty and actually open the datasheet you'll see the full specs;
Ok, so we can learn two things from this, that to power these LEDs takes about 2 volts (max of 2.2 before she'll blow up), and a current of around 20mA.  But hang about our Arduino pin supplies a max of 5 volts and these LEDs require 2 volts to run, won't we risk blowing up the LED? Yes!  That's why we're working out the value of the resistor to protect it...

Now our VIR looks like this;

V = 5v minus the 2v that we need to run the LED.  This leaves us with 3 volts.
I = 20mA, which to be able to use in ohm's law we need to convert to amps.
R = ????

Now lets convert the 20mA into Amps, you could work this out by moving the decimal place, but come on, lets just use an online tool;


20mA = 0.02 Amps.

So now we have;

V = 3 volts
I = 0.02 Amps
R = ???

We're nearly there (All this for a resistor value ffs!), but now we just need to now the calculation to use to get the resistance, for this let's take a look at the Ohm's Law Triangle;

Not only does it look cool (think band logo or over priced bagel shop) it's actually showing us which rules to use depending on what information you have.  If you knew Current (I) & Resistance (R) you would multiply to get Voltage (V), see here;

 Whereas if you knew voltage (V) and one of the others you'd divide, like this;


So let's try that;

V = 3 volts
I = 0.02 Amps
R = ???

3 / 0.02 = 150

150 Ohms!   Anything under that and there's a chance the LED will be fried, infact it's good practise to go by the 1/3 rule...  give yourself an extra 1/3 than the minimum needed.  so 1/3 of of 150 is 50, so to be safe from any power fluctuations etc we'll use a 200 Ohm resistor (150 + 50)...  except I'll actually use 220 Ohm resistor as it's a lot more of a standard value.

So that's how we come up with the resistor value.  It's a little long winded but you'll eventually get there pretty quickly with practise.  Or just use a 1k Ohm resistor like lots of other people generally default to ;-)

Before we leave this section, we can double check our maths with the Ohm's Law pyramid, substituting differing known quantities;

V = 3 volts
I = 0.02 Amps
R = 150 Ohms

If you knew V and R but not I, according to the pyramid you'd do the following;

V / R = I

which is;

3 / 150 = 0.02 amps

And ff you knew R and I but not V, according to the pyramid you'd do the following;

R x I = V

which is;

150 x 0.02 = 3 Volts

So you can see how the Very Important Rule can be used in different ways if you only have certain information to hand.  This may be of some use to you one day.  Or maybe not.


All that just to find the correct resistor!
Circuit Board and Batteries
Resistors soldered to LEDs

























The controls for the unit
Making the Case





















The finished Sleep Meditation Machine




Sunday, 1 April 2018

DIY Audio Amp



DIY Audio Amp

I was once told every man should do three things in his life; father a child, build a house,  plant a tree.  I have done none of those things.  I did however build a very under-powered audio amp.  We were given an old Technics record player, and me being economically self-reliable (cheap) I thought I'd build the amp to go with it.  What follows is a description of a descent into madness;

This is the amp, model version 1.  Rather than order parts to make a monster amp, I used what I had; an LM386 op amp chip.  This chip is not designed to power large stereos, but why let that stop me?   Using the schematic from;

http://www.circuitbasics.com/build-a-great-sounding-audio-amplifier-with-bass-boost-from-the-lm386/

I built two amps into one device, one for each speaker, effectively doubling the power, from 1 to 2 watts of power.   It was never going to blast down the walls or anything, but for home use it should do.  I spent ages neatly soldering everything into place, 

arranging the wires so they looked smart in their new home.  I added a switch so you could choose between the record player or a jack input, a power indicator LED, and an on/off switch.  Everything had gone well during the build, everything was looking good. A thing of beauty you might say.  Then it was time to try it.  A very faint sound from the record came through the speakers, like a spirit communicating from the netherworld. Also a digital 'tapping' could be heard.  I then spent the next 3 days trying to figure out what was going wrong.  The digital noise, I finally deduced was coming from the power supply capacitor being too close to the input jack.  I'd have to re-make the board and move that away from any inputs, and to be safe, keep the amp circuit away from the power supply as well.  With much sadness I started desoldering all the parts on my beautiful circuit.  Parts stubbornly refused to come out, and as time went on it was thrown in the bin in anger.  To save time on the V2 I decided just to build the amp with one LM386.



This is the new version of the amp.  Gone is the selector switch (if you want to listen to music through your phone you can damn well unplug at the back and connect in).  It's also now in mono.  Basically it's a regression from all the features in the first version.  I'm not sure that's how subsequent models are supposed to work, but whatever.




 




























Everything inside was given distance from any parts that might cause interference.  Ground connections also had an individual ground cable, again to minimise interference.  It came time to switch it on.   My trembling finger started to push down on the power switch, all the while remembering the many hours spent finding the causes to the problems.  With a click the power light came on...  AND THEN THE SAME BLOODY THING HAPPENED!!!!!!!!!!!!!!!!!! 

To say I was annoyed would be an understatement.  Swear words echoed down the nearby streets, neighbours cowered behind curtains, dogs yelped.  Anyway, I mostly laugh about it now.  Especially when I realised the record player needed to have a shared ground to the amp.  When I connected this it made a click and then it worked fine.  Oh how I laughed.  Laughed through tears.

Then I was told we were being given a decent technics amp anyway.

RIP old amp.

.