So there were 2 VERY OLD, DUSTY (at least 1" thick beneath the cover!!) and UNAPPRECIATED Sony speakers that one day magically appeared in our T902 club hauZ. Seems that somebody conveniently let this GOOD SPEAKERS rot in an isolated corner, get kick around and UNLOVED.
Upon close inspection, the speakers are still usable. Well, at least the leads to the + and - terminal are still intact and no sign of corrosion from the moisture yet. To make these bad boys start to sing angelic tunes AGAIN, I need something to amplify the audio signal from iPod, laptop, android phones etc (not necessary be mine laaaaa). By plainly hooking the other exposed end of the mini stereo jack to the speaker’s 2 terminal won’t yield any sound. Better luck if the speakers are hooked up to a 2kHz function generator.
I need an AMP as cheap as possible. There is no luck finding the original Sony ones. Obviously, it was dumped because of the spoilt amp and hifi system. Try making one amplifying circuit from components from the lab, e.g some TIP31C, R&C ? Too time consuming and the amplified signal produced may only yield <1W from these big ASS speakers. We need something that can yield 8W from the circuit. A quick look at the store, no such IC’s readily available.....
Some shopping is seriously needed at your friendly Sim Lim Tower.........
After some browsing at the kit set’s section, I came across a 8W amplifying circuit kit set complete with good quality PCB with routes thick enough to pass high current, BIG heat sink and the best part, it is only s$17.50. After laying my paws on it, I hurried back to office can’t wait to start work on it.
The I/O parts are not supplied in the package, just few pieces of measly bare copper connector. I modified the inputs to a 3.5mm Stereo jack for the convenience's sake of plug to a laptop/android/iPod etc. As if it is going to be the headphone, albeit a BIG one. As for the power jack, it is done using a DC power jack with the +ve leads in the inner ring. DO NOT SOLDER or CONNECT inversely ! Outputs, I used some screw down terminal blocks meant for PCB. Too bad the PCB is designed for the above mentioned copper. I got to cut the terminal blocks to half to use it. Make sure to stick some tape on the components side, this is to prevent the components from falling out of place when soldering.
Fire up the soldering gun and start soldering......
Next up, I need a power supply that can supply 12V DC for 1A. My unloved HP charger can only go up to 6v and 200mA. I quick dive into my pile of junk and tadahhhhh... I found a dc wall adapter that satisfy the requirement. Lesson learnt, do not discard the old parts. It may come handy some day. I also added my VU meter which i made many years for practising my soldering skill. Now we got LED light indicators on the sound
Hook up the dc adapter, stereo jack to laptop and speakers to the amp circuit. Enjoy!
On a side note, the boys hook up this set to their home made projector and now we got a poor man’s cinema complete with “dolby digital surround” (speakers on the floor facing wall and reflectors to create the effects)!
What's neXt? Tube Amplifiers ???? teeeheeeheeeee
Thursday, May 19, 2011
Tuesday, February 8, 2011
exercise code
refer to your year1 structure programming book
1. pg 121 . create a new function that calculates the difference of 2 numbers
2a. pg 146. modify the code to use a vector instead of an array.
2.b. pass by reference the vector to a new function to add 5 into each elements of the vector. Cout the vector in the main() to verify the value.
1. pg 121 . create a new function that calculates the difference of 2 numbers
2a. pg 146. modify the code to use a vector instead of an array.
2.b. pass by reference the vector to a new function to add 5 into each elements of the vector. Cout the vector in the main() to verify the value.
Tuesday, January 25, 2011
[DSA] binary tree
terminology
the root: the beginning of a tree.
every node is possibly the root node for the nodes below it. eg. the parent node.
parent node, the n-1 lvl of the n's lvl node.
child node, the n+1 lvl of the n's lvl node.
(n-1)
|
___n____
| |
(n+1) (n+1)
edge, the path for traversal to happend.
leaves, the lowest lvl in the tree.
a binary tree, a tree where each parent node only have 2 children.
binary search tree (BST)
a binary tree, where the root node is always the middle value of the list of values.
remember binary search from previous week?
what are the 2 possible condition to be satisfied before one can qualify for binary search?
BST it self is not efficient. there is a possibility that the insertion of the node will cause it to behave like a worst case binary tree.
we need a sorted BST, where each time a node is inserted the tree is "sorted" to find out which is the new node. What are the implications if the tree are always sorted when insertion or deletion is done??? Is there any other possible way to enhance it?
3 ways for tree traversal
-Inorder
Traverse the left subtree
Visit the current parent
Traverse the right subtree
-Preorder
Visit the current parent
Traverse the left subtree
Traverse the right subtree
-Postorder
Traverse the left subtree
Traverse the right subtree
Visit the current parent
uses of binary tree data structure
- compression
- encoding
- conversion of mathematical formula to prefix or post fix form
- data structure of choice for "fast" retrieval of search items
there are many other type of binary tree
full binary tree
perfect binary tree
balanced binary tree
self balancing binary tree
the root: the beginning of a tree.
every node is possibly the root node for the nodes below it. eg. the parent node.
parent node, the n-1 lvl of the n's lvl node.
child node, the n+1 lvl of the n's lvl node.
(n-1)
|
___n____
| |
(n+1) (n+1)
edge, the path for traversal to happend.
leaves, the lowest lvl in the tree.
a binary tree, a tree where each parent node only have 2 children.
binary search tree (BST)
a binary tree, where the root node is always the middle value of the list of values.
remember binary search from previous week?
what are the 2 possible condition to be satisfied before one can qualify for binary search?
BST it self is not efficient. there is a possibility that the insertion of the node will cause it to behave like a worst case binary tree.
we need a sorted BST, where each time a node is inserted the tree is "sorted" to find out which is the new node. What are the implications if the tree are always sorted when insertion or deletion is done??? Is there any other possible way to enhance it?
3 ways for tree traversal
-Inorder
Traverse the left subtree
Visit the current parent
Traverse the right subtree
-Preorder
Visit the current parent
Traverse the left subtree
Traverse the right subtree
-Postorder
Traverse the left subtree
Traverse the right subtree
Visit the current parent
uses of binary tree data structure
- compression
- encoding
- conversion of mathematical formula to prefix or post fix form
- data structure of choice for "fast" retrieval of search items
there are many other type of binary tree
full binary tree
perfect binary tree
balanced binary tree
self balancing binary tree
Monday, January 24, 2011
[DSA] map and set container
map<string,int> mapp;
map<string,int>::iterator mit;
string name_search;
mapp.insert(map<string,int>::value_type("Amy",81377442));
mapp.insert(map<string,int>::value_type("Bob",32731631));
mapp.insert(map<string,int>::value_type("Catherine",32387163));
mapp.insert(map<string,int>::value_type("Danny",21321312));
mapp.insert(map<string,int>::value_type("Ecuador",54543947));
mapp.insert(map<string,int>::value_type("Felicia",32535612));
mapp.insert(map<string,int>::value_type("Genie",24172312));
refer to above on how the map data structure is used.
use the map data structure to satisfy the following requirements.
1. create a phone book application that can store name and phone number.
1a. perform a display all entry in the phone book.
2. phone number need to that ensure it is 8 numerical digits only.
3. initialize the phone book application with some data.
4. perform a lookup for a random entry in the phone book and display it.
challenge
5. Suggest a method to store address, email and msn address to the phone book that you have already created.
6. what are the advantages and disadvantages of your method??? explain why you choose the design.
Tuesday, January 18, 2011
[DSA] searching
Have you ever tried to find something in your house/room. Yet can't seems to ever find it. Now, lets not talk about misplacing items out of carelessness. Let's discuss how to "find" items in your wardrobe.
Assume you have your apparels hanging in the wardrobe, how would you "find" your favorite shirt/dress? would you start looking from the left hand side? the right hand side or simply in the middle???
If you find 1 apparel at a time from either direction, that is linear search. The worst case scenario is, you would traverse all your apparels before finding your favourite.
If you have sorted your apparels according to a certain sequence, eg, warm colours to the right and cold colours to the left, you can simply start finding from the middle, then to the left if your favourite falls in the cold colour. This is binary search. searching time can be reduced significantly.
Again, if you do like what i did, simply pile up all my apparels in the wardrobe without sorting/folding/ironing it. "Finding" for a particular item in the wardrobe can be disastrous.
Linear Search => O(N)
Go through the entire array of items to lookup on the searched key. The sequence of items are not sorted.
Best case , the 1st item in the array.
Worst case, the last item in the array.
Average case, traverse for half of the array
Binary Search => O(logN)
Uses a divide and conquer method.
array of items must be sorted first, involves a cost.
L <> root
|---|---|
L---M---R
For any array of 1000000 items, Linear search need 500000 comparison (assume an average case), Binary Search 20 comparison.
Pop Quiz
1. Create a generic code of linear search to take in different data type.
2. Create a Binary Search tht uses recursive method.
3. Use find() or search() from the STL to do a lookup of a string, among many strings stored in the memory
Subscribe to:
Posts (Atom)


